Minimize battery drain by cutting off the appliance from main power source using a MOSFET


This topic is about how to use a MOSFET and a RTC like the DS3231 to shut down the sensor domain of your appliance completely in order to improve energy saving in standby mode.


We’ve had this topic different times already. @clemens started this coming from our context at Strom schalten, Transistor, Fet oder was anderes? 3,7V - 2A (peak!) - Lipo the other day and some of the discussions eventually spilled over to Low Cost GSM/GPRS-(SIM800)-Node and SIM800 Stromverbrauch (per Software) reduzieren.

Later, @TK5EP chimed in at Rahmen mit 4 Wägezellen (pro Ecke eine) as well as Anyone using a HX712 ADC? and also @wilhe_jo had similar plans which he outlined at Willing to publish some OSHW... anyone interested? about using a DS3231 for wake-up, RTC and house-keeping.


Sleep well

Der Hahn kräht

… todo:: Aufwachen gleichermaßen kurz beschreiben ;]. Danke! Vermutlich à la:

The DS3231 contains two programmable time-of-day/date alarms.
The INT/SQW provides an interrupt signal due to alarm conditions.

Die RTC weckt ihrerseits nach der eingestellten Alarmzeit die MCU per Interrupt auf / macht irgendwie anders die Stromquelle wieder an und die MCU fährt ganz normal los / wie genau?

Reference implementation “Autonome Zelle”

@wtf, @weef and @roh recently conceived a reference implementation on behalf of their Versuchsaufbau "Autonome Zelle": Solar-Feinstaub-Wetter-Vergleichsding we would like to report about in this context again.

It is a

ESP8266-based self-monitored solar-powered air quality sensor and environmental monitoring station with different temperature/humidity sensors nearby the air quality sensor and in the weather hut. The source code is available from autonome-zelle · GitLab.




Air Quality monitoring using WiPy/LoPy

Dominik Kapusta is doing air quality monitoring with an ESP32-based battery-powered WiPy/LoPy and shuts down the PMS5003 and SHT10 sensors with a IRLR2905 n-MOSFET. The software part of that is implemented with Pycom MicroPython, so it is generally interesting for us when unlocking the Pycom FiPy these days.

Enjoy reading.

Dominik is also doing other things you might enjoy to reading about, see Track-ing weather on a velodrome – Dominik Kapusta.

hm. i do not quite get why he makes this so hard. he is already using a ncp1402 step up converter, and then using low side switching on the output side.
this means the whole step-up keeps running in standby?!

also low side switching nearly always is a good way to invite leakage via io lines and weird behavior.

the only explanation i can see is that he did use a ‘3-pin linear regularor replacement module’ which does not give access to the enable pin. but even this would not help, since this kind of step-up can only alternate between ‘nearly input voltage’ and ‘step up running’. there is no ‘off’.

also he not like to use an additional p-channel fet it seems.

this is why we used a ‘usb hub power switch’ like the ncp380 or tps2552 as integrated high side switch. only one chip. simple to use. and we get short circuit protection/charging big caps capability as well.
killing leakages as well. when there is no positive voltage, nothing can leak to ground via interconnects. (assuming one was thinking which rail to use for which pullup/down where needed)

did we really miss to document the switching circuit we used for Autonome Zelle #2 ?

its from the tps2552 datasheet first page. typical application (disregard the USB, this is only one possible usage as this IC monitors fault conditions suitable for USB power supplies):

2 caps, 2 resistors. 100k, 24k we used the low active version, so its easy to use the interrupt line from an i2c rtc to wake up the whole thing. 24k means it should do ~1Amp current limit.
works from ~2.5V-6.5V

@weef should have some photos of the test-modules we built using some sot23-6-dip6 breakout pcb and some wire.


(shown an NC380 which is … you can replace each other ;)
and: no, the upper right cap and adjacent resistor do not touch)

1 Like

Dear @roh,

thanks for writing in and welcome back again.

Thanks for making this information clear again. I tried to summarize some points from your letter by slightly rephrasing the picks occurring essential to me. You know who you are.

With kind regards,

Thanks for your answer to this specific topic and for sharing your insights again. As this forum is pretty noisy sometimes, I believe everyone might be struggling with distilling essential information from it. However, we won’t give up trying to improve things on this end – that’s the very reason we try to regularly refactor and recompress different content floating around here.

So, nothing has been missed, everything is here but sometimes might be hidden in plain sight. So, thank you very much for chiming back in and making things more clear about this very topic.

With kind regards,

The only thing we might have missed altogether may was not making it absolutely f… collectively clear that this piece of hardware is actually a reference implementation when aiming to reasonably max things out on the power domain aspect. That’s the main reason I am trying to follow up on that by referencing it more often than not.

While we can’t expect anyone to apply heating to their LiPos in order to be able to squeeze charges yielded from solar panels on sunny winter days into the power storage, we are likewise not responsible for anyone risking damages when not holding on to the specifications – wink ;].

Saying that, we should recognize this piece of hardware is something not everyone will implement for their data loggers 1:1. On the other hand, it is the best thing which could have happened to us to be able to make references to it and by maybe picking parts of all the details solved there for own implementations.

I might imagine that this piece has not been able to catch enough attention of the Technoimker community yet because even Autonome Zelle #2 still does not have a weigh-scale sensor attached. While this might sound fishy, it is like it is. Another explanation would be that just everyone around is still blinded by the light – even months after the supernova.

In order to make things more clear, these kinds of conversations about these very details might help in the long run while it sometimes means reiterating things more often than not.

So, thanks again and keep up the spirit.


Hi there!

The DS3231 is the only/best option you have… I’m currently testing a STM32F030 which is emulating a I2C RTC.
The IC then controls the step-down converter (I use a 4S Lipo configuration), measures Vbat, controls the status LED and implements low-voltage cutout.

Currently I’m wating for my joule-scope to get better data on the current consumption…

The board below is the “HAT” for a Rpi.

The board itself looks like this…

Btw: On the right you see the usb-hx711+1Wire Interface I use. It uses a H-bridge to imitate ac-excitation of the bridge. This removes all thermoelectric voltages.