Register now for better personalized quote!

How to add a UPS to your Raspberry Pi projects (and do it on the cheap)

Apr, 26, 2023 Hi-network.com

Raspberry Pi fitted with a UPS

Adrian Kingsley-Hughes/

The Raspberry Pi  needs little introduction. This single-board computer has become an essential tool for tinkerers,tech enthusiasts,and programmers.

But what happens when the power goes out?

Also: The best portable power stations you can buy

I had a project where I needed a Raspberry Pi to run 24/7/365 with as high a level of uptime as possible. While power cuts are rare in my neck of the woods, they can happen. I needed to make my Pi resistant to such outages. I needed a UPS -- short for uninterruptible power supply -- a battery backup mechanism that kicks in when the power goes out.

Here's the UPS I opted for: a Waveshare UPS HAT (B)

RECOMMENDS

Waveshare UPS HAT (B) kit

The UPS HAT allows you to use two 18650 rechargeable batteries as a backup power supply for your Raspberry Pi. No soldering is required and you can still use the GPIO pins on the top of the Pi.

View at Amazon

Waveshare UPS HAT (B) specs

  • Compatible with Raspberry Pi 3, 3B+, and4B
  • Supports real-time monitoring of the battery voltage, current, power, and remaining capacity
  • Multi-battery protection circuits offering overcharge/discharge protection, over current protection, short circuit protection, and reverse protection
  • Onboard 5V regulator allowing for up to 5A continuous output
  • 5V USB output
  • Battery warning indicators
  • Includes development resources and manual
  • Requires 2x18650 batteries (not included) 

Also: Finding Raspberry Pi: Where to buy the latest model and its alternatives

Note: I've also used theGeeekPi UPS HAT , which offers similar functionality but uses micro USB, which charges at a slower rate than the Waveshare board at a similar price.

The Waveshare UPS HAT (B) fits onto the bottom of the Raspberry Pi. 

OK, got all the bits, so I'm ready to go.

All the bits I needed to fit a UPS

Adrian Kingsley-Hughes/

And I'm not going to be put off by the typo on the battery charger!

"Batter" charger

Adrian Kingsley-Hughes/

The HAT connects to the Raspberry Pi using pogo pins that press onto the underside of the GPIO pins.

Pogo pins connect the HAT to the Raspberry Pi

Adrian Kingsley-Hughes/

OK, here are the assembly instructions.

1. Fit the spacers

Adrian Kingsley-Hughes/

Big spacers go on the battery side, shorter ones on the side that will face the Raspberry Pi.

2. Bring the Raspberry Pi and HAT together

Adrian Kingsley-Hughes/

Four flat-headed screws attach the Raspberry Pi to the HAT.

Notice how the pogo pins fit against the underside of the GPIO pins. The advantage? Not only is no soldering required, but you can still use the GPIO pins on the top of the Pi.

It's a lot easier to tighten the screws if you have a magnetized screwdriver. I used a magnetizer/demagnetizer to make my screwdriver tip magnetic. 

Making my screwdriver bit magnetic makes fitting the screws a lot easier!

Adrian Kingsley-Hughes/

Tighten the screws holding the HAT down a little bit at a time, don't just crank down on one screw then go to another because that will misalign the pogo pins.

When done, check the alignment of the pogo pins against the GPIO pins.

Adrian Kingsley-Hughes/

3. Fit the batteries

Adrian Kingsley-Hughes/

Make sure to get the polarity right.

4. Fit the battery cover

Adrian Kingsley-Hughes/

I used the domed screws to hold the cover in place. This prevents metal bits from falling into the battery compartment and possibly shorting things out.

5. Connect the power

Adrian Kingsley-Hughes/

All that's left to do is connect the power to charge the batteries, and flip the power switch to turn on the Raspberry Pi. (Remember to fit a microSD card containing an operating system... I forgot!)

Don't want to use HAT? Here's another way

OK, while a HAT is the most convenient and reliable way to set up a UPS for a Raspberry Pi, there is another option: use a power bank.

You can use the power bank to power the Raspberry Pi, and connect the power bank to a charger to keep it topped up.

Also: These are my 3 must-have Raspberry Pi accessories

Unfortunately, you can't use just any power bank. The power bank has to support a feature called pass-through charging. This is the feature that allows the power bank to be simultaneously charged while charging a device.

Not all power banks support this, but power banks fromZendure , Goal Zero , Omni , and Renology support this feature, and offer much greater backup capacity than two 18650 rechargeable batteries can provide.

Also: The 5 best portable power banks: Keep your devices juiced on the go

Another alternative is to use a power station, from makers such asJackery orBluetti . All power stations I've tested support pass-through charging.

Featured reviews

Google Pixel 8 Pro review: This phone sold me on an AI-powered futureiPhone 15 Pro review: Coming from iPhone 12 Pro or earlier? This upgrade will wow youMeta Quest 3 review:$500 VR headset made me less excited about Vision ProGoogle Pixel Watch 2 review: In one key area, it surpasses every other smartwatchMicrosoft Surface Laptop Studio 2 review: No laptop can do what it can do, even MacBook Pro
  • Google Pixel 8 Pro review: This phone sold me on an AI-powered future
  • iPhone 15 Pro review: Coming from iPhone 12 Pro or earlier? This upgrade will wow you
  • Meta Quest 3 review:$500 VR headset made me less excited about Vision Pro
  • Google Pixel Watch 2 review: In one key area, it surpasses every other smartwatch
  • Microsoft Surface Laptop Studio 2 review: No laptop can do what it can do, even MacBook Pro

tag-icon Hot Tags : Our process Home & Office

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.