Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: GPRS SMS messages not sending after "OK" response
PostPosted: Fri Mar 16, 2012 4:00 pm 

Joined: Fri Mar 16, 2012 3:55 pm
Posts: 10
Hello , I am currently working on a project which involved the HiLo Sagem GPRS quadband module from libellum http://www.libelium.com/squidbee/index.php?title=New_GPRS_module_for_Arduino_%28Hilo_-_Sagem%29 and http://www.cooking-hacks.com/index.php/shop/arduino/arduino-gprs-module.html

I am currently trying to the get device to work in standalone mode to send a text (based off the tutorial given by libellum). I have solved the power issues with the module by adding a 220uf capacitor and I soldered the HiLo sagem chip to the shield now with the device in standalone mode I receive "OK" responses from the board however despite receiving "OK" after sending an SMS the message is never received, I have tried sending it to multiple different numbers and in different places (I thought signal strength might be the problem) however I am at a loss to understand why the texts aren't being received on the other end.

Here's the code I'm working off and it's outputs:

Code:
int led = 13;
int onModulePin = 2;        // the pin to switch on the module (without press on button)

int timesToSend = 1;        // Numbers of SMS to send
int count = 0;


//==========================DEBUG===================
 char debug[500]="";
 char debugTwo[500]="";
 int hh=0;
   byte in = 0;
   int i;
   int test = 0;
//=========================================

void switchModule(){
  digitalWrite(onModulePin,HIGH);
  delay(2000);
  digitalWrite(onModulePin,LOW);
}

void reset()
{
  switchModule();                    // swith the module ON

  for (int i=0;i<12;i++){
    delay(5000);
  } //Wait 1 min to register with network
}

void setup(){

  Serial.begin(9600);                // the GPRS baud rate
  delay(2000);
  pinMode(led, OUTPUT);
  pinMode(onModulePin, OUTPUT);
  reset(); //Turn module on
 

 
}

void loop(){

   while(test<1)//While carrier information is not recieved
   {
    Serial.println("AT+COPS?"); //Ask for carrier info
    delay(5000);   //Wait 5 seconds
    for(i=0;i<25;i++)  //Read the carrier info
    { 
      in=Serial.read();
      debug[i] = in;
     
      Serial.print(debug[i]);
      if(debug[i]=='+') //If you receive a '+' carrier info is returned e.g. +COPS: 0,0,"Vodafone IE"
      {
        test++;
        break;
      }
    }
    Serial.println();
    reset(); //Otherwise if no carrier information is returned reset the module
   }
 
 
  while (count < timesToSend){
    Serial.println("AT+CREG?"); //Verify netowrk status e.g +CREG: 0,1
    delay(1000);
    Serial.println("AT+CMGF=1");         // set the SMS mode to text
    delay(1000);
    Serial.println("AT+CSCS=\"IRA\"");
    delay(1500);
    Serial.print("AT+CMGS=\"**********\""); // send the SMS number
    //(change ********* by the actual number)
    delay(1500);
    Serial.print("Hello");     // the SMS body
    delay(500);
    Serial.write(char(26));             // end of message command 1A (hex)
    Serial.println();
    delay(60000);//Wait for 1 min to ensure text has sent

    count++;
  }

  if (count == timesToSend){
    Serial.println("AT*PSCPOF");             // switch the module off
    count++;
    while(Serial.available()>0) //Collect all debug info and print it out
    {
      in = Serial.read();
      debug[hh] = in;
      Serial.print(debug[hh]);
      hh++;
    }
  }
}


What this returns (when I have appropriate signal) is;


Quote:
+COPS: 0,0,"Vodafone IE" --Asking for carrier info
+CREG: 0,1 --Asking for network status

OK --Setting SMS mode to text AT+CMGF=1
OK --Set SMS mode AT+CSCS="IRA"
OK --Finished Writing text and sending (received from 0x1a at end of message)



Then the device turns off with the AT*PSCPOF command

I am very curious as to why this does not work as if it was a carrier issue I would have received some error message from the carrier, has anyone encountered this problem before or could anyone shed some light on anything I might be doing wrong ?


---Update--

The Ok responses appear not to be from the sending SMS part of the code anyway, I do not think the code manages to execute the send SMS part due to some error which I cannot see. Can anyone please help me with this problem.


Top
 Profile  
 
 Post subject: Re: GPRS SMS messages not sending after "OK" response
PostPosted: Mon Mar 19, 2012 8:47 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2027
Hello scrineym,

Let's see if is a module or code problem. Test your code in gateway mode as shown in this tutorial (only using AT command) to verify that the module sends the messages and the instructions are correct.

http://www.cooking-hacks.com/index.php/ ... s-quadband

In this tutorial you can see an example of sending messages.

http://www.cooking-hacks.com/index.php/ ... gator_pack

I'll be waiting for your answers.

Regards.


Top
 Profile  
 
 Post subject: Re: GPRS SMS messages not sending after "OK" response
PostPosted: Mon Mar 19, 2012 2:00 pm 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2027
Hello.

I have seen a possible fault in our tutorial on the AT command function AT+CMGS.

Try with this code (i change Serial.print("AT+CMGS=\"**********\""); // send the SMS number)


Code:
Code:
int led = 13;
int onModulePin = 2;        // the pin to switch on the module (without press on button)

int timesToSend = 1;        // Numbers of SMS to send
int count = 0;


//==========================DEBUG===================
char debug[500]="";
char debugTwo[500]="";
int hh=0;
   byte in = 0;
   int i;
   int test = 0;
//=========================================

void switchModule(){
  digitalWrite(onModulePin,HIGH);
  delay(2000);
  digitalWrite(onModulePin,LOW);
}

void reset()
{
  switchModule();                    // swith the module ON

  for (int i=0;i<12;i++){
    delay(5000);
  } //Wait 1 min to register with network
}

void setup(){

  Serial.begin(9600);                // the GPRS baud rate
  delay(2000);
  pinMode(led, OUTPUT);
  pinMode(onModulePin, OUTPUT);
  reset(); //Turn module on
 

 
}

void loop(){

   while(test<1)//While carrier information is not recieved
   {
    Serial.println("AT+COPS?"); //Ask for carrier info
    delay(5000);   //Wait 5 seconds
    for(i=0;i<25;i++)  //Read the carrier info
    {
      in=Serial.read();
      debug[i] = in;
     
      Serial.print(debug[i]);
      if(debug[i]=='+') //If you receive a '+' carrier info is returned e.g. +COPS: 0,0,"Vodafone IE"
      {
        test++;
        break;
      }
    }
    Serial.println();
    reset(); //Otherwise if no carrier information is returned reset the module
   }
 
 
  while (count < timesToSend){
    Serial.println("AT+CREG?"); //Verify netowrk status e.g +CREG: 0,1
    delay(1000);
    Serial.println("AT+CMGF=1");         // set the SMS mode to text
    delay(1000);
    Serial.println("AT+CSCS=\"IRA\"");
    delay(1500);
    Serial.println("AT+CMGS=\"**********\""); // send the SMS number
    //(change ********* by the actual number)
    delay(1500);
    Serial.print("Hello");     // the SMS body
    delay(500);
    Serial.write(char(26));             // end of message command 1A (hex)
    Serial.println();
    delay(60000);//Wait for 1 min to ensure text has sent

    count++;
  }

  if (count == timesToSend){
    Serial.println("AT*PSCPOF");             // switch the module off
    count++;
    while(Serial.available()>0) //Collect all debug info and print it out
    {
      in = Serial.read();
      debug[hh] = in;
      Serial.print(debug[hh]);
      hh++;
    }
  }
}


Top
 Profile  
 
 Post subject: Re: GPRS SMS messages not sending after "OK" response
PostPosted: Thu Mar 22, 2012 1:39 am 

Joined: Fri Mar 16, 2012 3:55 pm
Posts: 10
Thanks for the reply, the commands all seem to be working and changing Serial.print() to Serial.println() did not change the problem, however I did figure out a solution, for some reason having enough signal strength to retrieve the carrier name and the signal status does not mean I have enough signal strength to send an SMS message. When I tested the device outdoors (purely by chance) the message sent with the code I posted above all along. I have repeated this a few times now and every time the message sends and whenever I am indoors I am only able to retrieve carrier name and the signal strength. This however is not too big a problem for my project as it will be used outdoors anyway.

Once again thank you for your reply.


Top
 Profile  
 
 Post subject: Re: GPRS SMS messages not sending after "OK" response
PostPosted: Thu Mar 22, 2012 9:10 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2027
Serial.println() function must always be used with AT commands, because this commands need CF and LF (line end).

Using another function would not worK.

Thanks for your contribution.

Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use