An uninterruptible power supply is a welcome part of your projects to help protect hardware from power surges!

A UPS (uninterruptible power supply) is a type of power supply system that contains a battery or any power storage device to maintain power and provide power to electronics in the event of a power surge.

In this tutorial, we will build a UPS for a Raspberry Pi 4 and is also compatible with older Pi boards.

Why Would You Need a UPS for Raspberry Pi?

In some specific projects or uses, it is important to provide a Raspberry Pi with continuous power in the event of a power surge — in a situation like if something is being written on an SD card and there is a power outage, the image will probably become corrupt and thus unusable. A similar occurrence can happen as you are writing code on your computer and there is a power outage. However, if a UPS is present, you can lend yourself a few precious minutes to save the file.

The UPS ensures that in event of power interruption, a battery or any other power source will intervene without any effect on our board. A UPS consists of the following basic components usually:

  1. Battery charging circuit
  2. A battery
  3. Power regulators (if needed)

The UPS Circuits

The recommended input voltage for Pi boards is 5V. Knowing this, we first need a battery charging circuit for batteries. Here, we can use a bunch of AA rechargeable batteries, let's say eight, to make a 9.6V battery pack.

The charging circuit is simply built around two 1N504 diodes. One of the diodes, D2, prevents overcharging of the battery and D1 prevents the battery from discharging in a 12V power source.

Next, we will use a DC-DC buck converter to supply 5V up to 3A output — perfect for Raspberry Pi boards. This is as simple as it can get and can help you with your projects adequately.

UPS circuit diagram

The UPS circuit diagram.

Utilizing a Supercapacitor Instead of Batteries

If you have a 6V or 5V power supply and don't want to use 8 batteries in your circuit, you should go with a supercapacitor instead of a battery.

A supercapacitor has a capacitance higher than other capacitors. They have a higher power density than batteries and can also be charged and discharged more than batteries. That makes supercapacitors suitable for storing and releasing a large amount of power. Supercapacitors also work at relatively low voltage (2-3 V) like batteries.

supercapacitor UPS circuit diagram

UPS circuit diagram using a supercapacitor.

We will again take the help of 1N504 diodes for charging the capacitor, one for preventing super-capacitor to overcharge and another one for prevention from supercapacitor to discharge at the power supply. This will help our supercapacitor to discharge at load whenever there is a power surge. Now if your input power supply is more than 5V or 6V, you should use a 7805 voltage regulator IC for getting stable 5V output.

testing raspberry pi ups

Testing my Raspberry Pi's UPS!

Darshil Patel
I am 19 year old innovator from India currently studying electronics. Am very passionate about electronics since very young age and love to tinker.

Categories