UPS3 power off guide

From Geekworm Wiki
Jump to navigation Jump to search


UPS 3 reserve power off hardware GPIO port to implement software full shutdown, this article introduces how to use the GPIO port of UPS3 to realize software shutdown function.

Check wirinpi version

In Raspberry Pi 4b, wiringPi 2.49 or wirinpi 2.50 will generate an error if the ‘gpio readall’ command is used to read the pin information, so it should be upgraded to wirinpi 2.52. If you use Raspberry Pi 3b, you don't need to upgrade.


Before upgrading, you should uninstall the original wiringpi first, uninstall method depend on your installation directory, execute the following command in the installation directory

./build uninstall
sudo apt-get remove wiringpi
sudo apt-get purge wiringpi
hash -r

The above uninstall action is optional, you need execute uninstall action if you meet some questions when you upgrade wirinpi.

How to update wirinpi V2.5 to wirinpi 2.52?

cd ~
mkdir  tmp
cd  tmp
sudo dpkg  -i  wiringpi-latest.deb

Please download and unzip it if you don't visit

Then run command the following command to check the wirinpi library version

gpio –v

OK, the wirinpi library version is updated to V2.52 now

Check the power off PIN of UPS 3 board


If pin 0 and pin1 are connected, the GIPO is 6, if pin 0 and pin2 are connected, the GPIO is 13

How to software full shut down?

gpio -v
gpio –g mode 6 out	 #6 is the power off GPIO pin, 6 and 13 is optional, it depend on the previous selection
gpio readall
gpio –g write 6 1	#this is the shutdown command
Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.

Anonymous user #3

19 months ago
Score 0++
After multiple attempts to set it up and power off Raspberry Pi 4 safely with gpio –g mode 6 out and gpio –g write 6 1 does not work (It still changes the value in in gpio readall table, but it does not start the shutdown sequence). I have tried using sudo shutdown now and many other different commands, but it always gets stuck in shutdown (plymouth-poweroff.service, actually its kernel panic that happens, because the power is still supplied to the board after you initiate a sudo shutdown now command). Hopefully geekworm support can help somebody with some actual instructions on what to do if this happens.


19 months ago
Score 0++


Could you please provide some pictuies?--[]

Please check which GPIO is shorted.

Anonymous user #2

22 months ago
Score 0++
Please document how this power off function relates to 1) the setting of the Auto UPS switch On or Off, and 2) if it matters if power is supplied on the USB3 connector.

Anonymous user #2

22 months ago
Score 0++

Given GPIO 6 is connected on the POFF strap, if I drive GPIO 6 to logic 1 then power to the RPi is immediately turned off, correct? It seems that this would be an uncontrolled power off to the RPi.

Is there a delay function for power off after a few seconds after GPIO 6 is asserted high, so that I can do a Linux shutdown command before the power switches off?


22 months ago
Score 0++


Yes, you can measure whether the gpio6 is really a logic 1 according to the configured driver.

Delayed shutdown function: please try to implement through software.

Anonymous user #1

26 months ago
Score 0++
Hi, I am looking for a solution to enable the pi with this UPS hat to perform a remote reboot. Currently, if I reboot I have to manually power off the ups hat and then power it on again with the ups button to get it going. Is there a way to remotely reboot without having any manual assistance to get it going again.? Thank you


26 months ago
Score 0++
Hi,UPS3 Supports AUTO POWER ON function (need to select the AUTO UPS switch to ON)