Dear all and programmer,
Iinstalled a unbuntu workstation with a web server. I also past in /var/opt a python script.
On my wirefall, I open the port 81
That script listner the port 81 and store a a mysql data the entry.
In order to make sure it work, I create another script, on my mac.
That script send data to server. The format of data are
"toto","titi","tata","tete"
The remote server collect the data and store it in to the DB.
Also, when the connection is done, the python script , of the unbuntu, dusplay a message " connection done"
Then it work
I also have a Arduino Uno and a Spreadtrum GSM card. I also have a SMI card and the PIN is unactive. From my mobile I can call it.
On my arduino, I have that code
pinMode(13, OUTPUT);
Serial.println("GPS Parser Initialized");
digitalWrite(POWERPIN, LOW);
delay(500);
Serial.println("Setting up PDP Context");
cell.println("AT+CGDCONT=1,\"IP\",\"wap.cingular\""); // IS THAT LINE CORRECT?
delay(500);
Serial.println("Activating PDP Context");
cell.println("AT+CGACT=1,1");
delay(500);
Serial.println("Configuring TCP connection to TCP Server");
cell.println("AT+SDATACONF=1,\"TCP\",\"xxx.xxx.xxx.xxx\",81");
delay(500);
Serial.println("Starting TCP Connection\n");
cell.println("AT+SDATASTART=1,1");
When Arduino is running, I never see the "connection done" from my ubuntu. The python scrupt is running but it do not detect any entry from the Arduino. At same time, and to make sure that my python sctipt listen well the port 81, from my mac a lunch my test code and the message is well sent and recieved.
In fact, I thing , I have a problem on my above pasted code, but as I am a beginner, I would like to know if you can have a check and let me know what I shloud correct.
I have a doubt with that line
cell.println("AT+CGDCONT=1,\"IP\",\"wap.cingular\"");
What is exactely "wap.cingular"? I tried to replace it with sunrise.ch, but without success
Shoud addapt i with my phone provider?
My phone provider is sunrise.ch
Do you have any advise and suggestion to successfuly connect to the remote ubuntu workstation?
Do you need more code?
In case you need, here is my setup()
void setup(){
// LED Pin are outputs. Switch the mode
pinMode(redLedPin, OUTPUT);
pinMode(blueLedPin, OUTPUT);
/* Blink the Power LED */
blinkLed(redLedPin,3,500);
//Initialize serial ports for communication.
Serial.begin(4800);
cell.begin(9600);
//Let's get started!
Serial.println("Starting SM5100B Communication...");
delay(5000);
/* Currently GPRS is not registered and AT is not ready */
GPRS_registered = 0;
GPRS_AT_ready = 0;
}
And here my loop()
void loop() {
/* If called for the first time, loop until GPRS and AT is ready */
if(firstTimeInLoop) {
firstTimeInLoop = 0;
while (GPRS_registered == 0 || GPRS_AT_ready == 0) {
readATString();
ProcessATString();
}
if(POWERPIN) {
pinMode(POWERPIN, OUTPUT);
}
pinMode(13, OUTPUT);
Serial.println("GPS Parser Initialized");
digitalWrite(POWERPIN, LOW);
delay(500);
Serial.println("Setting up PDP Context");
cell.println("AT+CGDCONT=1,\"IP\",\"wap.cingular\"");
delay(500);
Serial.println("Activating PDP Context");
cell.println("AT+CGACT=1,1");
delay(500);
Serial.println("Configuring TCP connection to TCP Server");
cell.println("AT+SDATACONF=1,\"TCP\",\"xx.xxx.xx.xxx\",81");
delay(00);
Serial.println("Starting TCP Connection\n");
cell.println("AT+SDATASTART=1,1");
onLed(redLedPin);
}else{
//onLed(blueLedPin);
//myString.print("AT+SSTRSEND=1,\"");
//myString.print("lat");
//myString.print(",");
//myString.print("long");
//myString.print(",");
//myString.print(inc);
//myString.print(",");
//myString.print("w");
//myString.print("\"");
//inc++;
// Serial.println(myString);
// cell.println(myString);
// myString.begin();
// offLed(blueLedPin);
delay(SEND_DELAY);
}
}
For now I commented the data to be send, because I testing the connection
Many thank for your help