You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue with connecting to an OBD-II reader on macOS using the python-OBD library. I have followed the documentation and attempted to establish a Bluetooth connection, but I'm unable to retrieve any data from the OBD-II device.
When trying to connect using a specific baud rate(38400)
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/tty.OBDII']
[obd.obd] Attempting to use port: /dev/tty.OBDII
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII BAUD=38400 PROTOCOL=auto
[obd.elm327] write: b'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] Failed to read port
[obd.elm327] read: b'\x00\x00\x00\x00'
[obd.elm327] write: b'ATE0\r'
[obd.elm327] Failed to read port
[obd.elm327] read: b'\x00\x00\x00\x00\x00'
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r'
[obd.elm327] ATE0 did not return 'OK'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
When not specifying baud rate:
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/tty.OBDII']
[obd.obd] Attempting to use port: /dev/tty.OBDII
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b'\x00\x00\x00'
[obd.elm327] Response from baud 9600: b'\x00\x00\x00'
[obd.elm327] Response from baud 230400: b'\x00\x00\x00'
[obd.elm327] Response from baud 115200: b'\x00\x00\x00'
[obd.elm327] Response from baud 57600: b'\x00\x00\x00'
[obd.elm327] Response from baud 19200: b'\x00\x00\x00'
[obd.elm327] Failed to choose baud
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r'
[obd.elm327] Failed to set baudrate
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
I have tried setting a delay but however this has not resolved the issue.
I am able to successfully connect to the obd2 device via terminal using the screen function and I am able to send and receive commands.
I have also tried using just the pySerial library to communicate with the chip and was successful. Using this script
# Create a serial connection
ser = serial.Serial(port, baudrate, timeout=timeout)
# Check if the serial port is open
if not ser.is_open:
ser.open()
# Define a list of commands
commands = [
'ATZ\r',
"010d\r",
]
# Send commands and receive responses
for command in commands:
ser.write(command.encode())
time.sleep(1)
response = ser.readline()
print(response)
# Close the serial connection
ser.close()
Enviroment:
OBDII ELM327 v1.5
MacOS 12.1 Montery
Python 3.11
python-OBD v0.7.1
I am encountering an issue with connecting to an OBD-II reader on macOS using the
python-OBD
library. I have followed the documentation and attempted to establish a Bluetooth connection, but I'm unable to retrieve any data from the OBD-II device.When trying to connect using a specific baud rate(38400)
When not specifying baud rate:
I have tried setting a delay but however this has not resolved the issue.
I am able to successfully connect to the obd2 device via terminal using the screen function and I am able to send and receive commands.
I have also tried using just the pySerial library to communicate with the chip and was successful. Using this script
Output:
It seems like this is a problem with the library not being able to send or receive data from the chip via MacOS.
Does anyone have any idea on why this is the case and any possible fixes?
Note: This might also be a problem with OBDII v1.5 as I have not tested it with OBDII v2.1
The text was updated successfully, but these errors were encountered: