Best practice for monitoring phone signal

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
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Best practice for monitoring phone signal

Post by mugginsjm »

Hi I need some help please. In my code I check the phone signal every 10 seconds using fona.getNetworkStatus();
For some reason it regularly fails and in my code if there is no reconnect after 3 minutes I reboot the device.
It does not seem to recover and reconnect without this restart.
Can anyone offer advice.... thanks
John

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Hmmm, not sure why you're checking the network every 10 seconds, I just check when I first turn on the board, but maybe your application requires a regular check.

Anyways, if "fona.getNetworkStatus()", which if you dig in the code is the AT command "AT+CREG?", is often failing maybe consider a higher gain antenna. I'm in a semi-rural area, and my FONA3G with the Adafruit antenna (#1991) was "iffy" at first. After getting a higher gain antenna (8dB) I had no more problems.

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

Hi
Thanks for that. My phone signal is fairly strong. I need the connection to be solid over a long period of time and hence regular checking. My logs show signal failure from time to time and these do not seem to reconnect unless I do a complete reboot via software.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Ok, don't know if you've tinkered with sending AT commands directly, or use the FONAtests "Serial passthru" option to do it, but what do you get if you send the AT command "AT+COPS?"

It's the Operator Selection command (page 78 in the 5320 AT command manual), controls how the chip hooks up to the network.

If the reply starts with a "0", you're in automatic mode, if it starts with a "1" the chip is in manual mode. Hopefully you're in automatic mode.

Probably a longshot I know, but back in the day when there were several 3G networks I use to play around with putting my FONA3G in manual mode and then try to see what networks I could (or couldn't) connect to using that COPS command and the manual.

User avatar
Tkall
 
Posts: 96
Joined: Wed Aug 19, 2015 10:11 pm

Re: Best practice for monitoring phone signal

Post by Tkall »

Checking the network every 10 seconds (8650 times per day) will not leave time for anything else. Beyond that time, effort and money spent on FONA is wasted time. The networks are shutting/shut down and apparently Adafruit has abandoned cellular communication.

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

OK AT+COPS? show automatic mode.
I can probably reduce the frequency of the network checks but am still wondering why when there has been a loss of signal as shown by AT+CREG? that modem does not recover on its own without a necessary reboot.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Ok, well, I did think it was a longshot you were in manual mode. I'll poke around the manual some more, your restart issue is an odd one, never had that problem.

But Tkall has an interesting point, not sure how many AT commands the modem can buffer before responding, maybe that 10 second frequency locks up the chip after awhile.

Am curious, what was the full reply for AT+COPS?

And who is your sim provider?

Both of those will help determine what mode your chip is trying to communicate in.

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

+COPS: 0,0,"1p 1p",3
I'm in Ireland and provider is called 1P (1 penny per minute, 1 penny per sms)
On a more general point if you have a system running that is say... monitoring something important, is it not reasonable to introduce some sort of monitoring of the signal itself. I appreciate that checking every 10 seconds is a bit overkill. In my case it reboots and brings back to life the signal if it has failed for longer than 3 minutes.
If I did not have this check then it does not recover on its own. Is there a better way?

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Oh, Ireland, well, I won't have sim suggestions since I'm in the US!

Looks like the "3" is GSM w/EGPRS, and EGPRS is another name for EDGE, interesting.

Is GSM/EGPRS/EDGE readily supported in Ireland? Or is it maybe on its way out and the network doesn't like you trying to hook up to it and knocks you off after awhile?? In which case, a different sim may help. Just a thought, don't know the cellular situation in Ireland.

Also, What about entering "AT+CSQ"

Curious what/if this shows anything different than "read RSSI", just in case FONAtest has its own interpretation of the result.

Refering to your "general point", yes, sounds reasonable to check your signal...it's just that I've never had the issue you are having, once I got the better antenna, never had any more problems so never dawned on me to regularly check the signal. I only check once after turning on the board, then that's it.

I was hoping maybe the "manual mode" was the issue, but that wasn't it. The manual is pretty big, so gonna dig some more.

Also wondering, the data you are monitoring or sending, are you doing it through sms or tcpip or ???

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Sorry, me again.

On your third post, when you say "loss of signal as shown by AT+CREG?", what are you seeing other than "0,1" ?

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

I get
18:17:33.849 -> ---> AT+CREG?
18:17:33.849 -> <--- +CREG: 0,2
18:17:33.896 -> ---> AT+CSQ
18:17:33.896 -> <--- +CSQ: 99,99
On reflection some of the problems may have been caused by my coding and of late it all seems pretty solid.
I'm sending sms warnings in the event of over temperature but have been experimenting with some success with sending BANNED messages via gprs. I still believe that the Fona library is incapable of recovering from a signal loss like say removing the aerial.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Hmmm, this is getting more interesting!

0,2 means "not registered, but ME is currently searching a new operator to register to".

So, it's trying to re-connect, good!

But the "99" is not good, basically means no antenna at all. Are you sure the antenna is ok and etc....?? Could the pin be bent or missing in the center of the connector?? Do you have another antenna to try?

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

Hi
thank you for your advice.
I am an enthusiatic amateur programmer and this project runs to 3000 lines of code. The box has a display showing various details including state of phone connection and signal strength hence the AT+CSQ requests.
Also I'm sending this to a relation in Germany with a different phone system. Anyway I now believe that with all the checking incoming SMS, connecting to wifi,connecting to MQTT, checking temperatures,sending SMS , interrupts, etc etc
I have had clashes which confused the processor. One possible theory was lack of power whilst sending SMS and possibly locking out the restoration of the signal. Unfortunately I have deleted all my old debug logs showing the errors. Anyway I now seem to have a stable system that runs smoothly and have reduced the calls to CREG?
thanks again

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Best practice for monitoring phone signal

Post by rskup »

Cool, glad it's working! Also sounds like an interesting project. I did a little searching about the cellular setup in Ireland, looks like 2G and 3G are both still active over there, nice! 3G is totally gone here and 2G (EDGE) will be gone next year, so learning and tinkering with 4G boards here in the US.

User avatar
mugginsjm
 
Posts: 8
Joined: Mon May 15, 2023 4:08 am

Re: Best practice for monitoring phone signal

Post by mugginsjm »

As a matter of interest before you go, have you had any success with the fona GPS example. Won't work for me. The TinyGSM example does work.
thanks again.

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

Return to “FONA”