Hey gang, Tim here at Core Electronics and today we're creating a UPS system for a Raspberry Pi. Now, I'm not talking about the delivery service. Today I'm talking about an uninterruptible power supply for a Raspberry Pi single board computer.
Any power fluctuation can be harmful to a Raspberry Pi computer and a power outage will shut down your Raspberry Pi instantaneously. This means it will not be shutting down safely which results in information being written to the SD card becoming lost and increasing the potential for all the information on your SD card to become corrupt.
To alleviate stress and to avoid putting your trust in electrical providers, get your hands on an uninterruptible power supply HAT like this Pi Juice right here. A HAT just means hardware attached on top. A UPS ensures that if power interruption occurs with the main supply, an interruption just meaning a blackout effectively, a battery or another power source will jump in and take over the role of the main supply. Then the mains are repaired, the UPS will be recharged and the system will then be ready for the next calamity.
On top you're going to notice a large rechargeable lithium-ion battery which will power your Raspberry Pi system for four to six hours. There's a battery management system chips underneath which means it will always supply power to the system even when recharging the battery or it is disconnected from the mains. There's also voltage and current monitors on this board and there is even a real-time clock which gives you the ability to automatically turn on and off the system at preset times.
So not only will the Raspberry Pi continue to be powered in the event of a power outage, but it will also have additional features like battery management, voltage and current monitoring, and the ability to schedule automatic power on and off times. This UPS HAT is a great addition to your Raspberry Pi setup to ensure uninterrupted power and protect your data.In the event of a blackout, you will have more than enough time to save whatever files you are working on, finish what you are doing, and shut it down safely. Pi Juice will help protect hardware from power surges and is a perfect tool to increase portability for your projects too.
Now, if you're not around when the blackout occurs, there are internal settings that you can alter. So, when the voltage dips too low, it will automatically save the files properly and safely shut down the system via internal software.
For the system I'm going to create here, I'm going to be using a Raspberry Pi 4 model B. But it's worth noting that Pi Juice works with any Raspberry Pi with 40 GPIO pins. So, don't feel limited as it connects together in very similar ways with all of the Raspberry Pis.
To mimic my setup here, you will need a Raspberry Pi 4 model B, Pi Juice HAT with the included screws, an SD card with the Raspberry Pi OS flashed to it, a micro HDMI to HDMI cord, a monitor to display, and a power supply either USB-C or micro USB.
Quick note, Pi Juice has a micro USB to allow power to the system. If you use this power port, you will need to press the power button to turn on the Raspberry Pi as it will not power up immediately as it would normally using the USB-C port.
One of the reasons Pi Juice is so great is because it's so very easy. The standoffs come pre-assembled with the Pi Juice, so just make sure you line up the Raspberry Pi GPIO pins with the headers of the Pi Juice and connect the two hardware pieces firmly together. Take the time to screw on the nylon standoffs into the base and remove that little slip of plastic separating the battery from the connectors. And just like that, you're good to go.That you have a fully functioning UPS for your Raspberry Pi. Literally, that easy, no extra software needs to be installed for it to work.
So let's plug in that microSD with the Raspberry Pi OS flashed to it, a mouse, a keyboard, plug it to a monitor and give it some power. Here I am doing it quickly here but my dual monitors with Raspberry Pi 4 takes this process slower. Jump to that if you need, link down below.
Now with it all connected press this button on the Pi Juice HAT and you will be welcomed by that familiar Kuala Lumpur background once it all boots up.
So a quick reshuffle of the table has occurred so I can demonstrate this UPS system to you because I could not believe it was this easy to set up the first time I did it. Currently, the system is connected to the mains by this micro USB cord so let's simulate a blackout by pulling this cord out. Yeah! Nice, we still have life. So even though the system is not connected to the mains anymore this is still running Raspberry Pi OS and that is very very nifty especially considering no software or code has been installed to our setup.
So as you can see the Pi Juice works straight out of the box, proper plug-in in play. But to get all the bells and whistles it is definitely worthwhile installing the software packages that the Canadians created for it.
So with the Raspberry Pi OS installed and connected to the internet let's open up that Raspberry Pi terminal by pressing the Raspberry Pi terminal icon in the top left of the screen. I'm going to make the words a little larger so you can all see and I'm going to write the sudo apt-get spacebar install space Pi juice hyphen gui then I'll press enter.On my keyboard to run it. This will run a little installer and once it's complete, safely restart the system. Then, after a reboot, you'll be able to discover a new icon. Find it by clicking on that top left raspberry in the top toolbar menu and holding your mouse over preferences. Move across to the Pi Juice settings. This opens up a fantastic world of settings which is definitely worth exploring. Better power management settings, automatic safe shutdown, automatic turn on and turn off at preset times, wake and sleep cycles on a schedule, and settings to connect different specification batteries and heaps more. It's really very swell.
Now, Pi Juice is not the only HAT you can use as a UPS for Raspberry Pi systems. For instance, DFRobot has UPS HATs for both Raspberry Pi Model B and A, and a unique size one for the Raspberry Pi Zero. These HATs have less customizability than the Pi Juice HAT but function perfectly fine as UPSs.
Raspberry Pi projects that require data collection, scripts that don't automatically restart on boot, a media looping monster (see the description down below how to create one), streaming from the web, a web server, or a Pi hole that blocks ads would all benefit greatly by incorporating a UPS. Furthermore, UPS HATs are the perfect tools to increase portability to your projects. Remote projects like remote camera systems, weather stations, a compact robot, a portable pocket Pi, do-it-yourself portable game console, point and shoot cameras - they can all be made simpler using a UPS hat.
Most UPS HATs also present a great method to monitor the batteries in terms of voltage, power, current, and the remaining capacity, which is alsoPerfect for those portable projects. Check out a number of portable projects like these linked in the description below.
So with the knowledge of how easy it is to set up a UPS on your Raspberry Pi, hopefully this has inspired some new projects and Raspberry Pi escapades into the future.
If you want any extra information, swing me a comment and with that, until next time, stay cozy.
Makers love reviews as much as you do, please follow this link to review the products you have purchased.