DIY Raspberry Pi UPS

by Asis Gotam in Circuits > Electronics

51 Views, 0 Favorites, 0 Comments

DIY Raspberry Pi UPS

Raspberry-Pi-UPS-Board-Working.jpg

Raspberry Pi is a small or mini-computer that can be used in different types of small to large embedded, IoT, Industrial IoT applications. As this is a computer that could run different operating systems, a shutdown of this minicomputer is an important thing to ensure that everything is saved, the operating system properly ended all required tasks, and it is safe to turn the device off. Uncertain failure of power could damage the Pi as well as the operating system could also break down. We have built many Raspberry Pi Projects and most of them needed to work 24x7 so, this project can act like a Raspberry pi UPS hat and can be used to keep our raspberry pi on during power failure.

To save the Pi during uncertain power falls or unintended shutdowns, a UPS can be constructed, same as the UPS backups which are used in our home or offices. Here in this project, we will make the RPI UPS power supply that could provide sufficient time to save the code in RPi as well as this can be used as a separate power supply unit for backup also. We have built this project on PCB and have used PCBWay to fabricate the boards for this project. In the following sections of the article, we have covered in detail the complete procedure to design, order, and assemble the PCB boards for this Raspberry Pi UPS Hat from PCBWay so that you can also easily build one on your own. So let's get started.

Raspberry Pi UPS Specifications

The specifications for our compact RPI UPS backup are given below:

  • Powered by the widely popular Lithium-Ion 18650.
  • Can provide current output up to 1.5A (Continuous) and 2.5A (Peak).
  • Battery charging feature from the USB cable and could use any 5V standard mobile phone charger.
  • Overcharge, auto-cut off, and a deep discharge protection feature.
  • Easy USB Type-A output connector.
  • Compact setup that could easily fit in an enclosure box.
  • Efficiency approximately more than 85%.

Since this design is done with the mind that a Raspberry Pi could work at full load, it is important to know how much current Raspberry Pi draws.

Thus, having 1.5A of headroom is a successive way to run RPI. But, as per the datasheet, the peak current could be 2.5A. It is important to have up to 3A of sourcing capability in the PSU device retaining 1.5A of continuous current capabilities.

Components Used to Design Raspberry Pi Uninterruptible Power Supply

  1. Lithium Battery 18650 1200mAH
  2. TP4056 - Battery Charging / Protection Module (Micro USB)
  3. 10uF 10V capacitor
  4. 100k resistor
  5. 620R resistor 1%
  6. 10nF 16V capacitor
  7. 2.2uH barrel Inductor with at least 6A capability
  8. 0.1uF capacitor
  9. 16V SR360 Diode
  10. 100pF 10V capacitor
  11. 22uF 10V capacitor
  12. 2k resistor with 1% tolerance
  13. 6.1k resistor with 1% tolerance
  14. USB A connector
  15. 18650 Battery holder

Raspberry Pi UPS Circuit Diagram

Raspberry-Pi-UPS-Circuit-Diagram.png

Here in the schematic, we can observe multiple resistors and capacitors, and each playing a specific role in the proper functioning of the module. The C2(1uF) is the soft-start capacitor. It is used to compensate with Inrush current when high capacitive loads are connected across the output. Due to this capacitor, the switching driver will slowly turn on the switching element, which is inductor L1 (2.2uH). This L1 will be turned on and off, and during this, it will deliver power to the output Schottky diode SR360. SR360 is a 3A 60V Schottky rectifier diode that converts the high-frequency output from the Inductor L1 and to also prevents any reverse current to the circuit.

Resistors R3(6.1K ohm) and R4(2K ohm) are two feedback resistors that provide necessary feedback across the switching regulator. The divided voltage or the feedback voltage will be always 1.245 across the FB pin of the regulator. Thus, it will increase the voltage up to 5V and due to this 2k and 6.1k resistor, the feedback voltage will reach 1.245V. The C3 is used to smooth out the feedback line.

620R and 10nF, R1, and C1 are required for the stable operation of the converter.

C4 and C5 is the filter capacitor for input and output.

PCB Design for Raspberry Pi UPS

Raspberry-Pi-UPS-PCB.jpg
MIC2253-PCB-Internal-Construction.png
Internal-Construction-of-MIC2253.png
MIC2253-Internal-Circuit.png
PCB-FB-Trace.png
Raspberry-Pi-UPS-PCB-Design.png
PCB-Traces-Design.png

Here comes the complex part of this project. Why? Let’s have a look at that:

  • Thermal Compensation - 3A output at 5V equivalent to a 15W on trace outrage
  • Very High Frequency - 1 Mhz
  • The internal construction of the MIC2253

Let's see how this can be handled. But before proceeding, if you are not careful enough, the circuit will fail. Thus, it is my advice for you to use the PCB provided on our website circuit digest.

Improper PCB design in this chip could lead to the following problems:

  1. Unintended shutdown due to thermal protection triggering
  2. High spikes induced across the output
  3. Very high ripple due to uncertain Ground noise
  4. A high ground bounce could affect the RPI.

1. Thermal Compensation - 3A output at 5V equivalent to a 15W on trace outrage:

First of all, always make high power boards in double layers where PCB heat sinks are required.

The Ground plane used is the total dissipated area where thermal conduction from the chip will happen.

Let's calculate the surface area-

As per the design data the board is: 87mm x 38mm = 3306 sq mm.

Now the copper surface area with 100% fill will be equivalent to 3306 x 2 = 6612 sq mm.

My design shows that the total ground pour on the polygonic layer is equivalent to 69.73%. Let's assume it to be 70%.

Thus my heat sink generation on 2 dimensional view will be: 6612 x 70% = 4628 sq mm

Now, since it is copper, it has a physical thickness. There are two types of copper thickness available which are 30um and 70um. 70um is costlier. Thus, in 3D form, my copper surface will be 4628 + (4628 x 0.035) = 4789 for 35um and for 70um, it will be approximately 5000 sq mm.

It is a very poor and rough calculation since thermal conduction will not be even at all places, depending on operating and ambient temperature, atmospheric pressure, and all. But let's not dig into that part. If we roughly assume that 50% of the 5000 sq mm is doing its job, then 2500 sq mm will be our device heat sink for MIC2253, which is sufficient.

Now the traces are made thicker as per the minimum IPC standard to compensate with this:

2. Very High Frequency - 1 Mhz:

Mhz range is quite the first stage of RF design. At this stage it became difficult to isolate traces from stray capacitance and create a mini version of the RLC circuit as the traces are made of copper it has resistance and inductance, glass boards between two traces are capacitive.

Avoided FB trace to route close across the inductor or below from the inductor.

Provided ground stitching across the FB pin at the incomer in respect of the MIC2253.

3. The internal construction of the MIC2253:

The construction of the MIC2253 uses noisy and sophisticated analog circuits as well as high-power pass transistors. Now, as the current is 3.5A, during the startup, a huge load will provide a slight drop in the voltage and this leads to a problem in the sensing comparator.

See the internal construction where two separate grounds are shown but they are common ground:

The blue one is Analog Ground which is used by all-analog circuits whereas the red one is Power GND used by all load circuits and the load current Li will pass through the pass transistor. Separating these two is essential.

The red one is the power ground whereas the blue one is the analog ground, which is completely separated from the Actual ground plane. It is not even connected in the bottom side also:

The R4 and C1 are only connected via a separate top-side ground path not even in the bottom ground polygonic plane.

Fabricating Raspberry Pi UPS Using PCBWay

PCB-for-Raspberry-Pi-UPS.png
PCB-Gerber-File_0.png
PCBWay-PCB-Prototype.png
PCB-from-PCBWay.png

Now that we understand how the schematics work, we can proceed with building the PCB for our project. Click on the link to check all the PCB projects we have built previously, you can also find the NodeMCU GPS Tracker PCB design file and GERBER file in the link below.

Design and Gerber Files

Now that our Design is ready, it is time to get them fabricated using the Gerber file. Getting your PCB fabricated from PCBWay is easy; simply follow the steps given below.

Step 1: Go to https://www.pcbway.com/, sign up if this is your first time. Then, in the PCB Prototype tab, enter the dimensions of your PCB, the number of layers, and the number of PCBs you require.

Step 2: Proceed by clicking on the ‘Quote Now’ button. You will be taken to a page where to set a few additional parameters if required, like the material used track spacing, etc. but usually, the default values work fine.

Step 3: The final step is to upload the Gerber file and proceed with the payment. To make sure the process is smooth, PCBWAY verifies if your Gerber file is valid before proceeding with the payment. This way, you can be sure that your PCB is fabrication-friendly and will reach you as committed.

Assembling Our Raspberry Pi UPS Board

Raspberry-Pi-UPS-PCB-Board.jpg
Soldered-Boards.jpg

After a few days, we received our PCB from PCBWay in a neat package and as you can see below, the PCB quality was good as always. The top layer and bottom layer were seamlessly done with proper visa and track spacing.

After making sure that the tracks and footprints were correct, I proceeded with assembling the PCB. The completely soldered board looked like as shown in the image below.

Raspberry Pi UPS Board- Testing and Working

Raspberry-Pi-UPS-Board-Working.jpg
Raspberry-Pi-UPS-Board-Testing.jpg
Working-of-Raspberry-Pi-UPS.jpg

Once the board was ready, I started testing it. I powered it using a micro-USB adapter and used my multimeter to check for the output on the boost converter side.

As we can observe using the multimeter that the output boosted voltage from a 3.7V Li-ion cell is 5V, which is enough to power up our Raspberry Pi module. As we have our 5V output ready, it's now time to plug in our Rpi module.

As it can be clearly seen that the Rpi module powers up with the 5V boosted supply from the 3.7V Li-Ion cell. The Red LED can also be observed to be glowing since the cell is currently getting charged and simultaneously providing the supply to the Rpi. Once the cell is fully charged, we would observe a Blue LED, and then we are ready to remove our DC adapter to the TP4056.

For more details and construction, kindly see the video linked at the bottom of this page. Hope you have learned something new today. For more info and questions, please post on the forum section to get a reply.

Raspberry Pi UPS Demonstration Video

Raspberry Pi UPS to Save your Pi from Power Failure and keep it Running Always!