OBD Raspberry Pi bluetooth and serial issues

46 Views Asked by At

So I've been trying to get my digital dashboard code working and I have to connect to the OBD plug to the Pi but ive run into a plethora of issues since then. The first time I did it, the OBD device showed up in bluetoothctl, and then could be paired. I binded the device to a serial port with: "sudo rfcomm bind rfcomm0 " (it didn't return anything but im assuming it worked). After that I made the changes to the "sudo nano /etc/systemd/system/dbus-org.bluez.service": added two lines after execstart, and "sudo nano /etc/rc.local": line before exit 0.

Then when I went to run my code it returned a serial exception where it was like multiple devices connected, something like that. I tried to find a fix but couldn't so I restarted my pi. Now I go into bluetootchctl to connect and the device doesn't show up. Furthermore, I try to just pair to the Mac address but it says something like device has no usable services? To make it worse every time I restart my pi the bluetoothctl command returns waiting for bluetoothd. I've watched like twenty videos of people showing this process of setup, but it just keeps coming with an error on my end. Anyone know what to do?

My Pi has Pi OS 32 bit installed with 32gb memory and 8gb ram. Just got it a few days ago. This is about how much of the code goes through before the serial exception appears. Im quite sure that the error has to do with the connection line but I can't find anyway to solve it.

import obd
from pygame.locals import *
import pygame

pygame.init()
obd.logger.setLevel(obd.logging.DEBUG)
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)

connection = obd.Async("/dev/rfcomm0", protocol="6", baudrate="9600", fast=False, timeout = 30)

#Continuously query until the amount of supported commands is greater than 100
while len(connection.supported_commands) < 100:
    connection = obd.Async("/dev/rfcomm0", protocol="6", baudrate="9600", fast=False, timeout = 30)

Ive restarted the pi changed settings back and forth but nothing is working.

0

There are 0 best solutions below