Have you ever wanted to...
- Monitor your vehicle?
- Read and clear DTC codes?
- Not have to use a proprietary app on your phone or laptop to interface with your vehicle?
- Measure the performance of your in-vehicle WiFi?
- Use OpenTelemetry to capture all of these signals?
Have a Raspberry Pi and an OBD2 cable/BLE adapter kicking around? Then PiOBD is for you. This uses https://github.com/brendan-w/python-OBD/tree/master for OBD connectivity functions, and the Python implementation of OpenTelemetry.
Here's what you (physically) need:
- Raspberry Pi (1GB+) with MicroSD card
- ELM-327/OBD-2 Adapter (this was tested using USB)
- Image your Raspberry Pi using Ubuntu 20.04 (if you do NOT want to use ThousandEyes, you can use a newer ver)
- Install the OpenTelemetry collector (eg., https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.104.0/otelcol-contrib_0.104.0_linux_arm64.deb)
- Configure the collector to send to your configured backend (I work for Cisco/Splunk, shameless plug)
- Be sure Python3 is installed on your Raspberry Pi
- Install required libs:
pip install obd opentelemetry-api opentelemetry-instrumentation opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc opentelemetry-exporter-otlp-proto-http - (optional) Create an account at https://www.thousandeyes.com/ for monitoring your in-vehicle WiFi
- (optional) Deploy the ThousandEyes Enterprise Agent to your RPI (tip: use the Linux install, not the Appliance)
Some vehicles will support the commands you want to issue and some will not. For example, I am able to obtain the Fuel Level on my 2021 RAM, but I am not able to do the same for my wife's 2017 Toyota Prius. The longer the command has been an OBD pid, the more likely it is to work. You will likely be able to fetch DTC codes from any MY vehicle that supports the OBD protocol, but newer pids such as Hybrid Battery Pack life may be unavailable.
By default the software should be placed in /opt/piobd. If you chose to install this as a service using systemd, you should be able to:
edit the user and group, and install path (if you modified from /opt/piobd)
cp obd-runner.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable obd-runner.service
sudo systemctl start obd-runner
sudo systemctl status obd-runner
At this point, the vehicle will begin reporting its telemetry data to your locally running collector, which in turn should publish to the backend. Of note here, you can modify how much "offline" telemetry the collector gathers, which may be very helpful in scenarios where either the in-vehicle wifi is unavailable, or you do not have in-vehicle wifi. Using a hotspot (eg., via your phone) is perfectly acceptable.
Please create an issue if you are having problems with the code itself. If you work for Cisco or Splunk, please reach out to me directly on Webex. Thanks!