Comments (14)
Hello,
I am new to this library and I am trying to connect to my car. I got this response, which I supposed was solved by #122 right? Am I understanding something wrong, or is this still a bug? Could not find anything helpfull yet.
Installed via pip and using two different obd interfaces, which are indeed on COM1 (COM3 resp.) with 9600 bps.
connection = obd.OBD() # auto connect
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['\.\COM1']
[obd.obd] Attempting to use port: .\COM1
[obd.elm327] Initializing ELM327: PORT=.\COM1 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b'\x7f\x7f\r'
[obd.elm327] Response from baud 9600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 230400: b'\x7f\x7f\r'
[obd.elm327] Response from baud 115200: b'\x7f\x7f\r'
[obd.elm327] Response from baud 57600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 19200: b'\x7f\x7f\r'
[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] ===================================================================
from python-obd.
Do you have full debug logging turned on? If not, add this obd.logger.setLevel(obd.logging.DEBUG) # enables all debug information
after import obd
. Then post the full logging result.
Also, the car must be turned to 'ACC ON' at minimum. This is what gave me baudrate failures when I first started using this.
from python-obd.
Hello, I'm having the same problem!
Here the debug output:
['/dev/tty.OBDII-SPP']
[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII-SPP BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b''
[obd.elm327] Response from baud 9600: b''
[obd.elm327] Response from baud 230400: b''
[obd.elm327] Response from baud 115200: b''
[obd.elm327] Response from baud 57600: b''
[obd.elm327] Response from baud 19200: b''
[obd.elm327] Failed to choose baud
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] Failed to set baudrate
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
No idea what's causing this, I think this is mac related. I would be happy to test any ideas you have!
from python-obd.
+1 on Mac OS 10.12.6
[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/tty.usbserial-A94R3PH9']
[obd.obd] Attempting to use port: /dev/tty.usbserial-A94R3PH9
[obd.elm327] Initializing ELM327: PORT=/dev/tty.usbserial-A94R3PH9 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b''
[obd.elm327] Response from baud 9600: b''
[obd.elm327] Response from baud 230400: b'\xe0'
[obd.elm327] Response from baud 115200: b'\xfc'
[obd.elm327] Response from baud 57600: b'\xff'
[obd.elm327] Response from baud 19200: b'\xff'
[obd.elm327] Failed to choose baud
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] Failed to set baudrate
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
from python-obd.
I've got a Bluetooth ODB adapter which I have successfully paired through mac OS Bluetooth settings.
When I run a test with debug level logging I get similar output as @isonet:
[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/tty.OBDII-SPP']
[obd.obd] Attempting to use port: /dev/tty.OBDII-SPP
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII-SPP BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b''
[obd.elm327] Response from baud 9600: b''
[obd.elm327] Response from baud 230400: b''
[obd.elm327] Response from baud 115200: b''
[obd.elm327] Response from baud 57600: b''
[obd.elm327] Response from baud 19200: b''
[obd.elm327] Failed to choose baud
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] Failed to set baudrate
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
During the execution I can see how the Bluetooth settings report the OBD adpater as connected.
When I try to manually set the port and baudrate (9600 or 115200) I get the same results:
[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII-SPP BAUD=115200 PROTOCOL=auto
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] wait: 1 seconds
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] write: b'ATE0\r\n'
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] ATE0 did not return 'OK'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
I can also see the Tx & Rx LEDs on the adapter light up at the begin of establishing the connection and just before the debug output reports No connection to car
. Tried a baudrate of 38200 as well since some bluetooth adapters seem to be limited to that.
from python-obd.
On OSX 10.12.6, and was seeing the same issue, but I've found that by increasing the timeout in the ELM327 class, I can get a good connection. I'll work on a PR to make it configurable.
from python-obd.
from python-obd.
@jlmcgehee21 out of interest, what value did work for you for the timeout? Am getting the same errors when using 0.1 (default value), 1 or 10 as values.
[obd.obd] ======================= python-OBD (v0.6.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=/dev/tty.OBDII-SPP BAUD=38400 PROTOCOL=auto
[obd.elm327] write: b'ATZ\r\n'
[obd.elm327] wait: 1 seconds
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] write: b'ATE0\r\n'
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] closing port
[obd.elm327] write: b'ATZ\r\n'
[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
I do however still see the Tx & Rx LEDs flicker on the ELM adapter when the line [obd.obd] Closing connection
comes up.
The other weird thing is that the adapter seems to work perfectly when used with Torque on an Android device.
from python-obd.
I'm having the same issue, and want to rule something out before I try and fiddle about.
I have a VAG COM 409.1 USB cable, described as compatible with OBD-II. Is this the same as an ELM327 adapter? It has a red light that goes on when plugged into the car, so something's happening in there, but I get the baud and 'no connection to car' messages as above.
Do I need something more sophisticated than this cable? I can't work it out!
from python-obd.
I had the same problem and came across this thread and also other. Here is a specific solution to solve this problem and may not work always, but for me it worked and i hope it might help others.
I solve the problem as described below in a windows 8.1 OS by the following two steps:
-
after pairing the the pc with the elm327, find out the blue tooth port number manually.
i.e If using Windows 8/10, navigate: Right-click Start > Control Panel > In the search box, enter "Bluetooth" then select Change Bluetooth settings. a new window will open and in there click the tab "COM ports". there u will see the listed COM ports and note down the one whose direction is outgoing. for example in my case it lists "COM21" and "COM22" with the names OBDII SPP and OBD respectively. and "COM21" was the outgoing one and this i need to use. -
modify the scan_serial() in in the file utils.py so that it will always return the desired port without scanning anything.
i modify the function scan_serial() as listed below, and in essence i commented out the scanning portion of the code and set the return values as result= ['COM21'] which i found in the previous step in case of my computer.
the location of the utils.py file in my case was: "C:\Users\your_name\AppData\Local\Programs\Python\Python36\Lib\site-packages\obd"
###############################################################
def scan_serial():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:returns:
A list of the serial ports available on the system
"""
if sys.platform.startswith('win'):
ports = ['COM%s' % (i + 1) for i in range(256)]
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
# this excludes your current terminal "/dev/tty"
ports = glob.glob('/dev/tty[A-Za-z]*')
elif sys.platform.startswith('darwin'):
ports = glob.glob('/dev/tty.*')
else:
raise EnvironmentError('Unsupported platform')
#result = []
result= ['COM21']
"""for port in ports:
try:
s = serial.Serial(port)
s.close()
result.append(port)
except (OSError, serial.SerialException):
pass
"""
return result
####################################################################
from python-obd.
Please take a look at #122 and see if this resolves your "failed to auto set baudrate" problem. Thanks :)
from python-obd.
I'm going to close this as fixed by #122. Please re-open if required.
from python-obd.
Hello,
I am new to this library and I am trying to connect to my car. I got this response, which I supposed was solved by #122 right? Am I understanding something wrong, or is this still a bug? Could not find anything helpfull yet.
Installed via pip and using two different obd interfaces, which are indeed on COM1 (COM3 resp.) with 9600 bps.connection = obd.OBD() # auto connect
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['.\COM1']
[obd.obd] Attempting to use port: .\COM1
[obd.elm327] Initializing ELM327: PORT=.\COM1 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b'\x7f\x7f\r'
[obd.elm327] Response from baud 9600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 230400: b'\x7f\x7f\r'
[obd.elm327] Response from baud 115200: b'\x7f\x7f\r'
[obd.elm327] Response from baud 57600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 19200: b'\x7f\x7f\r'
[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] ===================================================================
Having the same issue, setting timeouts didnt work either. I get the exact same responses for each baudrate. Could it be that not every adapter supports the baudrates which are tried?
from python-obd.
any updates on this topic?
I have same issue with raspberry pi
[obd.obd] ======================= python-OBD (v0.7.2) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/ttyUSB0']
[obd.obd] Attempting to use port: /dev/ttyUSB0
[obd.elm327] Initializing ELM327: PORT=/dev/ttyUSB0 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: b'\x7f\x7f\r'
[obd.elm327] Response from baud 9600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 230400: b'~~\x08'
[obd.elm327] Response from baud 115200: b'\x7f\x7f\r'
[obd.elm327] Response from baud 57600: b'\x7f\x7f\r'
[obd.elm327] Response from baud 19200: b'\x7f\x7f\r'
[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] ===================================================================
[obd.obd] Query failed, no connection available
None
from python-obd.
Related Issues (20)
- Clear specific Code HOT 1
- Dropping frame in multi-frame response not marked as FF or CF HOT 2
- Test of Mode-6 MIDS
- Some classes in the collections library are deprecated HOT 2
- Passing Through Raw Vehicle Response Info In Custom Commands HOT 1
- OBD Not Connecting MacOS
- b'0100': Supported PIDs [01-20] did not receive any acceptable messages HOT 3
- BUS INIT: STOPPED while trying to connect on Raspberry Pi HOT 6
- Add ID value to all STATUS-type messages
- Extended PIDs? HOT 2
- how to get the milage? HOT 2
- Value Returned Only on First Request - Then All Requests Lead to None.
- new 0.7.2 does not install due to pint version bug
- reading Odometer values HOT 5
- PID 34: 02 Sensor 1 WR Lambda Current - No Air-Fuel Equivalence
- Installing Packages in terminal HOT 1
- ATH1 did not return 'OK', or echoing is still ON
- Library not working with Bluetooth OBDs?
- Vehicle automation question - workflow idea HOT 4
- Import problem with Numpy2.0.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-obd.