FONA 3G and FONA_SMS_response example

Adafruit cellular platform - SMS and IoT over celluar

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
PeterAi
 
Posts: 16
Joined: Wed Nov 25, 2015 5:26 am

FONA 3G and FONA_SMS_response example

Post by PeterAi »

Good Day !

I'm using a FONA 3G to send and receive SMS using AT Commands and the example sketches provided. Everything works fine, except the example "FONA_SMS_response". This sketch works fine on a FONA 808 but I can't get it to work on the FONA 3G.

Initialization of the board works, but then the sketch never gets a notification from FONA, that a new SMS arrived (line 101 of the sketch). Adding a short test request to show the numers of SMS available works ok, so FONA receives an SMS.
At the beginning ot the sketch I also uncommented the line // Adafruit_FONA fona = Adafruit_FONA(FONA_RST); and added Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST); instead, like required to the other example sketches.

Has somebody already experience with this example sketch and got it to work ?

Any hint would be greatly appreciated !
Peter

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

I'll give it a try with a FONA 3G.

User avatar
PeterAi
 
Posts: 16
Joined: Wed Nov 25, 2015 5:26 am

Re: FONA 3G and FONA_SMS_response example

Post by PeterAi »

Rick, did you already have some time to give it a try ?

Brgds
Peter

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

Sorry - my Fona 3G is acting up. I haven't been able to get it to receive a text. It sends them just fine. Still working on it...

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

Don't know what's wrong with my FONA.

But try this - I suspect it will tell us what the problem is

Around line 100, right before the sscanf, add a println to report the string it got from the fona. I'm thinking that it's sending something other than "+CMTI:SM"

Code: Select all

    Serial.print("fonaInBuffer: "); Serial.println(fonaInBuffer);
    
    //Scan the notification string for an SMS received notification.
    //  If it's an SMS message, we'll get the slot number in 'slot'
    if (1 == sscanf(fonaInBuffer, "+CMTI: \"SM\",%d", &slot)) {
      Serial.print("slot: "); Serial.println(slot);
      

User avatar
PeterAi
 
Posts: 16
Joined: Wed Nov 25, 2015 5:26 am

Re: FONA 3G and FONA_SMS_response example

Post by PeterAi »

Added the serial.print line today, but do not get any additional messages printed out.

Then I did some more tests with some interesting results (everything is documented in attached textfile).

The main finding is, that the code "fona.available" becomes true, if the FONA 3G receives a voice call, but remains false, if an SMS is received !

Brgds
Peter
Attachments
2016-01-15 Test results.txt
Test made with Adafruit FONA 3G and skecth FONA_SMS_response
(2.74 KiB) Downloaded 211 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

OK. I have verified this. I don't know what's going on. I'll see what I can find out.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: FONA 3G and FONA_SMS_response example

Post by adafruit2 »

i didnt write that example but it was probably written pre-FONA 3G. the 3G is significantly different and probably has a totally different way of notifying you (interrupt-wise) when an SMS arrives

until we can untangle that, we suggest polling/querying the # of SMS's with getNumSMS or whatever I called it, and when that numbers goes up, you have a new SMS :)

User avatar
npamidi
 
Posts: 16
Joined: Thu Dec 03, 2015 6:34 am

Re: FONA 3G and FONA_SMS_response example

Post by npamidi »

I've the same problem while receiving a SMS. It's not notifying me at all. I had to do AT+CMGL="ALL" to list all messages that I've got and had to check for new messages.

User avatar
blodtann
 
Posts: 28
Joined: Wed Oct 07, 2015 4:50 pm

Re: FONA 3G and FONA_SMS_response example

Post by blodtann »

I just use AT+CMGL="ALL". They way I use the module and how I treat the serial buffers there might a chance I flush the buffers for any message which alerted me about a new SMS.

You might want to check AT+CNMI at page 169 in the manual and see if that helps you out.

User avatar
pegarris
 
Posts: 7
Joined: Wed Jun 07, 2017 11:52 pm

Re: FONA 3G and FONA_SMS_response example

Post by pegarris »

Hi all, Really need your help on this interrupt issue. I have a FONA 3G with Breakout board and I know its been over a year since this last post, but this issue still does not have a fix.

The issue is that when using the FONA_SMS_Response sketch with the 3G construct, it does not react if a SMS comes in because the interrupt that is suppose to indicate a new SMS comes in never fires and does not trigger the "fona.available" flag.

It is true that when calling the FONA 3G it will trigger this interrupt but not if a SMS comes in as documented. I see some talk of looping and testing the register noting how many SMS are stored and then take action but that preoccupies the processor all the time versus the interrupt driven strategy.

Anyone have a fix to the libraries or something that gets the FONA 3G to trigger the condition when a SMS comes in? REALLY appreciate any help on this!!!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

This thread wasn't about interrupts, and FONA_SMS_Response doesn't use interrupts.

However, are you calling the function fona.setSMSInterrupt(1); in setup()?

User avatar
pegarris
 
Posts: 7
Joined: Wed Jun 07, 2017 11:52 pm

Re: FONA 3G and FONA_SMS_response example

Post by pegarris »

Hi and thanks for a quick response. My apologies on my assumption of the FONA using interrupts with the FONA_SMS_Response sketch. I am away from my device and workspace with the code but will add this as a FYI.

I am using the stock FONA_SMS_Response sketch with the minor change in the Adafruit_FONA.h to include the 3G constructs. I have not added anything involving fona.setSMSInterrupt(1). i got that interrupt impression from the response from Adafruit2 when he said :
"the 3G is significantly different and probably has a totally different way of notifying you (interrupt-wise) when an SMS arrives until we can untangle that, we suggest polling/querying the # of SMS's"...

I guess i was hoping a update to FONA_SMS_Response to fix the problem explained above by PeterAI user as :"The main finding is, that the code "fona.available" becomes true, if the FONA 3G receives a voice call, but remains false, if an SMS is received !".

FYI- The overall project is to communicate/control/monitor a tree grove drip irrigation system using LoRa to communicate from a monitoring UNO to a FONA 3g equipped UNO on the top of the hill for better connectivity to AT&T. This irrigation system is 4 hours, one way to get to and im trying to get status and control so I dont have to drive up there as often as i did last year since i am recovering from being treated for Lymphoma earlier this year. I am in remission but need to reduce the long 8 hour drives roundtrip.

Hoping to get a update on the sketch to properly handle the fona.available flag to respond to both the incoming phone calls plus the incoming SMS. Otherwise i will have to program a polling strategy looking for changes in the number of SMS stored.

If you have a update that would be fantastic, otherwise i would appreciate your opinion of what would be the most efficient way to handle the SMS traffic and a planned LoRa communications purpose for this arduino cpu. Any code segments to help would be great as well.

THANKS for your time in advance! I am very impressed with your previous answers with other users in the forums!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: FONA 3G and FONA_SMS_response example

Post by adafruit_support_rick »

Actually, the comments in the FONA_SMS_Response example state this:

Code: Select all

For use with FONA 800 & 808, not 3G
I really don't know why it doesn't work. But it doesn't...

User avatar
pegarris
 
Posts: 7
Joined: Wed Jun 07, 2017 11:52 pm

Re: FONA 3G and FONA_SMS_response example

Post by pegarris »

THanks Rick for your response. I guessed that if i added the 3G construct in the Adafruit_FONA.h file it would work but apparently not. thanks. Ill write a polling segment to take care of it i guess.

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

Return to “FONA”