Decrease battery consumption without deepsleep
I am building a battery-enabled relay application where I need to set the 'P9' and 'P8' pins of the LoPy high/low on demand (no fixed time frames) through Wifi or Bluetooth. Everything is working fine, but the power consumption is pretty high since the LoPy is constantly turned on with full capability. I tried to figure out if machine.deepsleep() would be an option, but as far as I understand it's only possible to wake the LoPy from deepsleep with an external trigger or after a fixed time period.
So my question is if there is any way to set the LoPy into a very energy efficient state until I trigger it through Wifi/Bluetooth on demand and tell it to set the Pins high and low and then go back to sleep (similar to a garage door opener)? I am also open for hardware solutions.
Thanks in advance!
Thanks for your reply.
1.) I would say everything below 5 seconds is acceptable.
2. / 3.) This question is hard to answer, since I will try the device with different types of applications so the capacity of the batteries will strongly vary. The battery life should be as long as possible.
I also found the machine.idle and machine.sleep in http://docs.micropython.org/en/latest/wipy/library/machine.html. Given the description machine.sleep should work if I trigger the LoPy through Wifi. Is that correct?
Thanks in advance.
@jfs A few questions that might help get better answers:
- How fast would you need the pins to change state (i.e. max delay between the trigger and the actual change)?
- what kind of battery you will have
- what kind of battery life you are looking for