Show Posts
Pages: 1 ... 22 23 [24] 25
346  Using Arduino / Programming Questions / Re: How can we work with AT+SDATASTATUS on: January 09, 2013, 11:52:26 am
Hello Thank for your answer,
I already read that document. it help me, but in spite of this I still block, specialy to display teh result of SDATASTATUS.
It would better help if I can have an exemple in that way I can better understand that copying.

Thank
347  Using Arduino / Programming Questions / What is the impact of 4800 and 9600 on: January 08, 2013, 07:26:38 pm
Dear all,
Someone can explain me the importance of this, related the my localisation and provider?
I ma using a swiss provider and not US.
Does cell.begin(9600) can make a issue if the Euripean bamn is 1800?

Could you calrifie the imprtamce of this?

many thanks
Code:
  //Initialize serial ports for communication.
  Serial.begin(4800);
  cell.begin(9600);
348  Using Arduino / Programming Questions / How can we work with AT+SDATASTATUS on: January 08, 2013, 05:32:26 pm
Good evening,

I searched a lot on internet (sorry I ma a beginner) to know how to get a value of
Quote
AT+SDATASTATUS

My goal is to know the status of the connection in order to create a condition

if connection is good => continue
id connection is'nt => reconnect and execute AT' commands

Could you provide me an exemple of AT+SDATASTATUS with the Serial.print() of the retunr value/data?

Thank for your help
349  Using Arduino / Programming Questions / Re: Some problem to connect to my remote server on: January 08, 2013, 04:33:50 pm
I am still surpise, it work and sometime it does not work.
Sometime it works when I press the reset button of my Arduino.

I thougnt that the reset button will delete the Sketch code?

I also wanted to make sure that all command have been ran successefuly.

For that I add that function
Code:
char incoming_status;
static void status(){
     while(cell.available()){
        incoming_status=cell.read();
        Serial.print(incoming_status);
      }
}

Then I added status() after each AT commande
Code:
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);
     }
     
     Serial.println("");
     Serial.println(F("*GPS Parser Initialized*"));
     //digitalWrite(POWERPIN, LOW);
     Serial.println(F("Setting up PDP Context"));
     cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
     status();
     delay(500);
     
     Serial.println(F("Activating PDP Context"));
     cell.println("AT+CGACT=1,1");
     status();
     delay(500);
     
     Serial.println(F("Configuring TCP connection to TCP Server"));
     cell.println("AT+SDATACONF=1,\"TCP\",\"92.104.69.134\",81");
     status();
     delay(500);
     
     Serial.println(F("Starting TCP Connection\n"));
     cell.println("AT+SDATASTART=1,1");
     status();
     delay(500);
     
     Serial.println(F("Getting status"));
     cell.print("AT+SDATASTATUS=1");
     status();
   
     
     blinkLed(blueLedPin,4,200);
   
   }else{
       
     
       myString.print("AT+SSTRSEND=1,\"");
       
       //myString.print(flat,DEC);
       myString.print("lat");
       myString.print(",");
       //myString.print(flon,DEC);
       myString.print("long");
       myString.print(",");
       myString.print(inc);
       myString.print(",");
       myString.print("w");
       myString.print("\"");
       
       
       
       cell.println(myString);
       Serial.println(myString);
       
       myString.begin();
       inc++;
       blinkLed(blueLedPin,10,200);
     
      delay(SEND_DELAY);
    }

for most oif them, it return "OK". But for
Code:
cell.println("AT+SDATACONF=1,\"TCP\",\"xx.xxx.xx.xxx\",81");
it return nothing
and for
Code:
cell.println("AT+CGDCONT=1,\"IP\",\"internet\"");
It return like a \n\r.

Could you ask you a very good fundtion to corretely check each AT command?
350  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 08, 2013, 04:27:23 pm
Ok, thank for your answer
351  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 08, 2013, 04:03:11 pm
Ok it's works but I got some issue...  smiley

I would like to do the same with a variable

for exemple, when I do it
Code:
Serial.print(F("toto"));

it print toto

but when I want to print a buffer
Code:
char buffer ="data";
Serial.print(F(buffer));

When I compile it, I got a error of compilation " initializer fails to determine of '_c' "

Do you know why?
352  Using Arduino / Programming Questions / Some problem to connect to my remote server on: January 08, 2013, 07:02:36 am
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
Quote
"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
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
 
Code:
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()
Code:
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()
Code:
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
353  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 07, 2013, 11:29:14 am
I just found that code, to test the free Ram.

May be it can be useful

Code:
int freeRam ()
{
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

Take care
354  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 07, 2013, 11:23:12 am
Dear AWOL,

Thank for your answers. It helps.

There is a debug mode like Firebug does?
(May be it's not comparable....)
Sorry if my question are simple. I just start with Arduino

Yes I will use F, I understand now what does it do.

Cheers
355  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 07, 2013, 05:25:28 am
Ok, thenak for your answer.
I have a last question.
What is taken in considaration, the number of Serial.print() or the content of the Serial.print()

If I worte
Serial.print("Bla bla bla bla bla bla")

and I change to
Serial.print("bla"), does it will help?

For now the number of Serial.print() are suefull for me and I would like to avoid elimating it, but if I have I will.
(I could not test for now, but I will later)

Thnak for your support
Cheers and have a nice day
356  Using Arduino / Programming Questions / Re: Is there a limit of amount of Serial.print("")? on: January 07, 2013, 03:57:37 am
Dear AWOL
Thank for your answer.
I am going to try it.
But what do you means by RAM. Can we increase the RAM of the arduino?
Should I limit the use of Serial.print()?
It true I use it a lot, but it only for debuging.
357  Using Arduino / Programming Questions / Is there a limit of amount of Serial.print("")? on: January 07, 2013, 03:18:29 am
Dear All,

I am a beginner and I am experiencing a strange problem.
I ma using Serial.print("Debug") to debug and follow the step of the code.

For now I am testing that function.
Code:
static void sendData(const char* data) {
 
 // digitalWrite(LED_STATUS, HIGH);
  Serial.print("");
  Serial.println("    *** Starting Sending ***");

  Serial.println("    > Setting up PDP Context");
  //sendATCommand("AT+CGDCONT=1,\"IP\",\"wap.cingular\"");
   
  Serial.println("    > Configure APN");
  //sendATCommand("AT+CGPCO=0,\"\",\"\", 1");
 
  Serial.println("    > Activate PDP Context");
  //sendATCommand("AT+CGACT=1,1");
 
  // Change 0.0.0.0 to reflect the server you want to connect to
  Serial.println("    > Configuring TCP connection to server");
  //sendATCommand("AT+SDATACONF=1,\"TCP\",\"92.104.69.134\",81");


  Serial.println("    > Starting TCP Connection");
  //sendATCommand("AT+SDATASTART=1,1");
 

  Serial.println("    > Delay of 1 sec");
  delay(1000);
 
  //Serial.println("Getting status");
  //sendATCommand("AT+SDATASTATUS=1");
 
  Serial.println("    > Sending data");
  //sendATCommand(data);
 
  //Serial.println("Getting status");
  //sendATCommand("AT+SDATASTATUS=1");
 
  // IThe problem startes here
  //Serial.println("    > Colse connectrion");
  //sendATCommand("AT+SDATASTART=1,0");
 
  // Serial.println("    > Disable PDP Context");
  //sendATCommand("AT+CGACT=0,1");
 
  // Clear string and flash LED
  //myStr.begin();
  //successLED();
 
  //digitalWrite(LED_STATUS, LOW);

All uncommented Serial.print() return the text and the code continue. Excpeted when I uncomment
Code:
Serial.println("    > Colse connectrion");
Just after the comment 
Quote
// IThe problem startes here.

Is there an error message? No. When I compile and send the code to the Ardiuno, it only display the letter
Quote
P
from "Power on" of the settup loop
Code:
void setup() {
   
  pinMode(LED_STATUS, OUTPUT); //int LED_STATUS = 13;
  pinMode(LED_ERROR, OUTPUT); // int LED_ERROR = 12;
  pinMode(GPS_RELAY, OUTPUT); // int GPS_RELAY = 9;
 
  ////Initialize serial ports for communication.
  Serial.begin(4800);
  cell.begin(9600);
 
  //Let's get started!
  Serial.println("Power on");
  // Check LEDS
  blinkLed(LED_ERROR, 5, 25);
  blinkLed(LED_STATUS, 5, 25); // Pin, flashtime, delay
}

Then I am a bit suprise.
(There is other Serial.print() in the code....)

Any idea?

Thank
358  Using Arduino / Programming Questions / Re: How can use isListening() to detect signal as +SIND: 7 or +SIND:0 on: January 06, 2013, 04:22:28 am
Hello
Someone has an idea about my issue?
Cheers
359  Using Arduino / Programming Questions / Re: How can I listen a port when I received +SIND: 7 or +SIND:0 on: January 05, 2013, 02:56:34 pm
By the way, I have another question.

When GPRS_registered and GPRS_at_ready are true,
this
Code:
if (cell.available() > 0)
return false.
Why? It because, nothing is ready?
Because, at the being tresting, the network, is not lost, the GPRS connectioj is fine!!!

here is the code, for reminding.
Code:
static void readATString() {

  char buffidx = 0;
  int time = millis();
 
  //while (strstr(at_buffer, "+SIND: 4") == 0 && strstr(at_buffer, "+SIND: 10,\"SM\",1,\"FD\",1,\"LD\",1,\"MC\",1,\"RC\",1,\"ME\",1") == 0) {

  while (1) {
   
    Serial.println("=> Loop start");  // For debug

    if (cell.available() > 0) {
     
      incoming_char = cell.read();
     
      if (incoming_char == -1) {
        at_buffer[buffidx] = '\0';
        Serial.print("--------------------------1");  // For debug
        return;
      }
     
      if (incoming_char == '\n') {
        Serial.println("continue");  // For debug
        continue;
      }
     
      if ((buffidx == BUFFSIZE - 1) || incoming_char == '\r') {
        at_buffer[buffidx] = '\0';
        Serial.println("return R");  // For debug
        return;
      }
     
      at_buffer[buffidx++] = incoming_char;

    }else{
       Serial.println("cell not available (RETURN)");
      //return;
    }
    Serial.println("=> Loop end");  // For debug
    Serial.println("");   // For debug
  }
}
360  Using Arduino / Programming Questions / How can use isListening() to detect signal as +SIND: 7 or +SIND:0 on: January 05, 2013, 02:50:48 pm
Dear All,
I am happy, my project goes ahed  smiley.

Thank for reading my post. it's a bit long, because I tried to be the more understanding.

I need to listnen my port in case of my SIMD card is removed of if the network is lost.

I found the function listnen() and isListening().

Could let me know if I ma wrong or on a good way. I am a bit septic. For this I will explain how my code work

First, I have a setup.
Second I have a loop(). My loop() is like this:
Code:
void loop() {
  //That value a set back to false in other to have a check of the network
  // Check network
  establishNetwork();

   // THis for debug
  //Serial.println("Loop() Delay of 2 sec");
  //delay(SEND_DELAY);
}
I call the function etablishNetwork()
Code:
static void establishNetwork() {
  while (GPRS_registered == false || GPRS_AT_ready == false) { // (+SIND 11 || +SIND 4)
    Serial.println("");
    Serial.println("EtablishNetwork (Pause 2sec)");
   delay(2000);
    readATString();
    ProcessATString();
  }
   // This is for debug
  Serial.print("********************************************");
}
When +SIND: 11 and +SIND:4 are received GRPS_registered and GPRS_AT_ready are turn to true, then the loop stop
That function call two other.

First, etablishNetwork() loops readATString() once and return +SIND:1, as GRPS_registered and GPRS_AT_ready are stile false, etablishNetwork() loop it again and return +SIND:3, and it continue looping until it get +SIND:11, and turn GPRS_registered true, again it continue until it get +SIND:4 and turn GRPS_AT_ready to true. Those values are turn to true in ProcessATString(). I will show the code later.
Code:
static void readATString() {

  char buffidx = 0;
  int time = millis();
  
  //while (strstr(at_buffer, "+SIND: 4") == 0 && strstr(at_buffer, "+SIND: 10,\"SM\",1,\"FD\",1,\"LD\",1,\"MC\",1,\"RC\",1,\"ME\",1") == 0) {

  while (1) {
    
    Serial.println("=> Loop start");  // For debug

    if (cell.available() > 0) {
      
      incoming_char = cell.read();
      
      if (incoming_char == -1) {
        at_buffer[buffidx] = '\0';
        Serial.print("--------------------------1");  // For debug
        return;
      }
      
      if (incoming_char == '\n') {
        Serial.println("continue");  // For debug
        continue;
      }
      
      if ((buffidx == BUFFSIZE - 1) || incoming_char == '\r') {
        at_buffer[buffidx] = '\0';
        Serial.println("return R");  // For debug
        return;
      }
      
      at_buffer[buffidx++] = incoming_char;

    }else{
       Serial.println("cell not available (RETURN)");
      //return;
    }
    Serial.println("=> Loop end");  // For debug
    Serial.println("");   // For debug
  }
}

When at_buffer get +SIND: 1 , ProcessATString() come in action and display the message for.
Same, when at_buffer get +SIND:4, ProcessATStrine come in action, display a message and turne GPRS_ready to true.

It seams to work well.
From that point, the loop() is looping...
Code:
void loop() {
  //That value a set back to false in other to have a check of the network
  // Check network
  establishNetwork();

   // THis for debug
  //Serial.println("Loop() Delay of 2 sec");
  //delay(SEND_DELAY);
}
... and at each time, etablishNetwrok() is calling, but nothing happen because GPRS_at_ready and GPRS_regostered are true.
Then if I remove the SIM card or, I do not know, if I lost the network, or something else, the function readATString() will never be called, because GPRS_at_ready and GPRS_registered are true.

My question, now  smiley.
I would like to listened this  SoftwareSerial cell(GPRS_TX, GPRS_RX); //int GPRS_TX = 2; int GPRS_RX = 3; or the ports, in case of incoming_char = cell.read(); return +SIND: 0, or +SIND: 7, or something else.

As I wrote, I found .listnen() and .isListing(). I saw that exemple
Code:
portOne.listen();

  if (portOne.isListening()) {
   Serial.println("Port One is listening!");
}else{
   Serial.println("Port One is not listening!");
}

  if (portTwo.isListening()) {
   Serial.println("Port Two is listening!");
}else{
   Serial.println("Port Two is not listening!");
}

but I am a bit confused. In my case, I suppose, I should adapt it like this
Code:
  cell.listen();
  if (cell.isListening()) {
   Serial.println("Port One is listening!");
}else{
   Serial.println("Port One is not listening!");
}

But now, if I am in the right way, how should I red cell, in order to cacht the code +SIND:0, +SIND:7 etc ????
The code should be catch from listnen() or from isListning()??

Thank for ready my long post. I hope I was clear and thank for your help and advise.

Cheers
Pages: 1 ... 22 23 [24] 25