Wednesday, September 19, 2018

2011 Chevy Volt Bus systems

Last week I bought a 2011 Chevy Volt.  Was wanting an EV and after comparing the used EV's on the market we went with the Volt.  I've owned cars for about 30 years and this is the FIRST GM car I've ever owned.  I've done a bit of GM bus work for engine swaps (I did own a GM LS1 V8 but I put it in a BMW).  But now I'm a bit more interested in how things work.  In looking for bus diagrams I was having some difficulty.  And I found 2 OBDII ports in my car.  After some time with a repair manual I drew up these diagrams.  Perhaps they will be helpful to someone.  They will be for me.



Expect the diagrams would also apply to the Opel Ampera

Tuesday, March 20, 2018

Arduino interface options for Class2Serial or J1850 VPW


A VPW transceiver would be the ideal interface.  But sadly the J1850 VPW spec is not being used in any large production products anymore.  And all the transceivers are obsoleted.  At least I couldn't find one for sale.  Looks like we are all left with making our own interface.

In the previous post I discussed a method for receiving the VPW signal using a voltage divider and how one might go about selecting the best resistance.  But there is more than one way to setp down the voltage of the VPW signal to match the Arduino.  In this post I'll discuss several methods that might be used.  But the voltage divider is very simple and seems to work quite well.

For transmitting there are also several choices.  The VPW output from GM ECU was measured to be about 7.1V.  to make a signal with the same voltage we will need to step up the Arduino pulse signal.  But wait.  As shown in the previous post the high trigger voltage spec for VPW is 4.25V.  The Arduino can output this voltage.  And the Arduino output is a square wave so where it is measured on the pulse won't matter.  Something as simple as a diode between the Arduino output pin and the VPW line could even work.   But other more sophisticated methods utilize optocouplers or MOSFET's and comparators.  Like always there is more than one way to solve a problem.

But let's take a step back.  When I first wanted to connect the VPW to the Arduino I didn't find many choices.  One popular way was with the ELM327.  I obtained an ELM327 clone and connected it to the Arduino (this video was done with an ELM327 clone between the VPW bus and the Arduino).  While it did work it was limiting in many ways.  I wanted a less filtered access to the bus.

More searching found this example: http://www.nerdkits.com/videos/obdii/
Their circuit uses an optocoupler for both input and and output.  They reference another project which uses a voltage divider for receive and transistors for send.  And the ELM327 suggested circuit also uses divider/transistor setup.

The Nerdkits also has some code posted for capturing the VPW pulses.  This is more along the lines of what I was looking for.  But as usual this code didn't compile on our setup and had some limitations.  But it was a good starting point.  We reworked the code to suit our application.  More about the software later.  For now back to the circuit design.

More to come on this topic Later.  Out of time to type.

Monday, March 19, 2018

Class2Serial or J1850 VPW Pulse Measuring

 Capturing a VPW Class2 Serial pulse


In attempting to make an Arduino interface I found a few interesting things.  Perhaps these are obvious to many others but for me they weren't.  The first thing to know is that the Pulse from the GM ECU (at least an older LS1 style ECU) is NOT square.

Above is a trace of an Oscilloscope reading I took of the actual Class2Serial output signal from a GM ECU.  Note that the pulse is not square.  It looks more like a symmetrical saw tooth that's been truncated.  This is important to know.  Because in non-square waves where the voltage the pulse is measured at will provide different pulse lengths.
On this graph I put an orange line down low.  If measuring the pulse widths here you can see the widths would not be per the specifications.   See the lines I've added to the first pulse. In VPW the up AND down pulses are measured.  That means that if not measuring at the mid point, the pulse going up will not measure the same length as the pulse coming down.  This will give 2 different pulse widths measured for the physically same pulse width.  On the diagram above I've added lines and labels to two short pulses.  If measured at the orange line it produces two very different pulse widths for the same width pulse.  One being up and the other being down.

  
The graph above is showing timer values of a data stream from an ECU as captured by an Arduino mega.  Notice the double peak of times.  This is due to not measuring the times at the mid point of the wave.  

The upper limit for J1850 spec VPW is 4.25V and the Lower is 3.50V.    To get rid of the double peak we need the upper and lower limits of the VPW spec to equal the upper and lower limits for the Arduino triggers.  Reading the Arduino spec sheets it appears that the Arduino upper and lower trigger points should be 3.0V and 1.5V respectively.  Measuring an Arduino mega using digital read we measured the upper and lower limits to be 2.18V and 2.16V.  Interesting.  We then tested again using interrupts.  Interrupts is how we normally capture the wave.  This resulted in 2.15 V upper and 2.12 lower.  Specs are great but I'll go with the actual measurements.

Since we plan to capture the pulse using interrupts we will use the upper and lower voltages for that.  We want to get the VPW trigger voltages down to the Arduino trigger voltages. 
Or in other words:
4.25V --> 2.15 V
3.50V --> 2.12 V

A simple voltage divider could do this for us.  Using a 10K resistor for the first resistor (from the high voltage side) the 2nd resistor would be 10.2K and 15.3K:
4.25V --> 2.15 V -->10.2K
3.50V --> 2.12 V -->15.3K
Having a separate circuit for both the up pulse and down pulse would be possible but is likely not needed.  We could just average the 2 resistors.  This gives us 12.7 K.   Alternatively we could take the mid point voltage of the VPW (3.875V) and Arduno (2.135V) that gives is 12.25 K
 4.25V --> 2.15 V -->10.2K
3.875V --> 2.135 V -->12.25K
 3.50V --> 2.12 V -->15.3K

Theory is great and all but how does this all work out in real life?  Below is a graph of the timings vs various resistors.  10K being the first resistor in the voltage divider.  Then the resistor listed on the graph as the second.
 
The 22K resistor has a distinct double peak.  the 13k, 12k and 11k results are all basically on top of each other.  This all appears to match up closely with the theoretical.  

In reality we started with the actual results and then worked backwards to explain why the 13k-11k resistor worked the best.  Either way I suggest using 10k-12K voltage divider.  So far it appears to work very well.  If using a device with different toggle voltages recalculate in a similar manner what the resistor for those voltages should be.