FONA - SMS problem

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

FONA - SMS problem

Post by billf »

I can't seem to send an SMS message from my FONA to my cell phone.

I am running the Adafruit library-supplied sketch called Arduino/libraries/Adafruit_FONA/examples/FONAtest/FONAtest.ino

Most things seem to work (e.g., i shows me that I have enough signal strength, n shows me that the status=1 and it is registered, C finds my SIM card, c lets me call my cell phone or home phone, T plays audio tones, f plays the FM radio, etc.) but when I do s, put in my cell phone number and then type in a simple message (e.g., xx), it goes off and tries to send it, but it responds in the Serial window with "Failed".

I have been using debug statements in the Adafruit_FONA.cpp file and it fails at this "if" statement: if (strstr(replybuffer, "+CMGS") == 0) { return false; }

See my 'modified' .cpp code below:

Code: Select all

boolean Adafruit_FONA::sendSMS(char *smsaddr, char *smsmsg) {
  if (! sendCheckReply("AT+CMGF=1", "OK")) return -1;
  
  char sendcmd[30] = "AT+CMGS=\"";
  strncpy(sendcmd+9, smsaddr, 30-9-2);  // 9 bytes beginning, 2 bytes for close quote + null
  sendcmd[strlen(sendcmd)] = '\"';
  
  if (! sendCheckReply(sendcmd, "> ")) return false;
#ifdef ADAFRUIT_FONA_DEBUG
  Serial.print("> "); Serial.println(smsmsg);
#endif
  mySerial->println(smsmsg);
  mySerial->println();
  mySerial->write(0x1A);
#ifdef ADAFRUIT_FONA_DEBUG
  Serial.println("^Z");
#endif

  Serial.println("it gets to the SMS part that reads +CMGS reply"); // I added this

  readline(10000); // read the +CMGS reply, wait up to 10 seconds!!!
  //Serial.print("* "); Serial.println(replybuffer);
  if (strstr(replybuffer, "+CMGS") == 0) {
    Serial.println("fails at 1");  // I added this
    return false;
  }
  readline(1000); // read OK
  //Serial.print("* "); Serial.println(replybuffer);
  
  if (strcmp(replybuffer, "OK") != 0) {
    Serial.println("fails at 2");  // I added this
    return false;
  }

  Serial.println("it gets to the SMS part that should be true");  // I added this

  return true;
}



Here is what I get in the Serial window:

Code: Select all

FONA> i
RSSI = 8: -98 dBm
FONA> i
RSSI = 8: -98 dBm
FONA> i
RSSI = 8: -98 dBm
FONA> n
Network status 1: Registered (home)
FONA> s
Send to #1845-------                                    (note: I did not want my phone number here)
Type out one-line message (140 char): xx
it gets to the SMS part that reads +CMGS reply
fails at 1
Failed
FONA> 
I know the FONA code is still being developed, but is there anything I can do to get my SMS messages working?

BTW, I cannot send an SMS message from my cell phone to the FONA either. The FONA was able to get SMS messages the first day that I got the SIM card, but now it is not working. I got about 5 SMS messages from T-Mobile.

I'm using an Arduino Uno R2 if that matters.

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA - SMS problem

Post by billf »

Additional information: I spent about 30 minutes on the phone (my land-line) with T-Mobile technical support and they can not see any problems on their end or anything that might be blocking text messages. They are able to send me a text message, so it is possible for my FONA and SIM card to receive and store text messages. She said that the fact that she can send me a text message is not THAT significant to debugging this - I guess that text messages directly from T-Mobile are managed in a slightly different way than user-to-user text messages.

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA - SMS problem

Post by billf »

Additional information: I tried sending a short e-mail from my laptop computer to my FONA by sending the e-mail to [email protected] and this worked!

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA - SMS problem

Post by billf »

More information:

In the
boolean Adafruit_FONA::sendSMS(char *smsaddr, char *smsmsg)
function of the Adafruit_FONA.cpp library file, when it does the
readline(10000);
part to get a response from the SIM800L, if I do this: Serial.println(replybuffer); I get ERROR. So I don't think it is ever getting the reply from the SIM800L. (That is just IMO). So when it does the
if (strstr(replybuffer, "+CMGS") == 0)
, it fails.

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA - SMS problem

Post by billf »

I downloaded the latest library files and tried it again and it works! I can now send SMS to and from the FONA. So you can ignore this problem.

User avatar
IrfaanGP
 
Posts: 3
Joined: Sun Jan 17, 2016 10:19 am

Re: FONA - SMS problem

Post by IrfaanGP »

Why does the font send sms twice? It goes half way through a loop then seems to go through the loop again? As if the fona.available rings twice?? Added a command fonasms.delete and that seems to solve the problem, any idea why??!?

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”