UPS3 power off guide
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 wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb
Please download File:Wiringpi-latest.zip and unzip it if you don't visit https://project-downloads.drogon.net/wiringpi-latest.deb
Then run command the following command to check the wirinpi library version
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