@RWB, @RobotChicken, I’ve just skimmed over the last few posts, so I might have missed, that this was already answered:
The reason for the modem staying on during deep sleep is the data consumption caused by the need to renegotiate and reconnect to the cell towers after the connection got lost.
Sucking up several KB of your precious quota.
So if you wake relatively often from deep sleep, you will go through your quota in no time, but if you know that you only do it rarely, you can deliberately switch off the radio.
I'm not that deep involved into the interna of the Electon firmware but I think the docs are less likely up to date as @BDub is
So I just tried to reword what he said in the post you referenced (in parts).
While the quote above confused me a bit (first paragraph seems to advise agains DeepSleep, while the second seems to say it'll be fine to use withoutCellular.off()), I just took the essence to answer this question:
So to answer this
You can't have the modem off and save the extra KB cost - you have to find the compromise between power consumption and data usage and choose the best fitting sleep mode, with or without Cellular.off() in view of your desired wake frequency (wake often -> keep cellular on to save data usage at the cost of battery life, sleep long -> cellular off to save power at the cost of data usage).
Yea it’s confusing but what I’m understanding is that with Bdubs new code that will be included in the next firmware release you will be able to turn everything off in system. Sleep() ; and still be able to wake without having to reinitalize with the cellular tower which will save us from that KB of data being used.
Currently that is exactly right, but unfortunate for me because I've got a solar configuration that requires maximum power efficiency. To solve that problem, I have to spend more data, which I'm very limited by. So its a bit of a 'catch 22'.
I do recall Bdub mentioning an upcoming firmware update that will allow a 1 - 8 hours lease if you will with the tower, but I'm not 100% sure that works if you call Cellular.off(). I hope it does, because I've been able to improve efficiency quite a bit by shutting down both the CPU and the cell chip.
22-23. Feb (Sun). Everything was on, no sleep mode, but it was really sunny so the battery recovered.
24. Feb (Rain). I used System.sleep(SLEEP_MODE_DEEP) and got dramatic improvements to power consumption.
25. Feb (Overcast). I used System.sleep(SLEEP_MODE_DEEP) and Cellular.off() to shut down both CPU and cellular. This gave significantly more improvements by additionally slowing discharge, and allowing me to charge more during the day than previous days (in part due to slightly more overall sunshine, but also because the CPU and cell chip weren’t drawing as much power).
It seems that the CPU is the major power hog. So the best thing to do is put it to sleep when you can. It still seems necessary to also shut down the cellular chip if you plan to be on this small of a solar panel, granted this is winter in North America. I do have a 6000mah Lipo I could use, so that would probably give me a much larger buffer for rainy days.
So we’re talking about STOP mode, not SLEEP_MODE_DEEP. I wonder if I can do the same thing using SLEEP_MODE_DEEP and then not get the data penalty for reconnecting, although I doubt it since no data is retained/accessible. Something tells me that is probably too deep of a sleep.
He’s saying around 4ma in that mode. Considering an Arduino runs at about 70ma with no networking, that’s impressive. But my SLEEP_MODE_DEEP and Cellular.off() is supposed to be around 0.14 - 0.16ma (when asleep) and the battery still hasn’t recovered.
To me is looks like System.Sleep() & Deep Sleep leave the cellular modem on.
System.Sleep() stops the processor without turning it off, the processor does not need to reset when the time is up or a pin is triggered and this avoids the KB’s of data being used up on reconnection after waking up.
Then Deep Sleep powers down the processor + keeps the modem on which causes the micro controller to reset when it wakes up and reconnect to the cellular network which eats up precious KB every time. So powering down the processor will cause it to reconnect to the cellular network every time its started up fresh.
Is that right?
Seems like the only power savings between the 2 sleep modes is the difference in power used when the processor is Stopped vs OFF. I wonder how big of a difference that is. I have not tested.
Deep sleep is one of the System.sleep() modes, for example System.sleep(SLEEP_MODE_DEEP) vs System.sleep(pin, trigger). One is a deeper sleep than the other, I think. SLEEP_MODE_DEEP shuts the CPU down and no variables are saved in memory but the cell chip stays on and resumes the connection upon wakeup to both the network and the Particle Cloud. I validated this by watching the LED’s. After Deep Sleep, I was able to publish upon wakeup and the LED did NOT blink green like it was trying to reconnect to the tower. When I added Cellular.off() before going to sleep, the LED’s did blink green for about 20 seconds to reconnect before publishing.
“Since 0.4.5. The state of Wi-Fi and Cloud connections is restored when the system wakes up from sleep.
So if the device was connected to the cloud before sleeping, then the cloud connection
is automatically resumed on waking up”
Interestingly, even though I called Cellular.off() the device automatically reconnected to the tower and cloud without me having to call those functions in my program.
I haven’t tried the other mode though, so I don’t really know how it works. The deep sleep does save a lot of power.
Also, I think @BDub has left us to make things up and misinform his users.
Yea so System Sleep puts the processor in Stop mode and Deep Sleep turns the micro OFF. I wonder what the difference is in power consumption between the 2 states because that looks to be the only power your saving between the 2 different modes that both keep the cellular module ON.
Bdub states that the System.sleep mode will consume approx 4mA while sleeping with the cellular module ON.
How much lower power consumption do you get with the micro in Stop mode and the cellular module ON?
I don’t have time to test it right now but I will if nobody else does now that we have the Electron in hand
Not sure what deep sleep with the cell on vs off is. That would be interesting to know. The data sheet may be able to tell us what the cell chip draws.
So if Deep Sleep turns the micro OFF then that 0.14 has to be going to the Cellular module to keep it connected to the cell tower? And maybe that power goes up when the cell module has to transmit?
That's also not quite so. If you use the retained feature you can have up to 4KB of variables retained across restarts after standby (or reset).
This is also part of the current draw when in deep sleep (not only the radio module).
Stop mode is not the same as completely off.
BTW, if any of you has got a Beta Electron, the radio might not stay powered in sleep modes or across resets, since there was a slight hardware change to make this possible too.