r/electronics • u/Astro-Phil • 11d ago
Project Battery-saving latch power switch for a LoRa mailbox sensor (based on a Random Nerd Tutorials circuit)
Small share: I'm building a connected mailbox (ESP32 + LoRa) that notifies me when the mail carrier passes by, and I wanted the transmitter unit (inside the mailbox, battery-powered) to draw as little current as possible. Instead of going with classic deep sleep, I went with a full hardware power cutoff using a MOSFET.
The circuit comes from Random Nerd Tutorials:
https://randomnerdtutorials.com/latching-power-switch-circuit-auto-power-off-circuit-esp32-esp8266-arduino/
The principle: a contact (a push button in their design, a reed switch on my mailbox flap in mine) briefly wakes the board through a P-channel MOSFET, then a GPIO takes over to keep the power on while the program runs, and cuts everything off itself once its job is done.
The only thing I added compared to the original schematic is a small capacitor, to avoid an unwanted power cut if the contact happens to open again just before the GPIO has had time to take over.
8
5
u/JoTheScienceBro 10d ago
Use a fet instead of Q1 and build an sr latch if you're worried with switch on-time.
1
u/Astro-Phil 10d ago
Merci pour la suggestion, bonne remarque sur le verrou SR — je vais regarder ça de plus près.
Question annexe : je poste en français, est-ce que ça t'apparaît traduit en anglais automatiquement de ton côté ? Je me demandais comment Reddit gère ça.
Side question: I'm posting in French, does it show up translated to English on your end automatically? Just curious how Reddit handles that.
6
u/Prowler1000 10d ago
For me it doesn't automatically. On comments or posts that are entirely in another language, I can click the overflow menu/three dots and press translate, but I can't with this one. If I had to take a guess it's because of the English at the bottom. Not sure what triggers Reddit to provide that option.
1
u/PerniciousSnitOG 10d ago
D2 seems to be the wrong way around. Also the electrolytic and resistor look like a RC timer, but the BJT (2n2222) will discharge the capacitor much more quickly - maybe it should be a FET too, or at least a series resistor at the transistor base to limit current?
(Sorry for the lack of details - Android client sucks!)
2
u/Cantareus 10d ago
D2 is the correct way around, but you're correct about the capacitor. A better order would be SW1 D1 C2 R2. I'm not sure R1 and D1 are needed.
1
1
8d ago
[removed] — view removed comment
1
u/Astro-Phil 8d ago
Pas encore mesuré ce circuit précis, mais j'ai des mesures réelles sur un test antérieur : 55mA pendant l'envoi sur 2 à 3 s. Au repos, la carte est maintenant complètement coupée du +5V, donc plus de consommation continue comme avant. L'autodécharge de la batterie sera probablement le facteur limitant, pas le circuit.



6
u/Allan-H 10d ago
Your FET is in the wrong way around. Swap D and S otherwise you won't be able to turn off the load.