M5Paper deepsleep with UIFlow ?
-
Hello
I'd like to create a small app for my M5Paper using UIFlow, that will wake up once per hour at day time to fetch new values (via HTTP or MQTT), update the display then go back to sleep in between updates.
How to achieve this using UIFlow ?
Thanks !
-
Hello @littlbee
below code connects to WiFi, sends a HTTP request and then shuts down for 10 seconds. After 10 seconds the process repeats itself.
Note: for the code example to work the code need to be downloaded into M5Paper. If you only execute the code from within UIFlow it will be lost after the restart.
Note: for the code example to work M5Paper needs to run from battery. If USB is plugged in M5Paper doesn't really turn off and hence the RTC cannot restart it.
Thanks
Felix -
@felmue thanks Felix. I have no issue with UIFlow to do htttp requests or subscribe to mqtt topics to retrieve whatever data, my question is how can I set the m5paper in some deep sleep mode in between data updates and screen refreshes. In your code sample, you don't do anything specific, if not mistaken, to handle deep sleeps and wake ups. I believe with your code sample, the m5paper is going to just remain powered and connected to the wifi hence draining battery fast.
-
Hello @littlbee
the last statement
Restart after seconds 10
actually turns everything off except for the RTC. After 10 seconds the RTC powers on the system which restarts the code from the top. While in shutdown mode I measure about 3.5 micro ampere at the battery.Thanks
Felix -
Felix, thanks a lot. Sorry I missed this "Restart after seconds" block and its purpose.
Seems to be working fine indeed, my M5Paper app restarts for now every 30 minutes, running since yesterday afternoon and barely any battery consumption yet. Perfect. -
Hello @littlbee
no worries. I am glad to hear you got it working to your liking. And thank you for reporting back.
Thanks
Felix