Sensor Board Power

The board takes power from a JST-XH connector, up to a maximum of 6v, which is currently provided by 3 x AA cells. I've got a number of batteries under test to see how each type works out.

Current, running, boards use an AP2112K-3.3TRG1 LDO but this has a quiescent current of 55uA. This is due to be swapped out on new board with the Holtek HT7833 which has a much lower quiescent current of 4uA.

There's another option, to go for a LiFePo4 battery which would bypass the need for the LDO completely. this requires some investigation.

Current Measurement

Measuring the current usage with my cheap multimeter highlights a problem. Burden voltage of the multimeter. Manual switching sometimes works (with some meters) but a much more useful piece of measuring equipment is the Nordic Power Profiler Kit II.

As it stands this is the current consumption when using the AP2112K-3.3TRG1 LDO

Operational Mode Current Consumption
Wake 106mA
Hibernate 79.5uA

Code Matters

One of the considerations for the ESP32 in low power modes is the state of the GPIO pins. Taking measurements from the board while it was in hibernation mode revealed a current consumption of 156uA which is excessively high. It appears I'm not the only one who has had this problem, Toby Jaffey directed me to a post on Stack Exchange Electrical Engineering.

Toby Jaffey

The post goes into detail about how SDwarfs got to their final conclusion and implementing the result suggestion there reduced the current consumption to around 79.5uA. This is a somewhat astonishing amount, and for almost zero effort. Couple that with the expected reduction of around 51uA from swapping out the LDO and we're really making some headway on this.

gpio_reset_pin(GPIO_NUM_0);
// gpio_reset_pin(GPIO_NUM_2); // Issues with NOTIFY_LED
gpio_reset_pin(GPIO_NUM_4);
gpio_reset_pin(GPIO_NUM_12);
gpio_reset_pin(GPIO_NUM_13);
gpio_reset_pin(GPIO_NUM_14);
gpio_reset_pin(GPIO_NUM_15);
gpio_reset_pin(GPIO_NUM_25);
gpio_reset_pin(GPIO_NUM_26);
gpio_reset_pin(GPIO_NUM_27);
gpio_reset_pin(GPIO_NUM_32);
gpio_reset_pin(GPIO_NUM_33);
gpio_reset_pin(GPIO_NUM_34);
gpio_reset_pin(GPIO_NUM_35);
gpio_reset_pin(GPIO_NUM_36);
gpio_reset_pin(GPIO_NUM_37);
gpio_reset_pin(GPIO_NUM_38);
gpio_reset_pin(GPIO_NUM_39);

I needed to ignore GPIO2 and not reset it because I have a notify LED attached to that.

In addition the this I'm still using DHCP and DNS for configuration and returning the IP address of the MQTT server but in all honesty these functions are perfomed on a local router that's more than capable of responding in the sub 10ms range. I'll test with fixed IP addresses but I'm not convinced this will make a difference and the trade off between configurability and speed isn't worth it for me, at least right now.

New LDO

Having swapped out the AP2112K-3.3TRG1 LDO for the Holtek HT7833 the results below are better than the expected 30uA and I suspect that I could improve on that by around 12uA if I didn't monitor the battery. I'll look at ways to enable and disable the voltage divider so that it can still be used but draws no current when disabled.

Operational Mode Current Consumption
Hibernate 23.5uA

That's a nice reduction of 55uA. I need to verify but my measurement for the wake time does appear to have dropped too.

Swapping out the LDO is straight forward and is a pin-for-pin swap. Nothing to worry about other than putting the new LDO on the board, instead of using the old one.

PPK II - Power Profiler

I picked up a Nordic Power Profiler Kit II and after a short battle getting it to work with OSX Big Sur, for which support seems to have dropped in newer software releases, I managed to get some data out.

My expectation was that the deep sleep consumption would be 23.5uA, turns out it's 23.74uA - so perhaps my dodgy multimeter fiddling wasn't so bad after all.

Deep Sleep

It's good to see that most of my projected calculations were close to the real values, aside from the awake time, I esitmated 2.5 seconds,turns out to be around 3.5 seconds.

Startup Phase

I have noticed one oddity though. After settling down going into deep sleep, the draw is 23.7uA and then after around 350ms there's a small rise over around 100ms to a peek of about 27.8uA which then immediately drops back down to 27.7uA. This needs some investigation, since it occurs after every wake to deep sleep cycle. A a wild stab in the dark, I suspect that the capacitors might be the reason but this is me learning so I could be totally wrong.

Deep Sleep

PDF SHA256

AP2112K-3.3TRG1 LDO [SHA256 ef8d376f2ec356e29172eb9e053819a0ebdcc576dba7fc9ab0505c568427920f ]
Holtek HT7833 [SHA256 9da877e5b50e6901609c34e5c6a592cbe31dd70bcbbbbd64b5b44e3b293f0e08 ]