Power saving during active cycle
In my battery powered device I have a CO2 sensor connected via UART. The sensor streams readings each 500ms and is filtering measurements internally. It is necessary to wait for it to perform several measurements to get reasonably accurate measurement. In my case it is 5 measurements which take approx. 2.5s. During this time a lot of energy is wasted by CPUs doing nothing useful. 128uWh are consumed during this time period out of 205uWh of complete active cycle. I would like to save some of this energy. Basically it would be suficient to keep peripherals running (UART with buffer) and put CPUs into sleep. Is this possible to achieve with current state of esp-idf and Pycom MicroPython port?
@daniel Would the LoRa chip on a LoPy stay active during light sleep? If so, the same kind of trick could help save quite a bit of energy when sending a packet: the time until RX2 usually does not need the CPU to be doing anything, so one could easily save 2 seconds of CPU awake time.
When using the slowest data rates, the CPU could also be sleeping during the TX phase itself, I suppose.
Even if light sleep is not possible, what about
machine.idle? I understand it’s not currently working as intended, but if there’s a way to fix that it could probably help as well.
Making light-sleep mode available from MicroPython API would definitely help. Is it feasible to implement it with current state of esp-idf?
Another useful feature might be if machine.freq() could set (lower) CPU frequency.
@danielm looking again at how lightsleep works, what can be done is to receive a reading from the sensor, the setup a timer of like 450ms for the lightsleep wake-up, enter light sleep, when it wakes up wait for the next reading and repeat the process again until you can go to deepsleep. Unfortunately there's not a way to put the CPU's to sleep and just keep the UARTs running, but I think that what I propose can already help save most of the energy that you are wasting at the moment. Views?
@danielm there's definitely something that we can do to improve that. We are looking into using the ESP32 lightsleep modes for that.
@danielm just out of curiosity, which tool did you use to get those measurements?