Search code examples
pythonobd-ii

OBD-ii python library not finding obd adapter


Trying to connect to my OBD-ii adapter using python (adapter : ELM327 OBD2 Adapter)

python version:3.10.11 obd library version:0.7.2 pyserial library version:3.5

import obd
print(obd.OBD())

returns:

[obd.obd] Cannot load commands: No connection to car
<obd.obd.OBD object at 0x0000028FB216BBB0> 

Car is on and ignition is in - Forscan - another piece of software is reading from the port and when I use pyserial I can see the port is available but can't read from it


Solution

  • The OBD library cannot see any OBD adapter - however, if you open the device manager - find which COM the USB adapter is on and point to that port using the below code on connection - the script will work

    connection = obd.Async("COM5")