This example uses the Hologram Nova USB Modem with a Raspberry Pi in order to relay OBDII data to the AdafruitIO cloud. This guide assumes you have access to a terminal on your Raspberry Pi. I recommend connecting via a serial terminal.
Run the following in a terminal, it will install the Hologram, Adafruit-IO and OBD Python SDKs as well as the Hologram CLI.
curl -L hologram.io/python-install | bash
curl -L hologram.io/python-update | bash
sudo pip install adafruit-io
sudo pip install obd
- Hologram NOVA https://hologram.io/nova/
- Raspberry Pi 3
- USB OBDII ELM327 Reader https://www.amazon.com/gp/product/B005ZWM0R4/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
- Clone this repo
- Create a file adafruitConfig.py with the following:
ADAFRUIT_IO_KEY = 'YOUR ADAFRUIT IO KEY'
ADAFRUIT_IO_USERNAME = 'YOUR ADAFRUIT IO USERNAME'
- Spin up the network connection through the NOVA
sudo hologram network connect
- Start the script
sudo python main.py
- Go to your adafruit.io account and create a dashboard to watch your new feed named "fleet"
- ????
- PROFIT
The main example send up values returned from the SPEED command. Below is a basic example of how to use the OBD python library.
Here is a link to all the supported commands: https://github.com/brendan-w/python-OBD/blob/master/docs/Command%20Tables.md
Give different ones a shot and see if there is data that you might find more useful from your vehicle.
import obd
connection = obd.OBD() # auto-connects to USB or RF port
cmd = obd.commands.STATUS # select an OBD command (sensor)
response = connection.query(cmd) # send the command, and parse the response
print(response.value) # returns unit-bearing values thanks to Pint
Dashboard set-up is similar to this guide https://cdn-learn.adafruit.com/downloads/pdf/adafruit-io-basics-gps.pdf
To better understand the API and different ways to send data you can check out these docs https://learn.adafruit.com/adafruit-io/mqtt-api