DerpTruck and The Struggle for EV Legitimacy

this chapter begins with the purchase of a

Chevy Volt Battery

some specs:


I bought it through LKQ for $2200 or about 13.5 cents per watt-hour.  That is an absurd amount of dough to drop on a used car… part.  This battery now comprises a large fraction of my net worth.  It was the least expensive vaguely reasonably sized lithium EV pack from a large production volume vehicle.

In hindsight I overpaid by a few hundred dollars.  The same battery seems to be valued between $1700 and $2000.  The process was pretty straightforward:  I found the part I wanted online, called the phone number attached to it, then spoke with a rep.  They email an invoice, then you pay and pick it up at one of their warehouses.

On their website they distinguish between “Battery” and “Battery w/ Modules”.  The “Modules” tack an extra $200 on to the price.  I called a rep to ask what these “Modules” were.  I was told “it's the thing on the front of the battery.  It usually goes bad before the battery does so that's why you can buy it separately.”

I opted to buy the “modules” with the battery.  The “modules” turn out to be a Pretty Important Box that has contactors, fuses, and logic stuff in it.


This was marked “2015” online, had a tag on it that said it was out of a 2014 Volt, and had manufacturing markings on it from March of 2013.

I chose the Chevy Volt pack in particular because it is the most abundant car-size lithium battery at the time of writing.  The Nissan Leaf and Fiat 500e batteries were also top contenders, but I didn't see either for a good price near me.  Unlike the Volt pack, both have a higher energy density and lack active heating/cooling systems.  High production volume electric vehicles have only really been a thing for the past few years and the top selling model changes frequently.  I'm certain that my battery purchase will soon be as lolworthy as someone spending $2k on a PC in the 90s.

further Chevy Volt battery reading and resources:

turning it on

there's a good amount of volt pack teardown knowledge out there already, so I only took the cover off to have a peek inside.  here's a picture straight from GM:

opened Chevy Volt battery

What I didn't find right away was information on how to use the pack as-is, without breaking it down into modules.

Here's what the business end of the pack looks like:

annotated battery

Fortunately, a copy of the Opel Ampera (European branding of Chevy Volt) service manual is available online.  In there, I found the pinouts and schematics that show how to close the contactors.  Thank You, Internet.

Shown here are the pinouts for the grey and black Molex connectors.

battery<em>black</em>molex battery<em>grey</em>molex

This schematic was useful for figuring out how to make the pack precharge the Prius inverter's bus capacitor.


GM was so kind as to give the OEM part number for those Molex connectors.  I bought the mating connectors ($2.50 each) and some pins on Mouser and made my own wiring harness.


On the other end of that harness is a little protoboard mess that I put together.


The board contains four indicator LEDs and quad-output gate driver being used as a level shifter.  This circuit ties into the few remaining microcontroller GPIOs (configured as outputs here) through the same DB9 cable that goes to the throttle switch and potentiometer.

The four LEDs correspond to four input pins on the battery module.  they control all the things needed to safely precharge the bus.  Those things are three contactors and a transistor.



HVB2+  aka “Multifunction Contactor”

Precharge Transistor

First HVB1- and HVB2+ are closed.  Pack negative is connected to the inverter through HVB1-, and pack positive remains unconnected because the precharge transistor is not turned on.  Next, the precharge transistor is turned on.  My controller watches bus voltage during this time.  If the bus voltage reaches approximately pack voltage in a short time, then HVB1+ is closed and HVB2+ and the precharge transistor are opened.  If the bus voltage doesn't reach pack voltage in a short time, the controller opens all of the contactors and lights up the FAULT LED.  This might be caused by a short circuit in the DC bus wiring, or excessive load on the bus during startup.

battery schema_3

This is the cable that connects the battery to the inverter inside a Chevy Volt.  I bought it on ebay for $40.  the connectors are the same on both ends.


I learned that a sharp axe makes a really good cable cutter for this thick copper, much better than a hacksaw or small snips.


The sheathing is connected to chassis ground on both ends of the cable.  I'm not sure why they did that.  The current coming and going from the battery should be mostly DC, so I don't see the need for shielding for the sake of EMI suppression.

edit – Andrew H. comments:

The shielding around the cables is there to trigger the LOI detection system in the event that a well-meaning fireman sawzalls through a battery cable that’s still energized.


I crimped the Chevy Volt battery connector on to the heavy copper cable that goes under the cab and into the engine compartment.  I used the original copper cables after inspecting them for damage.  I slit open a length of black rubber garden hose and used it as sheathing for the cables.


I advocate for thick and abrasion resistant wiring insulation in shady HV battery work like this.

Speaking of shady HV battery work, I kept this process of battery integration slow and deliberate to reduce the chances of breaking parts or myself.  Most modern electric cars have pack voltages around 300-400VDC.  That is some serious voltage with real injuring and killing power.

Many modern electric vehicles have a LOI system that constantly measures the resistance between the HV conductors and the chassis.  The system will very quickly disconnect the battery if it detects a loss of isolation.  My truck is too old for that, so I made the battery cable insulation very thick

Here, I am figuring out how to close the contactors properly.


And here's the first battery-powered test drive.  Are we eco yet?

maybe we are eco, but as is often the case with eco-things, we are also extremely derpy.  Not long after this test, the inverter stopped working.  Perhaps unrelatedly, the main contactors on the battery fused shut.  diagnosis of both problems learning events is below:

Finally Destroying Part of the Prius Brick

I thought it was unkillable.  It's got builtin overcurrent protection, It survived all the “R&D” that created derpbike, and it was pressed into duty as a welder without ever quitting.

but I seem to have found a weakness.  I was driving around the yard and lost all power while accelerating.  A reboot didn't help.  I figured a phase was shot, so I swapped the motor wire from V to W, updated the firmware, and limped back to the base.

I measured all of the resistances and flyback diode drops of the six IGBTs in the motor side inverter.  Here's what I found:


The multimeter revealed that the low side switch on the V leg failed short.  Unfortunately, that reduced the functionality of that leg to either doing nothing, or shorting the bus.

well 2 should be better than 1, right?  In a gruesome surgery, I amputated the dead leg and spliced the remaining two together.


but wait a minute.  why did that leg die without tripping overcurrent protection, and how will I not do the same thing again?

here's what I think is going on:

2 states

The half bridge has two states.  In state 1, the motor is connected across B+ and B- through the top switch.  Current flow through the motor is increasing.  di/dt is positive.  In state 2, the motor is disconnected from B+ and current flow decreases, recirculating through the flyback diode of the low side switch.  di/dt is negative.

At 50% duty cycle, motor current over time probably looks something like this:


At 20% duty cycle, it may look more like this:


Because the old brushed motor in this truck never really wants more than about 120VDC, the duty cycle never goes higher than about 30%.  The half bridge always spends more time in state 2 than it does in state 1.  Given a duty cycle of 20%, the low side switch will be conducting 4x longer than the high side switch over a single switching cycle.  Operating at such a low duty cycle puts disproportionate thermal stress on the low side switch.

The half bridges of the Prius inverter were not designed for prolonged operation at constant extreme duty cycle.  The electric motor/generators in a Prius are three phase permanent magnet synchronous machines (PMSM).  The only time you have this killer condition is when the motor is stalled.  Any time it is rotating, the six switches share the load evenly.  Even when the brushed DC motor in DerpTruck is rotating, the majority of the thermal load is still on that low side flyback diode.

with these findings, I reconfigured the remaining two legs as an H-bridge.


Now, both PWMs are centered at 50%.  To make the motor spin, the duty cycles are drawn apart to put a voltage across the motor.  This spreads load more evenly between the upper and lower switches.  The code looks like this:


10 more miles on the odometer and no bridge detonation yet!  but unfortunately…

the contactors are welded shut

Just after the first .._-**street legal**-_.. test drive around the neighborhood, I made the unnerving discovery that the bus voltage wasn't falling when the vehicle was completely turned off.  This meant either the bleeder resistor failed open, or the pack contactors weren't opening.  Hoping for the former, I grabbed some plastic tweezers and donned safety glasses and rubber gloves to carefully drop a bleeder resistor across the bus bars inside the prius inverter.  No change.


I pulled the service disconnect and the bus voltage fell.  It was time to tear apart the battery pack's face.

DSC<em>9931 DSC</em>9932 DSC<em>9933 DSC</em>9935 DSC_9936

The Chevy Volt battery has been contracted out at at least two levels below GM.  The cells and BMS were designed and supplied by LG Chem.  Above them in the chain is a company called Lear.  Lear designed and manufactured the battery housing including the cooling loop and contactor assembly.  Lear also manufactures the battery charger for this car.

In the image below, the black box is made by LG.  The injection molded plastic and die cast aluminum assembly is made by Lear.

DSC<em>9937 DSC</em>9938 DSC_9939

Getting sidetracked, I traced all three CAN buses back to the Freescale chip on this board.  I'm still not sure what the solid state relays and big capacitors at the bottom are for.



Right, contactors.  I continuity tested them and found that they had indeed failed short.  However, they still made clicking noises like they normally do when they open and close.  I managed to free the B- contactor by turning it on and off a bunch of times with the battery to the left.  The B+ contactor wouldn't open.


I looked up the part number for replacements and found them listed on Mouser for $343.60  lol, nope.

Fortunately, there are enough people out there taking apart these battery packs that the same contactors go for $20 each on ebay.  I bought three, just in case.  I believe that these came from Chevy Volt battery packs.  However, the same contactor is also used in at least one generation of Nissan Leaf battery.


Left: partially torn apart, possibly welded contactor.  Right: used, working contactor.IMG_1790

The contacts are hermetically sealed in this contactor.  I cut open the housing with an abrasive wheel.

IMG<em>1791 IMG</em>1793

the terminals were pitted, but by no means destroyed.  Dang.  It's too bad the whole thing is toast.


I replaced the sad B+ contactor and revised the code that drives the precharge routine to have more nonzero delays.

Before reassembling the pack, I tried some


let it be known: I Am a Bus Sniffer.  Here's what a bit of CAN looks like on the scope:


below is a battery-face connector pinout diagram.  All of the frequently updated CAN messages are on pins 1 and 3 of the black connector (called CAN H and CAN L in the service manual).  The duplicate 12V and GND lines on the grey connector are not connected internally, although the service manual indicates that the mating wiring harness does join them.  Pins 1 and 10 need 12V and GND for CAN to start broadcasting.  Pins 5 and 9 need 12V and GND for the precharge to work.



I bought a sparkfun CAN shield for $25.  A github user Latonita wrote some really excellent software to make this hardware into a standard serial-CAN interface.  THANKS!  The workingness of this hardware/software combo cured my longtime aversion and skepticism toward CAN.

Such serial-CAN interfaces are supported by instances of CAN analysis software like CANhacker.  Shown below are some frames that the battery broadcasts.


by spamming or “fuzzing” the CAN bus (i.e. sending a bunch of high priority garbage messages), I was able to get the battery to send out a few more messages with different IDs.

while stomping on the accelerator, I observed that some of the messages corresponded to battery current.  Excellent!  I logged those messages, converted the hex values to decimal, and plotted the frames.

unknown hex stuff

There is more figuring to be done here.  I need to calibrate the scaling.  Some values change erratically.    I wrapped everything back up and stuck the new menagerie of circuits to a piece of plywood.


I connected the arduino/sparkfun-CANbus-thing-stack to the mbed via some open serial lines for future sciencing and charge controlling.

with the ship operational once more, I set to hauling ass.


I fastened that shell down real good after leaving it behind that one time.

is it rechargable batery?

it's 2016 and for some reason batteries still need to be recharged.  The first attempts at charging were made with a variac going through a voltage doubling rectifier onto the high voltage bus.



That worked OK, but I wanted to try charging through the built in boost converter.  The Prius inverter has two DC buses in it.  In a 2nd gen Prius, the low voltage bus “VL” is connected to the ~200V NiMH battery.  VL is connected to the high voltage bus “VH” through that half bridge brick + inductor that together make a boost converter.

here's a throwback schematic of what a stock gen2 prius inverter looks like inside:


For an ideal boost converter where inductor current never falls to zero:


where D is the duty cycle.   I set D in software to 0.6 and it makes VL about 2.5x smaller than VH.


so when VH is 360V, VL is down around 144V.

I plugged it all in and nothing popped and it worked about the same as before, except the input voltage could be lower for the same charging rate.  However, I couldn't get either topology to draw more than about 600W.  This was perplexing.  After staring at things for a few minutes, I brought out the scope.  The scene is nightmarish: high voltage, extension cords, wet carpet and lacking galvanic isolation.  Enough to make UL shit themselves.  I floated the scope to avoid awkwardness when measuring rectified wall voltage.  Slow and Deliberate! One hand only! Don't touch it while it's live!

Everything Seemed Legit, until I measured here:


and found hella ripple.  This voltage doubler doesn't work so great when the output capacitance is small in proportion to the load current.  the scope is set to approximately 100V/div.


I connected more capacitors in series and they ate up some of that ripple.



Now at least we can trip the breaker.


now battery powered with a mean-time-to-failure of about 30 minutes, Derptruck's vehicle classification acronym has leveled up from NOPEV to UCRAP: Used Carparts Require Attention Please

Next up?