How to manage "powerdown" during indefinite time?
-
Hello,
I would like to find a way to put a device in a "powerdown" state during an indefinite time.
In fact, I would like to have the possibility to powerdown the full board and wake up it with a pressure on an external button.
I have a FiPy with a Pytrack v2. I will connect a button on the EXTIO 1 which is also connected to RC1 pin of the PIC.From my understanding, using the pycoproc 2 go_to_sleep function with the following arguments :
gps=False, pycom_module_off=True, accelerometer_off=True, wake_interrupt=True
I should be able to powerdown everything except the PIC, and wake up with a pressure on the button which commands RC1.
But, go_to_sleep needs to initialize a timer with setup_sleep(seconds) function. This means that there is a finite time when the board will restart. Is there a possibility to remove this timer and let an indefinite time, so we go to sleep until the button is pressed ?
PS : I can see a way to simulate it : put a big value in setup_sleep and in case we reboot, check if button is pressed, otherwise return sleeping. This is not my preferred way to go, I would prefer to have something without any timer running in that case to allow very low power consumption.
-
@Louis-CONVERT Note that IIRC the difference is minimal. It's not like it's going to be 0, the PIC still draws a few µA, around 10-12 I believe. In ESP32 deep sleep mode I think it's more like 15-20, but it's definitely in the same ballpark (but you should definitely test all variations in your own specific setup).
Depending on how often you wake up and how much your draw when you wake up, as well as as any other sensors you may have drawing power while in sleep, this may make nearly no difference.
If you really want even lower power you will likely have to switch to different hardware.
-
Thanks @livius, but as noted by @jcaron, this does apply to machine.deepsleep() but not to pycoproc_2.go_to_sleep() (which is the best function for powerdown of a device).
-
@livius note that this is for machine.deepsleep (native ESP32 deep sleep) rather than the Pytrack-controlled go_to_sleep.
IIRC the latter uses a tiny bit less power than the former.
-
@Louis-CONVERT
from documentationtime_ms is the sleep time in milliseconds. If not given, it will sleep indefinitely unless power is removed, the reset button is pressed or another wakeup source is configured.
https://docs.pycom.io/firmwareapi/pycom/machine/#machinedeepsleeptime_ms