Power off question

Hi, I have a raspberry pi 4 on a pisugar 3 board with its battery, with the pisugar and the rpi both connected to 5v power. When no power is connected and I shut down the rpi under rpi os, it shuts completely down, i.e. not lights anymore on the rpi, while still being on the pisugar battery, which is the intended behavior for pisugar.
Now, when I run the rpi under Volumio OS, which is based on rpi os I believe, the rpi does not completely shut down when no power is connected, with still a red light on on the rpi, so it still draws power from the battery as it seems. Any idea how to have it completely shut down? Any help would be highly appreciated! Thanks! :slight_smile:

This works already for a few months for a Orange Pi PC (H3-chipset)

All the parts are sold by Temu/Aliexpress .
Based on:
UPS 5v with 18650 batteries
5v SSR switching on/off a 5v powersupply use a 3 A or higher
5v power Fet module to switch on/off the SBC
IC’s Ne555 and a 4093
Some condensators/diodes/transistors

Orange PI has a power-down button so install package acpid and make a wire to this button.
Second put a script in the directory to switch a GPIO pin to high it will trigger the ne555 timer so it will reset the 4093 and the power will be disconnected also to the SSR.
Script:
./lib/systemd/system-shutdown/99set-gpio.sh ; chmod 755 ./lib/systemd/system-shutdown/99set-gpio.sh
#!/bin/bash

if uname -r | grep -i sunxi 1> /dev/null
then

[ -f /etc/default/gpio ] && . /etc/default/gpio

for j in IFS=\, ; echo ${GPIO}
do
eval IFS=\: ; set -- ${j}; echo NB=${1}\;VAL=${2}
case ${VAL} in
[Hh][Ii][Gg][Hh] ) VAL=1
;;
[Ll][Oo][Ww] ) VAL=0
;;
0 ) :
;;
* ) VAL=1
;;
esac

    if [[ ${VAL} =~ ^[0-9]+$ ]] 
then

  if [ ! -f /sys/class/gpio/gpio${NB}/value ]
  then
         echo ${NB} > /sys/class/gpio/unexport 2> /dev/null
         echo ${NB} > /sys/class/gpio/export
         echo out > /sys/class/gpio/gpio${NB}/direction
  fi
         echo ${VAL} > /sys/class/gpio/gpio${NB}/value
 fi

done

fi
file:
/etc/default/gpio
#
# set gpio pins high before powerdown
# Var. GPIO= or GPIO=DIGIT:[high or low,DIGIT:[high or low], etc.
# See /lib/systemd/system

GPIO=10:1

For R2/R3/R4
(tested on a R3)

See first:
https://forums.raspberrypi.com/viewtopic.php?t=261269 and/or
Q: How to make a GPIO automatically go high after shutdown - Beginners - Armbian Community Forums
I used for the trigger (ne555) pin26.
In Volumio specify a shutdown button, you must use a GPIO pin below number 10 because these are initially on high level.

Now you can use a push-button to shutdown gracefully and when it is down push it again and will startup. If your SBC is hanging push the force sw for few second it will reset. If the batteries empty place a by-pass switch over the AC side of the SSR. I put the power (AC) separate in a small case with a power entry and is connected with 4 wire connection. 2 wires to the UPS in connected to the 5V power supply. 2 wires to + and gnd of the SSR. Put a R of 1K between the + and the trigger-in of the board.