wake up from deep sleep
-
Hi everyone,
I want to wake up lopy4 in continuous interval of time for e.g. (wake on every 10 mins interval and check and then goes to deep sleep) and when waked up check the state and if condition meets it sends the data and if not then it goes to deep sleep again.
I checked but there is not exactly defined any example to wake up from deep sleep. Kindly help me ?
One more is I used internal RTC to wake from deep sleep for a specific time? if yes then give me some example.
-
@Gaurav-Rajput machine.deepsleep(sleep_time_ms) is what you can use.
-
@robert-hh if I write deepsleep() it means goes to sleep for infinity time and the scenario is like normally lopy4 is in deepsleep mode continuously and wake up only at the set of defined time and sends the data. i need to do like that.
-
@Gaurav-Rajput As far as I know, that's not available in the Pycom firmware. Just a deepsleep for a given time. So you have to calculate the sleep time based on the actual time and the intended wake-up time.
You can use time.gmtime() and time.mktime() for that. What I do not know is, whether the sleep time given in deepsleep() spans a full day (86400000).
-
@robert-hh yes sir, like rtc timer wakes up with ESP32
-
@Gaurav-Rajput So you want the device to wake up at a certain time of the day?
-
@jcaron deep sleep working fine with lopy4 but i want to wake up from deep sleep like rtc works in esp32 .
-
I want to wake from sleep for 10 mins and then again it goes to sleep for long time.
Is there any wake up methods for lopy4 other than Pins
-
@robert-hh you forgot to quote the code so it went askew…
-
@Gaurav-Rajput You can use
machine.deepsleep(10*60*1000)
for a 10 minute sleep. After that time, the board will do a full restart. So the statement after the call to deepsleep will not be executed. You have to check machine.wake_reason() to tell, whether this was caused by wake after sleeping.