After this I then use the following to put the device into deep sleep:
“System.sleep(SLEEP_MODE_DEEP, 1800);”
Despite its name, “bigstr” is actually only 26 characters long. Doing this I am using 0.1MB of data every 12 hours, which seems like a lot to me.
The NO_ACK is new, I tried adding that with no change in data usage. Meaning it must not be the responses/retries that are using up my data. Because I am using SLEEP_MODE_DEEP I am now suspecting it may be all the handshaking. I want to try a different mode (I actually have an excess of power so I have room to play with). However I have confused myself big time with regard to regular sleep mode.
Per documentation:
“System.sleep() can be used to dramatically improve the battery life of a Particle-powered project by temporarily deactivating the Wi-Fi module, which is by far the biggest power draw.”
But that would require a handshake upon wake-up no? But wait there is a solution: SLEEP_NETWORK_STANDBY
BUT per documentation:
"The Electron maintains the cellular connection for the duration of the sleep when SLEEP_NETWORK_STANDBY is given as the last parameter value. On wakeup, the device is able to reconnect to the cloud much quicker, at the expense of increased power "
So, now I am confused the SLEEP_NETWORK_STANDBY appears to undo the one thing the regular sleep mode does. Help please!
Also, if I do use System.sleep() and I dont want my code looping for the duration of the sleep, is there a more elegant solution than using delay, or telling it to look for a rising edge on a grounded pin for 30 min?
How about waking every 23 minutes as this is the keepAlive periode for Particle SIMs?
Any longer and you'll inevitably have to rehandshake.
SLEEP_NETWORK_STANDBY has a very low impact on the current draw of the module while sleeping but that tiny amount of current used will help you save loads on next wake.
I don't quite understand that. What's looping and where will you use a delay?
If you want to stop your code from running you'd use Stop Mode sleep (aka System.sleep(pin, trigger, timeout, SLEEP_NETWORK_STANDBY)) - what's not elegant in that?
Thanks ScruffR! I will give using deep sleep mode every 20 min a try and see how that does.
What I was trying to ask about the System.sleep() is it says it will keep running your code even after you call it, I don’t want that, which is why I went to deep sleep. But I was wondering if maybe I would be better off using regular System.sleep() followed by a delay to hold the code there until sleep is done (if I don’t want to reference an external pin).
If you mean the network sleep (System.sleep(timeout)) then you won’t really save a lot of energy regardless if your code runs or you just idle in a delay or loop.
To be honest, I don’t even see a lot of use in its existence.
I’d rather go for the Stop Mode sleep, as mentioned above and if you don’t want to donate any of your pins for that, you can use a dummy pin (which doesn’t feature interrupt capabilities, or you could try a nonexistent pin e.g. -1) or what I like to do, use the SETUP button:
I'd rather go for the Stop Mode sleep, as mentioned above and if you don't want to donate any of your pins for that, you can use a dummy pin (which doesn't feature interrupt capabilities, or you could try a nonexistent pin e.g. -1) or what I like to do, use the SETUP button: