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.

I tried to summarize some points from your letter by slightly rephrasing the picks occurring essential to me. Thanks for making these details clear again.

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 in general, 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.

On the other hand, we might have missed to make it more clear that this piece of hardware is actually a handy reference implementation when aiming to reasonably max things out on the power domain aspect and might support others when shopping for the relevant details to build their own devices. That’s the main reason I am trying to follow up on that by referencing it from time to time in discussions where appropriate.

While we probably will have to accept the fact that not everyone will 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 by not stopping charging below zero at all.

Saying that, we should recognize this piece of hardware is something not everyone will implement for their data loggers in every detail. 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. [1] [2]

So, thanks again for bringing this up. [3] [4]


  1. While this might sound funny (how hard can it be?), we might think about adding software support for the HX711 coming out of Improving the canonical Arduino HX711 library for ESP8266, ESP32 and beyond to autonome-zelle · GitLab just for fun. ↩︎

  2. … and maybe also because the LiPo-heating might have made some of the readers believe this device was overengineered – YMMV. ↩︎

  3. After receiving respective feedback, we would like to emphasize all of this is not exactly rocket science but just resembles the application of well-established common knowledge by assembling approved components into a whole system. Nothing to see here, move along ;]. ↩︎

  4. On the other hand, we believe the appliance has been designed and built wisely and qualifies as a little gem of its own kind we are happy to have here for reference and we are sure will inspire others. We also believe conversations about the very details like these will help to steadily improve its documentation. ↩︎

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.