-->
Page 1 of 1

Light sleep + NTP update loop

PostPosted: Sat Apr 28, 2018 3:14 pm
by summersab
I'm fairly noob-ish with the ESP and Arduino as a whole, thought I do have a solid IT background - my skills are just more in the higher-level abstraction levels like system administration and architecture. So, that's my introduction :)

I'm trying to get the ESP to basically work like a Christmas light timer:
  1. Set a time via a web console
  2. ESP gets a NTP update
  3. ESP goes into light sleep for 1/2 the time remaining
  4. Go to 2. until the remaining time is 10 minutes
  5. Go to sleep and set GPIO1 to high on wake-up

I'm reasonably confident that I can do the things like creating a web console and performing a NTP update based on the examples provided in the Arduino IDE, but what I can't seem to figure out is how to do light sleep. Everyone seems to be WAY more interested in deep sleep, and for a lot of embedded/battery-powered projects, I totally understand that.

However, since my code isn't completely static (I want to be able to pick a wake-up time that isn't hard-coded), I can't use deep sleep since it will wipe any variables I've set. If someone could help me figure out how to do a light sleep loop that enables and disables WiFi on each iteration, that would be awesome. Also, having the ability to wake the ESP from sleep via GPIO would be great, too (use case: if I want to wake up the system to change the time I just set).

Thank you!

Re: Light sleep + NTP update loop

PostPosted: Sun May 06, 2018 1:11 pm
by summersab
Can anyone at least give me a little guidance on how to do light sleep? I haven't been able to find any good examples. I can probably take it from there.

Re: Light sleep + NTP update loop

PostPosted: Sun May 06, 2018 3:56 pm
by btidey
Check out
https://github.com/esp8266/Arduino/issu ... -279117473

I haven't tested this myself as I normally use deep Sleep