Decoding J1850 VPW signal

They go by many names, P01, P10, P12, P59, E38, VPW, '0411 etc.
Post Reply
User avatar
weinerschizel
Posts: 4
Joined: Wed Jul 26, 2023 1:01 pm

Decoding J1850 VPW signal

Post by weinerschizel »

Anybody have code from a microcontroller (and or circuit design) to decode J1850 VPW? I assume most elegant design is actually whatever the manufacturer uses... Has anybody reverse engineered that? Been searching it out but haven't found a solution I like. Most of the designs I've found purchase a stand alone preprogrammed microcontroller to do the decoding. Then that preprogrammed microcontroller is a black box with UART interface to computer system / software. I want to decode the signal with a microcontroller of my choosing though...

Forgive me if this is already posted. I searched the web and the forum here and good solution has eluded me. I see there's a few dedicated processors / microcontrollers for decoding OBDII data. Basically they program a PIC variant so it will operate using the ELM / J2534 interface (I'm not 100% sure of my nomenclature yet - industry standard OBDII interface).

I've currently got a P01 PCM hooked up to a power supply and can probe the J1850 data line. Signal is pretty straight forward. I'm feeding that signal into an ESP32 development board... and tripping an interrupt for a decoder routine (have to write decoder routine yet). However, my idea is to come up with a slick way that's not literally polling the line and calculating time periods for the pulses. There's got to be a better way, as that would be a waste of resources.

Backstory: I am assuming / think, there would be a signal from the radio head unit for player controls when AUX input is selected. I see there's a class 2 data line on head unit and want to see what data's coming out / to that. I need to get ahold of the player control signal (without opening the head unit up itself). System is a 2001 Chevy Tahoe. I'm designing a aftermarket Bluetooth interface where those player signals would be really helpful. Either way I want to develop some libraries for embedded controllers to decode OBDII data starting with J1850 VPW if not already done. Would be nice to have a built in bluetooth OBDII / J1850 adapter so I could read codes without having to constantly plug in the stupid dongle.
Saleman by day hacker by night
MS CENG 2006
An engineer who escaped corporate lab
ironduke
Posts: 695
Joined: Thu Feb 13, 2020 11:32 pm
cars: Mainly GM trucks, a Cruze and an Equinox for dailys..

Re: Decoding J1850 VPW signal

Post by ironduke »

It's been years since I've messed with it, I used code from Michael Wolf, he wrote up some c or c++ code to mimic the elm322 using an atmega chip, I screwed around with it and got it working on an arduino, trying to find even my notes is not looking good.

Below is a couple files I found. One of them I think is just mimicking the elm322 and the other polls for coolant temp once a second. At one point I had one reading coolant temp, a/c request and vehicle speed and would turn on the cooling fans as needed for my 2004 S10 but I haven't found any further work. VPW is documented fairly well as far as timings and such if I remember right. It's not real easy and I haven't touched in arduino in a long time so no ideas if I'd even be able to help.
works_recieve.7z
(7.45 KiB) Downloaded 268 times
sketch_oct07a.7z
(4.27 KiB) Downloaded 242 times
sketch_oct14b.7z
(3.75 KiB) Downloaded 244 times
// Found some of my fan control code. no idea if this is a working version or not.

I'm not 100% positive but I believe this is with the atmega connected Directly to the vpw pin 2. The VPW schematics I had found and used did work but I found thru trial and error that the atmega could run it directly. Supposed to be higher voltage than 5 volts to talk but found out that it still works. I did have to reverse the output in the code for the communication pin. I don't remember which pin is which but the receive pin stayed the same and it was the transmit pin I reversed the output in the code. doing this directly is probably very iffy but I know it worked, lol.. Could probably do it with 1 pin but the code had 2 pins with the schematic so I was trying things and ran with it.

Did some googling and actually had a few posts hear already viewtopic.php?t=3456&start=60

Well damn.. Wonder how well documented this library is? https://www.arduino.cc/reference/en/lib ... r-library/
User avatar
weinerschizel
Posts: 4
Joined: Wed Jul 26, 2023 1:01 pm

Re: Decoding J1850 VPW signal

Post by weinerschizel »

Wow super cool! Thanks for sharing. I'll look through this. Yesterday I spent several hours and got something going but then realized the bits were variable width *duh* so need to rewrite it. Will be awesome to see how you did it there. No worries on platform. Fiddled with most of them over the years.
Saleman by day hacker by night
MS CENG 2006
An engineer who escaped corporate lab
User avatar
antus
Site Admin
Posts: 8999
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: Decoding J1850 VPW signal

Post by antus »

There is another implementation for the open hardware allpro adapter in C here https://github.com/abhishekoct18/allpro ... dapter/obd

If you just want decode on a common arduino there is a project here: https://github.com/LegacyNsfw/ArduinoVpw
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
weinerschizel
Posts: 4
Joined: Wed Jul 26, 2023 1:01 pm

Re: Decoding J1850 VPW signal

Post by weinerschizel »

AWESOME thanks @antus.
Saleman by day hacker by night
MS CENG 2006
An engineer who escaped corporate lab
Post Reply