Small power latch module
I have made multiple battery powered devices in the past. And these always come with the same “hard to solve” problem of idle power draw. You would want no power draw at all while idle, but if you don’t want a switch that disconnects the battery this is more difficult than you might imagine. My electronics always use a microcontroller somewhere. The easy fix is to simply put it into whatever deep-sleep mode it has and call it a day. However they can often still waste a ton of power while in deep sleep through pull-up/down resistors and other connected sensors which might not even support sleep modes. In this article I used an NRF24L01 module, which for me, still used a ton of power while supposedly in sleep modes.
The solution to this problem is a so called “power latch” which, when triggered very shortly, stays enabled until triggered separately to power down again. A circuit like this can be created using a few mosfets:
This circuit uses two mosfets, the “2N7002K” N-Channel enhancement mode and the “MMFTP84” P-Channel enhancement mode. When the button BTN_PWR is pressed down, it connects the gate (pin 1) for the MMFTP84 to ground, which allows the energy from the battery to reach the AMS1117 regulator. If there were no other components, the power would be lost again when the button is released. But this is where the other 2N7002K mosfet comes into play, since it can also act as if the button is pressed down, but then controlled by a microcontroller. The electronics behind the AMS1117 regulator should set the PWR_RESET line to HIGH directly after being powered, which allows the button to be released without the power being lost. Then when the electronic circuit behind the power-latch is done, it may set the PWR_RESET to LOW, and the battery is then disconnected again.
I used Kicad to draw the circuit and the matching pcb, which can be seen as a render below:
As you can see its very tiny, which is perfect. Now whenever I am working on a battery powered circuit, I don’t have to think about limiting idle power draw again, as I will just connect one of these modules between the battery and microcontroller.
The full circuit and design will be published on my git, sometime in the near future.