In my original article about the Geekworm Raspberry Pi UPS HAT board a modification was described to adress an issue with this board: after only a short interruption of the external power, the board will not resume recharging the battery anymore, unless the pushbutton is pressed, which will also switch the Raspberry Pi off.
This article proposes a relatively simple modification, which may make the UPS HAT board more useful in your application.
Generally speaking, the modification should enable the Raspberry Pi to continue operation indefinitely, despite power interruptions of up to several hours. However, after an even longer power interruption, manual intervention may still be necessary to restart it.
You may copy and use information presented here for your personal purposes, but please do not republish any of it on a website or in any other media. You are welcome to link to this website instead! Thank you.
Important Warning: Following any instructions or suggestions given here is at your own risk! Not only are the components and the PCB of the UPS HAT board easily broken, it uses a Lithium Ion battery which, especially if improperly handled or operated, might explode and/or cause a fire!
For questions or comments, you could leave me a message using this website's contact page.
Description of the modification
I haven't fully tested this modification myself, since I have only one UPS HAT board, and I went on to do the advanced modifications discussed in the original article, but I am pretty sure the modification, properly done, would work as described.
In the unmodified UPS HAT board, switching on the Raspberry Pi, by pressing the pusbutton, involves U3, the IC that is responsible for charging the battery. This has the unwanted side-effect. By connecting R1 to Vbat, the Raspberry Pi is permanently powered. I actually did this part of the modification, and I observed that U3 will now resume battery charging after external power is lost and returns.
In addition, the function of the push button is changed. It will now interrupt the power to the Pi while pressed. This is convenient in case the Pi needs to restart after an especially long power interruption.
Required Skills and Tools
This modification is not recommended if you don't already have some experience in soldering electronics with small SMD components. The components and the PCB are easily damaged.
You will need:
- a fine tipped soldering iron
- stainless steel tweezers with sharp points
- thin rosin core soldering tin
- thin isolated wire, such as wire-wrapping wire or transformer wire
The modification, step by step
Step 1. Remove any power from the board while doing the modification. When disconnecting the battery, take care to pull the white plug body! If you pull on the wires, they will soon break, and this is difficult to repair.
Step 2. Remove R3 from the board. Use the tweezers to retrieve it, if sticking to the soldering iron tip. Solder it back on, turned by 90 degrees, as shown in the second picture below (this is just for keeping it around, in case you would want to reverse the modification later on).
Step 3. Remove R1 from the board. Use the tweezers to retrieve it. Solder it back on to the left pad, turned by 90 degrees, as shown in the picture. The left pad of R1 is where the Enable pin of U1 is connected. This Enable pin must be pulled high so that U1 provides power to the Pi.
Step 4. Wire R1 to C8 as shown (use the tweezers to manipulate the wire). This connects the top end of R1 to Vbat, so that U1's Enable pin is pulled up permanently, if the battery is connected and not completely drained.
Step 5. Wire the empty pad of R3 to R14 as shown. Now, whenever the push button is being pressed, it pulls the Enable pin of U1 to ground.
Since R1 now permanently pulls high the Enable pin of IC U1, the Raspberry Pi will be switched on whenever a charged battery is connected and/or external power is applied.
The pushbutton can now pull that same Enable pin to ground, to switch the Raspberry Pi off as long as it is pressed.
How to use
Whenever external power is present, the battery will be charged untill it's full. In case the external power is lost, the Pi will continue running on battery power. By checking the battery status via I2C (refer to the Driver and Sample Code found on the wiki) it can perform a shutdown before the battery level becomes too low. Depending on the model of Pi, how hard you make it work, and how much additional hardware you have connected to it, it can take several hours before that may happen. If the external power comes back within this time, the Pi will simply carry on as normal, while the battery is again being recharged.
In case of an extended blackout, the battery level may get so low that the Pi needs to shuts down. However, until the battery is fully drained, the Pi still receives power from the UPS HAT board. If the external power now returns, the Pi will not restart but remain in shutdown. You can restart it as follows. After verifying that the Pi is actually in shutdown (e.g. it is not reachable on the network, its activity LED is not blinking), press the pushbutton for several seconds. On releasing it, the Pi gets powered again, so it can start up.
As noted, I have not tested this modification myself. If you try it, I'd like to hear if it worked for you!