hello all,
i am in the process of building a custom car headunit based around a Pi3, i have got the majority of the system itself working but i am struggling with one thing that seems to be a software issue.
i am trying to setup a system whereby when the cars ignition is turned to ACC it triggers a relay that will power on the pi and when key is turned off the relay releases witch will cause the pi to power down
of course this means that GPIO 3 pin will be pulled to ground which car is running and the pi only need to trigger shutdown when it releases
i have got the gpio-shutdown overlay enabled and it does work to power the pi up.
i am using a script that was made by someone some years ago (which could well be my problem) that is supposed to monitor the GPIO and send the shutdown command when the relay releases, this script works as intended on older rasbian buster but on bullseye i get a gpio busy error and the script fails to run.
script is below, again this is not my work it was written some years back but is on a public github so i have not poached a paid script.
i am at an absolute loss how to sort this out so need some help or ideas
again it only seems to fail on bullseye raspbian
i am in the process of building a custom car headunit based around a Pi3, i have got the majority of the system itself working but i am struggling with one thing that seems to be a software issue.
i am trying to setup a system whereby when the cars ignition is turned to ACC it triggers a relay that will power on the pi and when key is turned off the relay releases witch will cause the pi to power down
of course this means that GPIO 3 pin will be pulled to ground which car is running and the pi only need to trigger shutdown when it releases
i have got the gpio-shutdown overlay enabled and it does work to power the pi up.
i am using a script that was made by someone some years ago (which could well be my problem) that is supposed to monitor the GPIO and send the shutdown command when the relay releases, this script works as intended on older rasbian buster but on bullseye i get a gpio busy error and the script fails to run.
script is below, again this is not my work it was written some years back but is on a public github so i have not poached a paid script.
Code:
#!/usr/bin/env pythonimport RPi.GPIO as GPIOimport subprocessimport time#add this to crontab @reboot sudo python /home/pi/listen_for_shutdown.py > /dev/null 2>&1GPIO.setmode(GPIO.BCM)GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)while GPIO.input(3) == GPIO.LOW: time.sleep(0.5)subprocess.call(['shutdown', '-h', 'now'], shell=False)i am at an absolute loss how to sort this out so need some help or ideas
again it only seems to fail on bullseye raspbian
Statistics: Posted by dmpdiscos — Thu Mar 27, 2025 9:13 am