0

I try to connect my pi zero W to OBD2 module through bluetoooth. My pi is connected to my 4G iphone wifi and I communicate with it through ssh.

I used bluetoothctl and can't connect when running connect 01:23:45:67:89:BA. I got the following error message: Failed to connect: org.bluez.Error.NotAvailable

When also running connection = obd.OBD('/dev/rfcomm1') I got

Traceback (most recent call last):


File "<stdin>", line 1, in <module>
  File "/home/coco/.local/lib/python3.9/site-packages/obd/obd.py", line 63, in __init__
    self.__connect(portstr, baudrate, protocol,
  File "/home/coco/.local/lib/python3.9/site-packages/obd/obd.py", line 85, in __connect
    self.interface = ELM327(port, baudrate, protocol,
  File "/home/coco/.local/lib/python3.9/site-packages/obd/elm327.py", line 146, in __init__
    if not self.set_baudrate(baudrate):
  File "/home/coco/.local/lib/python3.9/site-packages/obd/elm327.py", line 294, in set_baudrate
    return self.auto_baudrate()
  File "/home/coco/.local/lib/python3.9/site-packages/obd/elm327.py", line 324, in auto_baudrate
    response = self.__port.read(1024)
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 577, in read
    raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

Thank you in advance for your help,

I tried sudo rfcomm bind rfcomm1 98:D3:31:FB:6F:F1 as shown here: https://raspberrypi.stackexchange.com/questions/82173/failed-to-connect-org-bluez-error-notavailable-error/82184

PS : screen command doesn't work, my screen is blinking when launching the command

2 Answers2

0

Make sure you've loaded the bluetooth module into your kernel:

$modprobe bluetooth
$modprobe hci_uart 
$hciattach /dev/ttyS5 bcm43xx 3000000 (not sure if it'll work in your board,do look this command up)
$hciconfig hci0 up (if not hci0,try hci1)

once this is done,try:

 $sudo hciconfig hci0 piscan  
 $sudo sdptool add --channel=22 SP
 $sudo rfcomm listen /dev/rfcomm0 22

If all goes well,you should be getting

Waiting for connection on channel 22

Once that is done,try connecting it with your iphone via a serial bluetooth app. Let me know how it goes

Shreyan11
  • 1
  • 2
  • 1
    Thanks foy your help. Eventually couldn't resolve "Failed to connect: org.bluez.Error.NotAvailable" but solve the problem by buying a new obd which cost more, screen also worked ! – Margot Potemkine Sep 01 '23 at 15:31
0

SOLVED : Buying a new module did the trick, then screen worked and we could interact with the car

NB : "Failed to connect: org.bluez.Error.NotAvailable" remains but it is not a problem.