Reconnecting Electron after a paused SIM - Deep Sleep and Sleep Network Standby

Hi All,

I had a problem recently with a pause/unpause cycle on an Electron, which couldn’t be resolved without manual intervention at a very remote site. I’ve reworked my code so that it will reconnect after a paused SIM. And I thought I’d share what I found, as I didn’t find this info anywhere else.

A remote electron used more data than usual in February, and went over it’s data limit. I’m still not sure why it’s data usage was high. The SIM was paused, and shortly after I unpaused it and increased it’s data cap so that it could go about it’s business. It never did reconnect until I got out to it 10 days later and put it into Safe Mode. It took approximately 5 minutes to reconnect, which surprised me.

So I did some testing, and found that if the electron had gone to sleep using SLEEP_MODE_DEEP and SLEEP_NETWORK_STANDBY, it took between 325 and 340 seconds to wake and reconnect the first time after a SIM unpause. (It only took 1-3 seconds in this condition to connect if the SIM was already active).

If the electron was in SLEEP_MODE_DEEP, it would reconnect after the SIM unpause after about 16-18 seconds.

So I have now added a different sleep statement if my electron times out before Particle.connected that will put the electron in SLEEP_MODE_DEEP (without SLEEP_NETWORK_STANDBY), which will better tolerate reconnection after unpausing SIM card.

I have been using SLEEP_NETWORK_STANDBY and a 20 minute publish cycle to keep my cellular data use low, and my code initially waits up to 120 seconds for Particle.connect, and goes to sleep if it doesn’t connect. This is to prevent depleting the battery in case of a network outage like we had earlier this year that knocked out a number of electrons.

Since I used the same sleep statement for any time my electron would sleep, it always went to sleep with SLEEP_NETWORK_STANDBY, and therefore wouldn’t connect.

I didn’t expect that there was any mode that would take that long to reconnect, or that there would be such a drastic increase in connection time between SLEEP_MODE_DEEP with and without SLEEP_NETWORK_STANDBY.


@ParticleD, or @mstanley are you able to assist?

I don’t really need any assistance with this currently, I just wanted to put it out there that there is a long delay to reconnect after a Sim pause if you use sleep network standby. It broke my connectivity because I didn’t know there was this consequence of using that mode.

I think it would be good to have someone else confirm this and have it documented somewhere so it doesn’t catch others unaware.

Sounds like that would be a good thing to run by @rickkas7 then Rick does documentation for Particle.