pyobd icon indicating copy to clipboard operation
pyobd copied to clipboard

How to debug first connection?

Open laurentbacall opened this issue 2 years ago • 8 comments

@barracuda-fsh, many thanks for maintaining and enhancing this cool piece of software. I just received a brand new Chinese ELM327 v1.5. It works just fine on Ubuntu 20.04 by using OBD commands with 'sudo screen /dev/ttyUSB0 38400': I was among others able to retrieve trouble codes. I can't get it to connect with pyobd with the below error messages. Where should I get started to debug the connection?

Thank you.

[obd.obd] No OBD-II adapters found [obd.obd] Cannot load commands: No connection to car [obd.obd] No OBD-II adapters found [obd.obd] Cannot load commands: No connection to car [obd.obd] No OBD-II adapters found [obd.obd] Cannot load commands: No connection to car [obd.obd] No OBD-II adapters found [obd.obd] Cannot load commands: No connection to car [obd.obd] No OBD-II adapters found [obd.obd] Cannot load commands: No connection to car

laurentbacall avatar Sep 18 '22 15:09 laurentbacall

1.) Did you try manually selecting the COM port? 2.) Is the obd adapter plugged into the cars port and the usb of the laptop and is ignition switched to ON? Some adapters don't power on until all these conditions are met. 3.) Other than that, it should work, I have no idea why it wouldn't. 4.) Maybe I tweaked the timings too much for some adapters. I would like to correct it if this is the case. 5.) Maybe you can also try manually selecting the baud rate. I don't remember if this is still possible at the latest version though. And I think there is a setting to select SLOW vs. FAST. Try all of that and let me know. Thanks.

barracuda-fsh avatar Sep 18 '22 16:09 barracuda-fsh

Thank you. COM port: I did not find an option for this. Only option in the user interface is 'Choose serial port: AUTO' Plugged-in and ignition ON: Yes, all three conditions where met when I tested. Timings tweaked too much? How would I detect if this is the issue? Baud rate and FAST/NORMAL: I patiently tried all possible combination of baud rates and FAST/NORMAL (14 combinations) to no avail.

Please let me know how I can test COM port and timings tweaking further.

laurentbacall avatar Sep 18 '22 19:09 laurentbacall

If you can't manually select the port, then the program does not detect the COM port. Hmmmm...... do you have any more debug information in command line or only this that you specified? I will check more on my side tomorrow.

barracuda-fsh avatar Sep 18 '22 19:09 barracuda-fsh

Sorry, no more information in terminal output. Happy to try and add any debug code that would help. Just let me know. Thank you.

laurentbacall avatar Sep 19 '22 04:09 laurentbacall

@barracuda-fsh, attempting some manual python3 obd commands, it seems to boil down to a permission issue. Any clue how to solve this one?


import obd obd.scan_serial() []



connection = obd.OBD("/dev/ttyUSB0") [obd.obd] ======================= python-OBD (v0.7.1) ======================= [obd.obd] Explicit port defined [obd.elm327] Initializing ELM327: PORT=/dev/ttyUSB0 BAUD=auto PROTOCOL=auto [obd.elm327] [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0' [obd.obd] Closing connection [obd.obd] Cannot load commands: No connection to car [obd.obd] ===================================================================


laurentbacall avatar Sep 20 '22 05:09 laurentbacall

(I tried adding myself to the linux group owning /dev/ttyUSB0 to no avail).

laurentbacall avatar Sep 20 '22 05:09 laurentbacall

It now works -- I needed to log out and back in again after adding myself to the group. Now need to re-try with a car connection. Will do this later today.

import obd obd.scan_serial() ['/dev/ttyUSB0'] connection = obd.OBD("/dev/ttyUSB0") Trying baud rate: 38400 Response from baud 38400: b'\x7f\x7f\r?\r\r>' Choosing baud rate 38400 [obd.elm327] Failed to read port [obd.elm327] ATE0 did not return 'OK' [obd.obd] Cannot load commands: No connection to car

laurentbacall avatar Sep 20 '22 05:09 laurentbacall

So to confirm, it now works fine when connected to the car. If you wish to update the README.md for linux users, here are the two things I needed to do differently to get it to work:

In the sudo apt install clause, I needed to replace libgstreamer-plugins-base1.0 with libgstreamer-plugins-base1.0-0.

And I needed to issue sudo usermod -a -G the-/dev/ttyUSB0-group myUserName so that I and python can access the serial connection

Thank you.

laurentbacall avatar Sep 20 '22 17:09 laurentbacall

Ok, thank you very much for providing feedback and finding the solution. I think this will help others too. I will add it to readme.md.

barracuda-fsh avatar Sep 22 '22 20:09 barracuda-fsh