by coder543 · 1y ago · 0 comments
> Another area that stumped me is how to shut the power off 100% on the device, so that it can remain “off” for weeks or months.
This is actually a pretty solvable problem...
https://circuitcellar.com/resources/quickbits/soft-latching-...
Then the microcontroller can choose at any time to completely shut off the entire circuit (including itself), and extremely little power will be consumed until something (like a button) completes the power-on circuit again.
For ease of prototyping, there are off-the-shelf units you can play with: https://www.sparkfun.com/sparkfun-soft-power-switch-jst-2mm....
Some more advanced soft power switch circuits (like the SparkFun switch) also include the ability to forcibly power down a misbehaving device by holding down the button.
The design used in the SparkFun switch also allows your microcontroller to know if the button is pushed while the device is running, so you could imagine repurposing your existing button to also restore power to the device if the device is off, and still retain the existing functionality for cycling through watch faces. Then, either the device could automatically shut itself off after a period of inactivity or when the battery gets too low, or the user could click and hold the button for some number of seconds to turn the device off completely that way.
On the topic of extending battery life mentioned in the article, one relatively straightforward thing to investigate is simply reducing the processor clock speed. Your application probably doesn’t need to run at full tilt. I think there is a function called setCpuFrequencyMhz — I think it only works with a few specific frequencies, but the lower the frequency you can pick (while still keeping up with your application’s needs), the less power the system should consume while awake.
Of course, you want to be putting the processor to sleep between updates anyways, and there is a trade off between sleeping more (which means running the processor faster so it can sleep sooner, “race to sleep”), versus the inefficiency caused by running a processor higher on the frequency/efficiency curve, so there might be an optimal frequency that isn’t the lowest or the highest possible option. It’s something that would need to be measured.
Just some thoughts! It might not make a big difference if the processor is already sleeping most of the time, but I figured I would mention it as something to try.
https://docs.espressif.com/projects/esp-idf/en/stable/esp32c...
It uses little power, so standard 18650 battery could last years with single charge.
https://www.programmingelectronics.com/esp32-deep-sleep-mode
What I ended up doing was using a second voltage regulator with an enable pin for all the accessories. When the MCU wakes up it turns power on to the accessories and waits for things to stabilize, maybe 1ms or so. Then it does what it needs to do and before going back to sleep turns all the accessories back off.
Costs you a few extra parts and a second voltage bus and the hassle of programming but it turns "small quiescent draw" into essentially zero. Maybe the regulator has a bit of leak but it should be pico amps or less.