What is the relationship between the “RpiRunning” and “Rpi shutdown” pins on the controller boardard to
Are they active high or low?
My idea is if there’s a convenient pin that’s active low when the GoPiGo is active, I can tie it to the !ready line on the buck/booster board to force a complete shutdown of the bot, including the external power supply boost, when the robot is shut down for any reason.
# This code is for power management on a Raspberry Pi with GoPiGo3.
#
# GPIO 22 will be configured as input with pulldown. If pulled high, the RPi will halt.
#
# GPIO 23 needs to remain low impedance (output) set to a HIGH state. If GPIO 23 gets
# left floating (high impedance) the GoPiGo3 assumes the RPi has shut down fully.
# SW should never write GPIO 23 to LOW or set it as an INPUT.
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(23, GPIO.OUT)
GPIO.output(23, True)
while True:
if GPIO.input(22):
os.system("shutdown now -h")
time.sleep(0.1)
Cron jobs don’t have an “on shutdown” qualifier. To implement that I’d have to create, (or modify), one of the shutdown services or scripts.
I don’t want it to be purely dependant on software. I want the primary dependency to be on the actual hardware. I already have enough software to maintain as it is!
Also, there are already signalling pins that I can use - worst case I have to invert one with a MOS switch or a transistor configured open-collector.
Now all I have to do is find my box of transistors. . . .
Asserts itself high when the green power LED stops flashing and comes on solid.
(i.e. The GoPiGo O/S is up, the GoPiGo libraries are loaded and active, and the GoPiGo robot systems are fully running; though there may be post-boot scripts and tasks to run.)
De-asserts itself when the red power LED goes completely off. (Fully powered down)
With a way to invert this, I’ll have a status pin I can monitor to shutdown the external supplemental 5v supply.