Giter Club home page Giter Club logo

Comments (14)

ulherz avatar ulherz commented on September 13, 2024 3

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.

sommersoft avatar sommersoft commented on September 13, 2024

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.

isonet avatar isonet commented on September 13, 2024

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.

andrewkouri avatar andrewkouri commented on September 13, 2024

+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.

 avatar commented on September 13, 2024

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.

jlmcgehee21 avatar jlmcgehee21 commented on September 13, 2024

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.

jlmcgehee21 avatar jlmcgehee21 commented on September 13, 2024

#97

from python-obd.

 avatar commented on September 13, 2024

@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.

avoca999 avatar avoca999 commented on September 13, 2024

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.

masudap avatar masudap commented on September 13, 2024

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:

  1. 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.

  2. 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.

apecone avatar apecone commented on September 13, 2024

Please take a look at #122 and see if this resolves your "failed to auto set baudrate" problem. Thanks :)

from python-obd.

alistair23 avatar alistair23 commented on September 13, 2024

I'm going to close this as fixed by #122. Please re-open if required.

from python-obd.

CC3301 avatar CC3301 commented on September 13, 2024

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.

vosamoilenko avatar vosamoilenko commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.