-->
Page 1 of 1

Run loop for WS2812b while sleeping Wi-Fi, and how

PostPosted: Thu Jan 16, 2020 10:14 pm
by gary_g
I'm very very new, I have a nodeMDU ESP8266 running a 60 LED WS2812b ring as a clock.

Can someone help me with the following....

Unit flashed and powered on, WiFimanager runs and starts AP. Configure AP unit resets, after 60 seconds it connects to an NTP server and sets the time on the ring.

CURRENTLY NTP connects every 60 seconds to poll. (This part I can control no problem)

Led colors are set

Void Loop for clock runs


Now the issue....

I want to do all this and disable the Wi-Fi and NTP then after 20 hours WITHOUT restarting the unit, I want to power on Wi-Fi, connect to configured AP in station mode and poll an updated NTP datapack, then return to sleep for another 20 hours.


My understanding is that DEEPSLEEP will not run the void loop section (which actively controls the clock led's)


I'm trying to run a clock and the ESP8266 & nodeMDU and with a maximum of 15 led's on at a time from a 7.4v 2S LIPO battery for as long as I can.

If I run it from an outlet outs not an issue, but this proof of concept of the project needs to be by battery.


Thanks for any help

Re: Run loop for WS2812b while sleeping Wi-Fi, and how

PostPosted: Thu Feb 13, 2020 11:18 pm
by StanJ
If you have to keep your loop running, then the only option is Modem Sleep. The current for the module drops by about 50mA when it goes into Modem Sleep, and the CPU is running at ~18mA substrate current.

Looks like you're using the Arduino IDE, so the following will put it to sleep:
Code: Select allWiFi.forceSleepBegin(0xFFFFFFF);  // the modem sleeps until you wake it
delay(10);


and to wake the modem again,
Code: Select all WiFi.forceSleepWake();  // reconnect with previous STA mode and connection settings


I haven't tried that in AP mode, only STA mode.

Re: Run loop for WS2812b while sleeping Wi-Fi, and how

PostPosted: Fri Feb 14, 2020 12:58 am
by JurajA
modem sleep is automatic in STA mode. you don't have to force it.