I have some firmware running, that I want to minimize power usage.
The code is monitoring a sensor, and then sending a notification when the sensor is activated. The core is powered by a battery, and I’m trying to maximize battery life. Right now I have 4 hours, I’d like to get it to 12 hours. That was the life when I first finished the firmware, without trying to conserve power.
My idea currently is to make the main loop basically not calculate anything, and an interrupt is used for the sensor pin. I have some calculations that go on also, but they only need to go on every 15 seconds or so.
I’d like to figure out how to tell the core to do the calculation every 15 seconds, instead of constantly checking the millis in the main loop to see if the 15 seconds has elapsed. Is there an easy way to do this? Should I put a “delay(15000)” in the main loop and call the calculations after? Will interrupts interrupt a delay?
Any suggestions about how to maximize lifespan, minimize power use?
PS, I have not experimented with putting the core to sleep, either, can I sleep the core and have it wake on interrupt?