-->
Page 1 of 1

Delay vs Sleep

PostPosted: Sun Sep 17, 2017 9:15 am
by liderbug
I'm assuming someone has already checked this out - so I'll ask rather than go through the setup/measurements.

So I see "Power your 8266 for a year on a battery with 'deepsleep'. And there are charts with posts of X uA with deep, Y uA with light etc. I can't find any numbers with "delay(###);" An external ping works during delay so the radio is running. Is anything else running. During delay nothing responds - ie http...

So, if I were to, in loop { ... delay (60000); } would it cut my battery consumption? Reason being I want to say, check a temp/humd every 5 minutes or turn on a pump every 2 hrs.
Enquiring minds...

Re: Delay vs Sleep

PostPosted: Sun Sep 17, 2017 12:36 pm
by rudy
Deep sleep is basically turning off most of the chip and only keeping RTC memory powered up. In order to wake up GPIO16 is setup to cause a reset to the module starting the code, a real reset.

Light Sleep is another option. The radio is kept alive but the CPU is put into a lower power mode. You have this option when using Station mode only. In AP mode the device must always be ready to receive data from a connection.

There are more details, and I my not have been 100% correct with the above. But to get the device to run for a year on batteries it basically has to be dead to the world for almost all that time.

Delay is not saving you any power. It is just spinning its wheels ticking away. The following are posts on the subject. Remember that it is the Internet, just because it is there doesn't mean it is true.

https://blog.creations.de/?p=149

viewtopic.php?f=28&t=14934

https://forum.mongoose-os.com/discussio ... sleep-mode

https://electronics.stackexchange.com/q ... ght-change

https://github.com/esp8266/Arduino/issues/1381