Skip to content

Connect Raspberry Pi with Bluetooth OBD adapter and collect real-time car data.

Notifications You must be signed in to change notification settings

eron93br/pi-bluetooth-obd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pi-bluetooth-obd

Connect Raspberry Pi with Bluetooth OBD adapter and collect real-time car data.

Requirements:

Step 1 - Install Softwares

  • Install Python OBD: sudo pip3 install obd
  • Upgrade pySerial: sudo pip3 install --upgrade pyserial
  • Install Screen sudo apt-get install screen

Step 2 - Connect OBD Adapater via Bluetooth

bluetoothctl
help <-- see all the commands
show
power on
pairable on
agent on <-- used for persisting pairing code
default-agent
scan on <-- find OBDII and its MAC address
pair <mac_address> <-- enter pin 1234
trust <mac_address> <-- this will allow Pi to automatically pair with the device next time
scan off
quit

Step 3 - Connect Car with Screen (Optional)

screen /dev/rfcomm0
atz
atl1
ath1
atsp0 <-- use protocol auto, available protocols: 1, 2, 3, 4, 5, 6, 7, 8, 9, A
0100 <-- mode 01, pid 00, supported pids

If successfully connected to the car, 0100 will return something instead of "UNABLE TO CONNECT" or "CAN ERROR" or "BUS INIT: ...ERROR".

Step 4 - Connect Car with Python OBD

  • Create a serial port: sudo rfcomm bind hci0 <mac_address>
  • Run the program: python3 obd_reader.py
  • See a list of commands here

Step 5 - Upload Car Data to AWS Dynamo DB (Optional)

  • Install AWS Python SDK: sudo pip3 install boto3
  • Follow the instructions to set up AWS credentials, and create a DynamoDB table named "telematics" with primary key "id"
  • Run the program: python3 obd_uploader.py
  • Check if the speed & fuel level data are uploaded to the DynamoDB table

Step 6 - Create an Alexa Skill (Optional)

  • Create an Alexa skill that reads from the DynamoDB table, so when ask "what's my fuel level", Alexa will respond "your fuel level is 60%"
  • Use the Alexa skill configs and Lambda function from "alexa" folder

About

Connect Raspberry Pi with Bluetooth OBD adapter and collect real-time car data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%