0

I'm trying to interface a Raspberry Pi 3B to a Bluetooth ELM327 OBD scanner but I'm having some troubles. I've connected the raspberry to the OBD Scanner by running the following commands from the terminal:

bluetoothctl
power on
default-agent
pair <scanner MAC address>
trust <scanner MAC address>
sudo rfcomm bind rfcomm0 <scanner MAC address>

I've then proceeded to run the following python script to check the connection status

import obd


obd.logger.setLevel(obd.logging.DEBUG)

connection = obd.OBD("/dev/rfcomm0")
print("Connection status: ")
print(connection.status())


connection.close()

Then I've returned this,

[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=auto PROTOCOL=auto
[obd.elm327] [Errno 16] could not open port /dev/rfcomm0: [Errno 16] Device or resource busy: '/dev/rfcomm0'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Connection status:
Not Connected

I don't know how to solve this this, and I hope you can help me out.

KLiyo
  • 5
  • 6

1 Answers1

0

I think this was a problem because you chose the wrong port, you can scan the ports with this code. The code is captured from this repo.

 import obd
 ports = obd.scan_serial()      
 print(ports)