-
Notifications
You must be signed in to change notification settings - Fork 11
Modifying the Geekworm UPS 2 HAT
The PCB(see pictures above, first top, then bottom view) is very nicely done, with a lot of small details that show that a lot of thought has gone into the design. Some of the hardware features are:
- USB-C and Micro USB connector
- The system is specified for 3A constant output. I would take that with a grain of salt, but I have a Raspberry Pi4 running successfully off it (without Video output, no Bluetooth, no WLAN).
- Solder pads for the battery, allowing to connect not only through the connector but by solderings cables to the pads as well. We will be using these to connect the ATTiny_Daemon to the battery
- Through-hole connection to the 5V output of the UPS, allowing to connect additional devices directly.
- Solder bridges allowing to change the physical pin to which SDA And SCL are connected. This also allows to fully disconnect the I2C if needed.
- The UPS functionality can be changed using a switch (SW1), that when turned on, protects the battery and turns the UPS automatically of when reaching 3V. In addition the UPS is turned off when a specific pin of the RPi is pulled low (this can be configured using a dtoverlay). If the switch is off, then the UPS is turned on and off using the button S1.
- The pin used together with SW1 to turn off the UPS can be changed using a solder bridge and is not connected by default.
- The charge current can be configured between 1A and 3A using solder bridges.
- The charging chip is a modern MPS-MP2632 that is optimized for LiIon-batteries.
- The battery is always charged as needed when primary power is attached
The problem is that when the switch is on, then it can turn everything off automatically but cannot turn it on again, and I could not get it to turn on automatically whatever I tried. Furthermore, when the switch is on and the system has shut off then the button cannot turn it back on again. After having experimented with it quite a lot I decided to leave it in the off-position and ignore it for the ATTiny Daemon.
Now, in accordance with the history of the ATTiny Daemon we will call the button S1 "the switch" that turns the UPS on and off. I know this might sound strange (since we have another switch on the board), but that way is the most generic way to call it and furthermore, it will be connected to the pin on the PCB labeled SW (for switch).
I got two of the devices from Geekworm free of charge for my experiments. A big thank you to Geekworm for that. And additionally, the constant help of the designer of the board, Garrett from Geekworm was invaluable in understanding the functionality of the device.
Since then, I bought additional boards, and I do not think that my opinion has been influenced in any way (ymmv)...
With these properties the Geekworm UPS2 sounds like the perfect basis for our ATTiny Daemon. There is a small problem though.
When I experimented with it and with different Raspberry Pis (from a ZeroW to a RPi4) I saw that quite often the power LED of the Raspberry would turn off for a second or two and then come back on. I did not observe a reset or other problem, but I have read of such problems. I used the original RPi4 PSU that provides 3A, which should definitely be enough to power a RPi3 and the PSU. When I tried to measure the voltage during changes in the primary power it became clear that the UPS2 consumes a lot of current during the startup, even if the battery is fully charged.
If you look at the following Oscilloscope graph you can see that the voltage drop is substantial:
We can see that with 2A the drop is substantial.
Interestingly removing the primary power is handled very gracefully and the drop is within the specification for USB voltage:
I know that normally this type of measurement is only done with 20MHz bandwidth, but I was interested in everything that was happening. And we can see that the noise is unproblematic and quite acceptable.
My assumption is that when the UPS has just switched to primary power for the RPi and turned on charging the battery, this is done with the full current, thus taking away 2A while the RPi tries to get 2A of its own. The 3A PSU that I use cannot provide this current without a voltage drop.
To test this hypothesis, I changed the configuration for the charge current to 1A (CC1 closed, CC2 open), and lo and behold, the voltage drop was gone and the RPi no longer turned off its power LED.
At one point in the future I will have to test the other configurations for the charge current with my Lab PSU to see what happens when I provide more current, but I have tested the 1A configuration with the Pi ZeroW, the Pi3, Pi3B and the Pi4. So I'm pretty confident that changing the configuration to a charge current of 1A is a solution to the undervoltage problem with "normal" PSUs.
I really like this new version, the Geekworm UPS2, the modifications needed are minimal and I currently use it for my essential Raspberry Pi servers. So, in my eyes a big thumbs-up.
One point is especially important with the Geekworm UPS2: You really need to use a battery with at least 2.500mAh (to provide the maximum needed amperage). You need this even if you want to provide power for only a short time. Many LiIon batteries can provide around 2C current, meaning 2 times their capacity as current i.e., max 5A for a 2.500mAh cell. And with this high current the battery ages very fast. So the larger the better for the longevity of the battery.
First of all, the modifications are only minimal, and are in no way comparable to what we have to do with the older version 1. We need to change two solder bridges and attach two cables. That is it.
To reduce the charge current we have to remove the solder bridge from CC2 and add a solder bridge to CC1. The pictures show the different steps and it should be no problem to do this with a normal soldering iron (see above picture of the bottom before we start the modification, the important area is marked in green with the label "charge current").
Use solder wick to remove the solder from CC2. I like to use additional flux from a flux pen to make the removal easier, but this is not necessary.
Add a bit of solder first to one of the pads of CC1, then to the other. Now add flux, heat both pads and add solder until the solder bridge is established.
Cut an orange Dupont cable to length and solder it to the pin named "Switch" in the full picture. The detail picture shows that it is the pad further from the border. To make the soldering easier you can add a bit of solder to this pad before soldering the Dupont cable to it.
Add a bit of solder to the battery connector pad (labeled VBat in the full picture). Cut a red Dupont cable to length and solder it to this pad.
The modification needed is so minimal that it is hardly a modification at all. The steps are:
- Remove solder bridge CC2
- Add solder bridge CC1
- solder an orange Dupont cable to the switch pin shown in the picture.
- solder a red Dupont cable to the battery pad marked VBat.
For the modified Geekworm UPS 2 we need to „press“ the switch for 4 seconds, once to turn the UPS off, and a second time to turn it on again. Depending on whether you used the jumper on the ATTiny Daemon PCB to connect the ATTiny to the RPi’s 5V power you additionally let the system check the voltage (this is highly recommended). The config file entries for this are:
Option Name | Default | Comment |
---|---|---|
ups configuration | 1|3 | This value configures how the ATTiny daemon tries to reset the system: Bit 0 = 1: Reset by „pressing“ a switch twice (pulling the line down for the reset pulse lenght turns the switch once) Bit 1 = 0: Do not check external voltage (external voltage is not connected to RPi Vcc) Bit 1 = 1: Check external voltage: (external voltage is connected to RPi Vcc) Recommended for Geekworm UPS2 is the value 3 (including connecting the EXT_V pin to the RPi Vcc via the jumper) |
pulse length | 4000 | This is the length of the pulse used to execute the reset (the switch has to be pressed 4000ms) |
switch recovery delay | 1000 | This is the time in ms to wait before „pressing“ the switch again (needed since we are in switch mode) |