python-OBD icon indicating copy to clipboard operation
python-OBD copied to clipboard

Cannot connect to car without debug mode

Open michaelhku2002 opened this issue 5 years ago • 1 comments

Hi!

I'm now facing a problem when developing project for getting OBD data and camera stream from the car and then sending back to server through 4G mobile communication. When enabling the debug mode, the OBD can get protocol and then the values of RPM and speed can be obtained, but the video capture cannot be got properly and then sent back to server. Then I tried to disable the debug mode of OBD, but it always said that the car cannot be connected and thus, no protocol can be retrieved. So is there any workaround for this? My program code is here for reference. Thanks!

import obd

obd.logger.setLevel(obd.logging.DEBUG)
ports=obd.scan_serial()
print("port for bluetooth OBD={}".format(ports))
connection=obd.OBD(portstr=ports[0],baudrate=115200,fast=False,timeout=60)
#connection=obd.OBD(portstr='/dev/rfcomm0',baudrate=115200,fast=False,timeout=60)
print("connection.status()={}".format(connection.status()))
print("protocol name={}".format(connection.protocol_name()))

resp_rpm=connection.query(obd.commands.RPM,force=True)
print("resp_rpm: {}".format(resp_rpm.value.magnitude))
resp_speed=connection.query(obd.commands.SPEED,force=True)
print("resp_speed: {}".format(resp_speed.value.magnitude))

michaelhku2002 avatar Apr 02 '20 04:04 michaelhku2002

It sounds like a timing issue with your Bluetooth adaptor

alistair23 avatar Jul 21 '20 18:07 alistair23