brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.06k stars 369 forks source link

Unable to connect via Bluetooth on OSX #182

Closed chainhead closed 4 years ago

chainhead commented 4 years ago

I enabled debug as described in #10 to connect my Macbook to OBDII dongle via Bluetooth. Any suggestions why am I not able to connect?

import obd
obd.logger.setLevel(obd.logging.DEBUG)
connection = obd.OBD("/dev/tty.OBDII-Port",baudrate=460800)
cmd = obd.commands.RPM
response = connection.query(cmd)
print(response.value)
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII-Port BAUD=460800 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] write: 'ATE0\r'
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] closing port
[obd.elm327] write: 'ATZ\r'
[obd.elm327] ATE0 did not return 'OK'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
[obd.obd] Query failed, no connection available
None
Hanlon2222 commented 4 years ago

It may be the baud rate. What kind of bluetooth OBDII dongle are you using? ELM327? If so i believe the baud rate i used for mine was 38400.

chainhead commented 4 years ago

Yes, it is ELM327 as seen in the debug log above. I even tried with sudo python2.

alistair23 commented 4 years ago

Can you check connecting to the device with screen or some serial program? It looks like the device isn't connected.