DIY: Raspberry Pi UPS/Automatic safe power ON/OFF

Finally, everything is in the box;)

The goal was to set up the power supply for the Raspberry Pi, supported by the battery,
with automatic power up and safe shutdown depending on the status of the AC power/battery charge state.

As a battery I used a general purpose lead-acid battery (Fiamm,12V, 1.2Ah).

fiamm

The AC / DC rectifier is MEANWELL 15V (25W).


The battery charging module is LM2596 with CC & CV control from ebay / Aliexpress.

The Battery Status Module is a "12V Battery Low Voltage Cut off Automatic Switch On Recovery Protection Module" from ebay / Aliexpress.

12v_bat_stat

For power up and safe shutdown I used my own product.
Originally, this module is controled by key switch (car,boat) as trigger for for power up and safe shutdown Raspberry Pi.
This module have 4xprogammed time (timeON,timeBOOT,timeOFF,timeSHUTDOWN).

Flow diagram:

In this case this module is controlled by Battery Status Module.

Connection schematic:

Modifications to the charging module:

  • replace multi-turn potentiometers with fixed values

Modification of the Battery Status Module:

  • replace multi-turn potentiometers with fixed values
  • add electrolytic capacitor to the lower and upper threshold(for smoothing, ie delay) due to transient at the arrival of the mains supply or load.

Everything is fitted in the box; dimensions 240x190x75.

There is also a 1.8-inch SSD with a USB adapter.

3 Likes

Nice project :slight_smile:
But, if it was my project, I'd posted it on a blog and just linked to it as its not NodeRED specific

2 Likes

Great that we get first peek then !

1 Like

Thanks, it is not Node-RED, but Node-RED is on the Pi :grin:

4 Likes

Cool. Bookmarked for future reference.

@scargill: Pete, something you might be interested in?

I'm reading right now...

1 Like

Only info after a few months of work ...

I was most interested in how the charging module behaves (LM2596 with CC & CV settings).

There was no surprise, the voltage is stable (the float voltage is 13.65V, and after some time the current goes down to 0, so there is no over charging or heating).

The other modules also work properly.

I did a multiple simulation of mains power failure, raspberry continued to work without any interruption.

Also, testing low battery voltage, it is OK, correct shutdown.

Power up (boot) after the presence of a main power suppy (and exceeding the desired battery level) is also OK.

1 Like

Interesting however maybe you can save some time by monitoring the DC input voltage directly with a INA219 module for instance (I2C)(1€ cost on Aliexpress).

This can be even monitored from nodered if you wanted see: https://flows.nodered.org/node/node-red-contrib-easybotics-ina219-sensor

What allow you to send a shutdown cmd when voltage drops to a certain amount.

Another easy option is to put a 220VAC relay suplied from main line too, when main supply gets down close a NC contact that return you a signal from the raspi GPIO, you can configure this directly to trigger the shutdown on nodered very easily too.

Note: with a 1.2Ah battery your raspi will stay alive aprox for 1 hour if has no monitor connected, and from other side normally no damage will be done by a suddent power off if is not happening often.

Regards

Moved to Share Your Projects:

Small smart home (sonoff/xiaomi)

4 Likes

@markost nice project!
It would however be better in it's own forum thread under the category 'Share your projects' as it's off-topic in this thread, which is about Raspberry pi UPS, and not home automation. @dceejay

Thanks for your suggestion,
I have not used INA219 so far, it is very interesting indeed.

Option with a 220VAC relay is not an option, because Pi does not go into shutdown due to the 220VAC failure.

Shudown is triggered when the battery voltage falls to a certain value.
Also boot starts when the voltage on the battery reaches a certain value (not immediately upon arrival 220VAC).

Regards!

1 Like