A python project to pull vehicle information from a bluetooth OBD-II adapter and output it to a nice GUI on any touchscreen display.
- Coolant Temp, Intake Temp, Battery Voltage, STFT, LTFT, Throttle Pos, Engine Load, Spark Advance, Gear Indicator, RPM (w/ MAX), Speed (w/ MAX)
- Adjustable Warning thresholds for Coolant Temp, Intake Temp, STFT, LTFT, RPM and Speed
- DTC Read and Clear Function
- Selectable C/F MPH/KPH
- Brightness Control
- Raspberry Pi 3B+ (Tested on Pi Zero 2W & Pi 4 2GB)
- Raspberry Pi OS Bullseye 32-bit
- Python 3.9.2
- WaveShare 4.3" DSI Touchscreen Display
sudo apt update
sudo apt install libfreetype6-dev libgl1-mesa-dev libgles2-mesa-dev libdrm-dev libgbm-dev libudev-dev libasound2-dev liblzma-dev libjpeg-dev libtiff-dev libwebp-dev git build-essential -y
sudo apt install gir1.2-ibus-1.0 libdbus-1-dev libegl1-mesa-dev libibus-1.0-5 libibus-1.0-dev libice-dev libsm-dev libsndio-dev libwayland-bin libwayland-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev x11proto-randr-dev x11proto-scrnsaver-dev x11proto-video-dev x11proto-xinerama-dev -y
wget https://libsdl.org/release/SDL2-2.0.10.tar.gz
tar -zxvf SDL2-2.0.10.tar.gz
pushd SDL2-2.0.10
./configure --enable-video-kmsdrm --disable-video-opengl --disable-video-x11 --disable-video-rpi
make -j$(nproc)
sudo make install
popd
wget https://libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz
tar -zxvf SDL2_image-2.0.5.tar.gz
pushd SDL2_image-2.0.5
./configure
make -j$(nproc)
sudo make install
popd
wget https://libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
tar -zxvf SDL2_mixer-2.0.4.tar.gz
pushd SDL2_mixer-2.0.4
./configure
make -j$(nproc)
sudo make install
popd
wget https://libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.15.tar.gz
tar -zxvf SDL2_ttf-2.0.15.tar.gz
pushd SDL2_ttf-2.0.15
./configure
make -j$(nproc)
sudo make install
popd
sudo ldconfig -v
sudo apt update
sudo apt upgrade
sudo apt install pkg-config libgl1-mesa-dev libgles2-mesa-dev python3-setuptools libgstreamer1.0-dev git gstreamer1.0-plugins-{bad,base,good,ugly} gstreamer1.0-{omx,alsa} libmtdev-dev xclip xsel libjpeg-dev -y
sudo apt install python3-pip
pip3 install --upgrade pip setuptools
pip3 install --upgrade Cython==0.29.19 pillow
pip3 install kivy
git clone https://github.com/charliehoward/obdPiDash.git
cp obdPiDash/*.sh ./
cd obdPiDash
python3 main.py
Edit /.kivy/config.ini by:
cd
sudo nano .kivy/config.ini
Remove mouse cursor:
- Replace the line
show_cursor = 1
withshow_cursor = 0
Change [input] to:
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
In raspi-config -> Advanced Options -> Memory Split
- Change value to 512MB
https://python-obd.readthedocs.io/en/latest/#installation
pip3 install obd
sudo apt install python3-rpi.gpio
sudo bluetoothctl
agent on
default-agent
scan on
pair xx:xx:xx:xx:xx:xx
<- Your BT MAC hereconnect xx:xx:xx:xx:xx:xx
trust xx:xx:xx:xx:xx:xx
sudo nano /etc/systemd/system/obdPiDash.service
[Unit]
Description=Start OBDPi
[Service]
ExecStart=/bin/sh /home/pi/obdPiLauncher.sh
ExecStop=/usr/bin/pkill -9 -f main.py
WorkingDirectory=/home/pi/obdPiDash/
StandardOutput=inherit
StandardError=inherit
User=pi
[Install]
WantedBy=multi-user.target
Make sure to change your username if it's not pi Ctrl+x to Save
Now, enter the line:
sudo systemctl enable obdPiDash.service
Then make the launcher executable:
sudo chmod a+x ./obdPiLauncher.sh
Reboot for final test
Modify in main.py
- developermode 0=Off 1=On <- 0 for in vehicle use, 1 for development/demo use
- externalshutdown <- leave as 0 for now, in development
- AccelEnabled <- leave as 0 for now, Accelerometer in development
- OBDEnabled <- 1 if you are using OBDII features, leave it ON
- onPi <- its default 1, but will change to 0 in code if detected not running on Pi (for development on PC)
- autobrightness < 0 will keep brightness same as last boot, 1 allows custom time if using RTC, 2 will always dim on boot
- Make the update script executable:
sudo chmod a+x ./obdPiUpdate.sh
- Add the following to the bottom of /boot/config.txt
disable_splash=1
boot_delay=0
- /boot/cmdline.txt - change console=tty1 to console=tty3, add the following to the end of the line
splash quiet logo.nologo vt.global_cursor_default=0 consoleblank=0
- In /etc/pam.d/login comment out the following lines
session optional pam_lastlog.so
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate
- Run
touch ~/.hushlogin
- Remove everything from /etc/motd
- Make blackoutTerminal executable:
sudo chmod a+x ./blackoutTerminal.sh
- Make this script run at startup:
sudo crontab -e
and add the following to the bottom:
@reboot /bin/sh /home/pi/blackoutTerminal.sh
Make sure to change your username if it's not pi