Page 1 of 1

Bare Metal Elm327 (OBD2) Interaction

Posted: Fri Aug 14, 2020 1:48 pm
by Edd98
Hi guys,

The next hurdle of my project is to read data from my vehicle using an OBD2 > ELM327 > USB cable. Since this is the only usb device that the Pi will interact with, I assume I don’t need a full usb driver, but I can’t seem to find a huge amount of information on getting this single device to work!

I know that the Pi 4 has all of its usb ports connected to a single chip but I can’t find much information about the chip i.e. it’s address etc.

Has anyone got any experience with this sort of thing?

Thanks in advance

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Fri Aug 14, 2020 2:06 pm
by trejan
Getting USB working isn't easy. You're still going to need a full USB stack, a driver for the USB controller and a driver for the USB to serial chip. If you're using a Pi 4 then you're also going to have to deal with the PCIe controller as well.

If you want simple then modify your ELM327 cable and break the connection between the ELM327 and the USB to serial chip. You can then wire the ELM327 to the Pi UART which is significantly easier to deal with. You will need to check voltages as most of the ELM327 chips run from 5V which is not compatible with the Pi GPIOs.

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Sun Aug 16, 2020 6:27 pm
by Edd98
trejan wrote:
Fri Aug 14, 2020 2:06 pm
Getting USB working isn't easy. You're still going to need a full USB stack, a driver for the USB controller and a driver for the USB to serial chip. If you're using a Pi 4 then you're also going to have to deal with the PCIe controller as well.

If you want simple then modify your ELM327 cable and break the connection between the ELM327 and the USB to serial chip. You can then wire the ELM327 to the Pi UART which is significantly easier to deal with. You will need to check voltages as most of the ELM327 chips run from 5V which is not compatible with the Pi GPIOs.
That sounds like a good idea! Never thought about that! Does the chip not receive power from the vehicle?

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Mon Aug 17, 2020 2:46 am
by cleverca22
you also have products like https://www.sparkfun.com/products/9555 and https://www.sparkfun.com/products/10087

note that the DB-9 port is not serial but OBD2, the 2nd item is just a dumb pin adapter
and the serial side of the board, is 5v level, you need to get a 5v<->3.3v level shifter for the serial comms

then you dont have to modify anything, or you could just use this schematic as an example of how your modifications would fit into the existing board

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Mon Aug 17, 2020 8:59 pm
by Edd98
cleverca22 wrote:
Mon Aug 17, 2020 2:46 am
you also have products like https://www.sparkfun.com/products/9555 and https://www.sparkfun.com/products/10087

note that the DB-9 port is not serial but OBD2, the 2nd item is just a dumb pin adapter
and the serial side of the board, is 5v level, you need to get a 5v<->3.3v level shifter for the serial comms

then you dont have to modify anything, or you could just use this schematic as an example of how your modifications would fit into the existing board
They look interesting, although I was going to modify my existing cable as it was cheap and I won’t need it again!

I have dismantled it and removed the circuit board... Just need to locate where to intercept the signal before it goes to the usb! Any ideas? I think it’s a multi layer pcb!
D6028295-5BE8-4C11-B5A4-A34E0E333A7D.jpeg
D6028295-5BE8-4C11-B5A4-A34E0E333A7D.jpeg (108.99 KiB) Viewed 227 times
The blue circle is the connector for the obd2 and the green circle is the usb cable connector.
A56A7E2A-D9E0-4A65-BF29-A9AEE4801A2D.jpeg
A56A7E2A-D9E0-4A65-BF29-A9AEE4801A2D.jpeg (107.79 KiB) Viewed 227 times
^ The underside of the board.

However... my lcd (elecrow 5in) uses the top gpio pins for the touchscreen (not being used in my os), meaning that I cannot plug anything in to them... Are there any solutions other than soldering cables to the bottom of the gpio pins?

Thanks

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Mon Aug 17, 2020 9:28 pm
by cleverca22
U6 catches my eye, can you read the printing on the chip and see what it is?

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Mon Aug 17, 2020 9:53 pm
by Edd98
cleverca22 wrote:
Mon Aug 17, 2020 9:28 pm
U6 catches my eye, can you read the printing on the chip and see what it is?
Great spot!
Haven’t got the board with me but have found this image online:
158CFB41-8B12-4CEF-8A29-3A1D42F1866B.jpeg
158CFB41-8B12-4CEF-8A29-3A1D42F1866B.jpeg (51.23 KiB) Viewed 203 times
And upon closer inspection U6 seems to read “WCH ch3401”... (you may not be able to read it from that image though depending on the compression) which if I google seems to be a usb to serial chip!

Now... how to intercept it!!!

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Mon Aug 17, 2020 10:19 pm
by Edd98
My bad,
I think it reads WCH ch340T not 1! Will confirm though...
Upon reading the datasheet for the chip, it looks like pins 3 and 4 are the serial output and input!
So I take it these need to be connected to pins 8&10 on my Pi 4? I’d solder a cable between each but the pins on the usb>serial chip are tiny! And I still have the issue of the lcd blocking the gpio pins!
Then power etc is the next issue!

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Tue Aug 18, 2020 5:05 am
by cleverca22
Edd98 wrote:
Mon Aug 17, 2020 10:19 pm
My bad,
I think it reads WCH ch340T not 1! Will confirm though...
Upon reading the datasheet for the chip, it looks like pins 3 and 4 are the serial output and input!
So I take it these need to be connected to pins 8&10 on my Pi 4? I’d solder a cable between each but the pins on the usb>serial chip are tiny! And I still have the issue of the lcd blocking the gpio pins!
Then power etc is the next issue!
the 2nd fishy thing, is the 3rd header on the pcb
you have 1 for the OBD-2
you have 1 for USB
maybe the 3rd is plain serial??

toss an ohm meter on there, see if some of the pins are connected to 3/4 on the serial<->usb chip?

you would also want to remove the usb converter chip, since it would conflict when driving the pi->elm327 line

Re: Bare Metal Elm327 (OBD2) Interaction

Posted: Tue Aug 18, 2020 2:57 pm
by LdB
I imagine U6 is a TI CH340T and the missing U7 is a sillabs CP2102 those are common USB to UART and looks like they set the board up for either.

If I am right
On U6 pin 3 and 4 should be TX and RX on TSOP 20 package
On U7 pin 25 and pin 26 should be TX and RX on QF28 package

So look for the signals on the vacant U7 ...the pins 25 and 26 are slightly left of the U7 marking

If it's right the easy way is to simply desolder U6 and connect to the pin pads.