(yes there are too many decimal places on the engine load, I've fixed this in the code)
- Raspberry Pi with Bluetooth & Wi-Fi (inbuilt or USB dongle, doesn't matter)
- OBD2 Bluetooth module (buy from eBay, Aliexpress, etc. <$10)
- PiFace Digital to switch video input & detect button presses. I had this lying around, otherwise you can use any kind of relay board and wire your own buttons to GPIO.
- Reversing camera / dash cam with video output
- Display with composite video input
note: composite video is used so I can easily switch outputs with a relay, quality isn't too bad on a small display.
Relays: NC (normally closed, i.e. connected by default when Pi is off), CO (common), NO (normally open)
RPi <<<GPIO>>> PiFace
PiFace relay 0/1 <<<NC>>> RPi video out
<<<CO>>> Display video in
<<<NO>>> Camera video out
<<<GND>>> Ground of all cables
I only had one 12V socket available at the front of the car, and the dashcam was already using this, so I took apart the plug, made a small hole and soldered two extra wires to power the 12V display.
The Pi gets power from a USB socket on the CD player meant for flash disks (it apparently provides adequate current, use a USB voltage/current meter to check you're still getting 5+/-0.25V if you're trying such tricks).
- Connect module to car
- On the Pi, in a terminal, run:
sudo apt update && sudo apt upgrade
pip3 install obd PySimpleGUI keyboard
git clone https://github.com/trishmapow/obd-gui
- To connect to the module, run:
bluetoothctl
to enter bluetoothctl shellscan on
andscan off
once you see your modulepair [MAC]
where MAC is the address of your OBD moduletrust [MAC]
paired-devices
check your module is listedquit
to exit bluetoothctl shellsudo sdptool add SP
sudo rfcomm connect hci0 [MAC]
you should see 'press ctrl+c for hangup'
- Now to see if you can interface with the module:
cd
intoobd-gui
python3 gui.py
, if you see the numbers and graph updating, great! Otherwise alt-tab to switch to the terminal and see the errors (or exit the app using alt+f4). I had to make some patches to get my module working, you can find them here. Check the troubleshooting guide and issues in the repo. You may have to dig into the pythonOBD source in~/.local/lib/python3.7/site-packages/obd
- PiFace config steps:
- unfortunately the apt and pip packages for the piface don't seem to exist anymore, so we have to install manually.
git clone
both pifacecommon and pifacedigital-io,cd
into the directories and runsudo python3 setup.py install
for both modules - enable SPI in
sudo raspi-config
, under 'interfacing' (iirc) - run
sudo python3 piface.py
from theobd-gui
folder. sudo is required for thekeyboard
module to work and emulate keypresses - try pressing the first button, the relay should switch. The second and third buttons should emulate the left and right arrow keys respectively
- unfortunately the apt and pip packages for the piface don't seem to exist anymore, so we have to install manually.
- Autostart the apps with the Pi:
- copy the files in
autostart
to/etc/xdg/autostart
. Make any necessary edits to the desktop files. - add your module's MAC address in
connect.sh
- if the scripts complain about missing modules when running with sudo, uncomment the
sys.path.append
lines at the top ofgui.py
andpiface.py
(edit as necessary depending on your Python version, you can runpip3 show obd
to see where your package is installed). This is a quick fix solution, there are cleaner ways if you edit sudoers, etc.
- copy the files in
The GUI uses the PySimpleGUI library (just about the fastest & easiest way to get a working GUI running). You can adjust the font, refresh rate etc easily by modifying the constants and/or the layout
array.
Contributions are welcome, I made the GUI in a rush and focused mainly on functionality.