Raspberry Pi Car infotainment
Hi
I have understood that several of us is thinking of using a Raspberry Pi in the car.
I am using the original 7" tft. A USB gps dongle and internet connection via my phone's WiFi.
I have managed to get a "ignition" function using one of the GPIO:s.
It recuired to install busybox to get the script working.
I have understood that several of us is thinking of using a Raspberry Pi in the car.
I am using the original 7" tft. A USB gps dongle and internet connection via my phone's WiFi.
I have managed to get a "ignition" function using one of the GPIO:s.
It recuired to install busybox to get the script working.
0
Comments
My script looks like this:
!/system/bin/sh
init
Set up GPIO 4 and set to input
echo "4" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio4/direction
Main code
while :
do
#check status of ignition pin
is=
cat /sys/class/gpio/gpio4/value
# Check if dislay status us the same as GPIO pin used
if [ "$is" != "$(dumpsys power | grep -c "Display Power: state=ON")" ]
then
if [ x"$is" = x"0" ]
then
# turn off screen
input keyevent 223
fi
if [ x"$is" = x"1" ]
then
# turn on screen
input keyevent 224
fi
fi
sleep 3
done
Hey @Pebert,
Wow, I’m really happy someone is starting to post a topic about working with the GPIO! I’m currently also trying to get some sensors working with the system, but I experience quite a lot of problems with the “read only” system or “access denied” on the root, etc.
Could you maybe explain where you did put the script and how you work with busybox to make this work?
I think there a lot of people on the platform who have similar issues to start with some more advanced stuff like scripts for GPIO.
I will try to post useful insights too when I can launch development. Maybe we can help each other out here.
I downloaded and followed the instructions here:
https://github.com/Gnurou/busybox-android
I think it requires that you have a linux computer that can run the install script.
Then, when the busybox is installed I put the script under /data/data, and another script under /data/init.d/ that just starts the first script.
I can upload the scripts here at bit later, need to extract them from my node first.
Thank you @Pebert for the information. I will try that as soon as possible. If you have the scripts available it would be great.
I have a Mac so there should be no problem with the installation script.
Hey @Pebert,
Thank you again for the description, I can now use busybox. If you could upload the two scripts, it would be great. So I have a preference point and know the code in the scripts should definitely work.
http://adgj.se/ignition.sh
I have put it under /data/data/
Then under /data/init.d/ I have put this to start up the script
http://adgj.se/start_ignition
Hardware wise i have a relay that short circuits GPIO 4 with ground when not active.
Thank you very much for the scripts! I will start playing with them now.
Your script doesn't define the execution trigger. Is it really executed? Please check other files in /data/init.d for how such files should start.
What do you mean?
It starts with
### BEGIN INIT INFO
# Exec: boot
# Type: permanent
### END INIT INFO
OK, it is correct then.
Someone know what is the command to power off with security the Android System? (for example, when we press the button power off of the ignition App fo the Emeteria) @kalkov
reboot -p
Thank you to both Pebert and sgrayban! I am building myself a gps media system for my car. Everything is complete with this simple code.
I installed BusyBox with an app, tho, but it works. I couldn`t figure out how to register the startup script, so I took the code below and put it in "settime" in init.d. Worked like a charm.
(/system/bin/sh /data/data/ignition.sh </dev/null >/dev/null 2>&1 )&
Than I replaced the "keyevent 223" with "reboot -p" like sgrayban suggested and now shutsdown.
Might be nice to cont some time after press to shutdown, but I will try to find a code of some sort. Not my best skill.