Recent

Author Topic: OBD2 and ELM327  (Read 10961 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
OBD2 and ELM327
« on: December 12, 2021, 04:54:49 pm »
Anybody got any experience with an ELM327 (clone) interface talking to OBD2?

I've been trying to use PyObd to check out a classic Honda, so that I'm prepared for any problems. Unfortunately it doesn't have a blow-by-blow description of what it's trying to do and what's happening, and I /suspect/ that it's getting screwed by the fact that the car's diagnostic interface doesn't have an "ignition on" pin.

The interface is fairly well-documented https://www.elmelectronics.com/wp-content/uploads/2017/01/ELM327DS.pdf but I thought I'd ask about prior art before starting to roll my own.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #1 on: December 12, 2021, 05:45:50 pm »
Please give me some credit for doing my homework.

Pin 1 on the standard 16-pin interface is used by at least some manufacturers as a switched voltage, allowing the ELM327 (etc.) to monitor whether the ignition is on: see pp5 and 66 of the reference I provided, and note the PP 0E setting.

The Honda needs an adapter to go from the car's 3-pin connector to the standard one. That leaves the ignition detection unconnected and I suspect it floats or is pulled inactive, while the Python software is expecting it to be active. However there isn't enough diagnostic output to be certain.

It's a bit of a disappointment, since that software seems to be the preferred option for Linux. However getting it installed was a PITA: the Python interface to one of the required libraries took around two hours to build on a laptop.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: OBD2 and ELM327
« Reply #2 on: December 12, 2021, 10:05:58 pm »
I don't want to give you wrong impression. I had a problem a few years ago with a clone ELM327 where it would not communicate with one car.  It turned out was not connected to the bus pins of that car inside the dongle.

Which car exactly?
Which 3 pins?
What kind of connection your ELM327 clone supports. Wired, Bluetooth or wifi?
Since you have an adapter, did you try to communicate with the ELM327 itself, without the car, on its serial side? Like using its AT commands?

The same ELM327 worked on another car. Later I did a quick app to imitate that ELM to see the commands sent to it from an app that was able to read the transmission temperature.

This is mostly from my memory, I doubt it helps you here.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #3 on: December 12, 2021, 10:18:52 pm »
I don't want to give you wrong impression. I had a problem a few years ago with a clone ELM327 where it would not communicate with one car.  It turned out was not connected to the bus pins of that car inside the dongle.

Which car exactly?
Which 3 pins?
What kind of connection your ELM327 clone supports. Wired, Bluetooth or wifi?

Pins are 12V, ground, and one of the CAN (I presume the other end is grounded). Interface is USB (I don't /do/ wireless interfaces unless unavoidable).

Quote
Since you have an adapter, did you try to communicate with the ELM327 itself, without the car, on its serial side? Like using its AT commands?

Not yet, pending any responses from this thread. But the software and interface correctly recognise that the physical connection is made, and to get there requires that the ignition be on (otherwise there's no voltage on the CAN line)... it's just the explicit check for the ignition being on that's failing (hence my response to Jamie).

MarkMLl
« Last Edit: December 13, 2021, 10:44:52 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: OBD2 and ELM327
« Reply #4 on: December 12, 2021, 11:58:16 pm »
Anybody got any experience with an ELM327 (clone) interface talking to OBD2?
How about trying SocketCAN?  :D
https://duckduckgo.com/?q=ELM327+socketcan

Although I would personally skip ELM327 and talk to OBD2 via Pi or Beagle...
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #5 on: December 13, 2021, 09:31:19 am »
Can you share details of the 3 pin to obdii adapter, specifically which 3 pins are used on the obdii side?

Similar to https://www.ebay.co.uk/itm/223253817436

MarkMLl
« Last Edit: December 13, 2021, 10:53:48 am by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #6 on: December 13, 2021, 09:33:50 am »
Anybody got any experience with an ELM327 (clone) interface talking to OBD2?
How about trying SocketCAN?  :D
https://duckduckgo.com/?q=ELM327+socketcan

Although I would personally skip ELM327 and talk to OBD2 via Pi or Beagle...

Thanks, I'll take a look presently but I think my next step is to start playing with the AT codes directly. I was just trying to find out whether I was reinventing the wheel as far as Lazarus/FPC is concerned.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: OBD2 and ELM327
« Reply #7 on: December 13, 2021, 10:44:56 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #8 on: December 13, 2021, 04:51:28 pm »
I don't want this to turn into a car faultfinding thread, so I'll just report where I'm at and then go quiet until I've got something useful to say.

The error from the Python script is misleading. I've found how to get debugging output (there's no commandline option for this) and together with manual commands I can see that the software can see the interface and the interface can read a sensible voltage from the car (i.e. measuring the nominal 12V on the 3-pin connector, which varies slightly depending on the position of the ignition switch).

The software then tells the interface to automatically-select a protocol and sends an 0100 request which should be universally-implemented but gets no response even if the ignition is on and the engine is running. At that point it misleadingly reports

Code: [Select]
[obd.elm327] read: b'SEARCHING...\rUNABLE TO CONNECT\r\r>'
[obd.elm327] Failed to query protocol 0100: unable to connect
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car

Now that I've got some idea as to what's going on I'll investigate forcing a protocol and possibly various speeds manually (I'm fairly confident that OBD2 is supported, later investigation suggests that that last OBD year was '95), and might need to try the CAN interface I bought a few weeks ago... first step is to order some (Sumitomo?) connectors.

I'll report back if anything interesting comes up.

MarkMLl

https://python-obd.readthedocs.io/en/latest/Troubleshooting
« Last Edit: December 13, 2021, 08:28:48 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: OBD2 and ELM327
« Reply #9 on: December 14, 2021, 03:24:10 pm »
I'm fairly confident that OBD2 is supported, later investigation suggests that that last OBD year was '95
In USA OBD2 was used by Honda since 1996, but in other countries after 2002. For example, non-USA 1999 Honda S2000 had OBD1. Your ebay link also says that cable rewires OBD1 CAN to OBD2.

It seams that Honda cars that have OBD2 all have OBD2 connector:
https://pinoutguide.com/CarElectronics/honda_obd_2_pinout.shtml

Just in case, here is a project that converts Honda OBD1 to OBD2:
https://github.com/mr-sneezy/ArduinoHondaOBD1_to_OBD2_BT
« Last Edit: December 14, 2021, 03:29:25 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

MarkMLl

  • Hero Member
  • *****
  • Posts: 8551
Re: OBD2 and ELM327
« Reply #10 on: December 14, 2021, 03:49:21 pm »
Interestingly, pinouts.ru says that the data pin is K-Line rather than CAN... I initially assumed that was an error since the standby voltage didn't look quite right but there's also https://github.com/nattimmis/Honda-OBD

My suspicion is that OBD2 was supported from 1996 onwards but only on the 3-pin connector. Depending on the plant and market some Hondas started to get the 16-pin connector in '98, all had them by '02 and in '02 they also switched from K-Line to CAN for diagnostics. Which makes it dubious whether the adapter I've got would work with anything, unless of course the progression was different on bikes.

I'm putting this on ice until I've got some of the right connectors, then will take a look with an Arduino and 'scope or logic analyzer. It might turn out that rewiring the 16 -> 3 pin adapter will fix it to the point where an off-the-shelf USB (etc.) interface will work... in practice I'd probably make one from scratch since the one I've got has fully-moulded insulation and strain relief.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018