Kartroller 6: The Blitz

Poor LOLrioKart.

LOLrioKart in a forest of scooter handlebars

After being totally whored out for CPW by giving rides to prefrosh and generally being hooned around campus, I remounted the kart sound system to use as a portable music device and all-around pimpmobile for Mini-Maker Faire the weekend after. But thirty minutes before departing for the Faire, I powered the kart on.

Nothing happened.

It wasn’t a spectacular explosion. It wasn’t even a smoke column or a quiet sizzling sound. Through a half hour of diagnostics, I only managed to deduce that the gate driver stopped driving the gate. The power FETs appeared to be fine. Whatever – we were late already, so I just pushed the kart a mile or so to the Cambridge Public Library where the event was being held, blasting bad eurodance and girl pop along the way.

Afterwards, I decided to just remake the controller, yet again. The latest iteration, version 5, did work, but was haphazardly put together (i.e. pretty par for the course). I wanted something that had more structure than a bundle of wires. I also wanted to keep advancing on the number of features and simplifying the schematic. This resulted in the great gate driver hunt of 2010, out of which the IR2184s came.

As described, the existing controller core is kind of a kludge. It was just an Arduino with a protoboard shoved onto it which had the gate drive componentry. Alongside was a 12v DC/DC converter. Everything was just packed inside a little box with foam bits, and not otherwise secured.

Running the controls in open air for half an hour to diagnose the latest failure resulted in me discovering that the DC/DC converter got hot. Way hot – hot enough for it to shut itself off, which explained alot of kart flakiness.

So I did what any shady college engineer would do given a totally rigged and quasi-functioning project – rip everything the hell apart.

I dismounted everything and took the mounting board out of the kart.

The big black slick in the righthand corner is from grease and oil being thrown upon it by the drive chain.

Let’s begin again. We start with an epic heatsink:

I found this in the materials cave at MITERS. There are a few reasons why I wanted an Epic Heatsink, the foremost of which is epicness.

The other reason is modularity. At 300 x 200mm, this heat sink had enough area on its back to mount practically all the core componentry. I wanted to move away from point-to-point hardwiring onto something a little more modular, like a commercial controller.

Mechanical issue: Only one side of the heatsink had space for mounting holes or other provisions. The other seems to have been trimmed off by someone else.

It just so happened that removing the bent fin would open up a width on that side of the heat sink equal to the width of the flange on the other.

…so that’s what I did. Remembering a trick someone showed me a while ago, I slammed the heatsink on the mill and cut down the bent fin.

The 3/4″ rod fits into the 5/8″ T-slot on a Bridgeport mill table and provides a straight edge to bump a long part against, for axial trueness without resorting to hammer bashing and a dial indicator. Normally the rod should be precisoin ground or otherwise some length standard, but in this case, “precision” meant “closest one to me that qualified for diameter”.

With the edge cut down but no holes drilled yet, I started laying out the components. There were a few iterations – this is the first. The FETs would be centrally located so one fan can blow on the back of the heatsink to cool them. The Arduino would sit right next to the gate pins.

But that was before I found these cool double capacitor holders, which allowed me to pack on more bus capacitance than the kart currently had (2400uF to 3900uF) and keep it on the heatsink mount. Of course, caps like this don’t need heatsinking themselves, but the mounting surface was there.

Through more cramming, I decided to also move the contactor onboard, such that the unit was essentially self-contained. Other parts of the power system, like the battery cutoff switch, terminal blocks, and power connector, would remain offboard.

I took a quick break and laid out the parts. The heatsink itself already had quite a few holes drilled in it from its previous, more legitimate application, but sadly none of them lined up. Thus, it was back to the mill to drill the mounting holes, which was a rather boring half hour of trying to match a digital readout with a hole chart.

Some screws and washers later, and the pieces are mounted. The contactor is case-grounded, and my intention was to keep the heatsink itself isolated. So, it’s secured by large nylon screws and insulative washers.  The Arduino and capacitor block are mounted with nylon standoffs.

The DC/DC converter has an isolated case, so it was bolted straight to the heatsink. It will probably be alot happier this way. It, and the two Ixys gigaFETs, got a liberal coating of Arctic Silver thermal compound on the bottom.

Here’s the new driver board. It’s another Arduino-perfboard assembly that houses two IR21844 dual gate drivers. Unlike Kartroller 5, the high sides are bootstrapped, not supplied via isolated regulator. I decided this was a good simplicity tradeoff.  Additionally, it’s much more failsafe – the boostrapped high side can’t maintain 100% duty cycle, so it can never get stuck on like the low side drive can.

The wiring nest on the underside, in typical me-fashion. I’m using some cool 30 gauge solid tinned wire that has very unique insulation properties. It doesn’t smoke or burn when it contacts a soldering tip, but rather just melts out of the way. It’s very thin and easily damaged.

But those same properties let me just mash the wire into the solder joint with the tip and it will automagically fuse with the solder ball that’s already present. This has enabled me to just go pin-to-pin and link up an entire net very quickly.

I think it’s wire-wrapping wire, but I’m not sure. What is it and where can I  get more?! MITERS is almost out!

Check out the integrated signal terminal block. I even labeled it so I don’t forget which wire goes where!

Most low power wiring joined. Notice the small 5mm power plug coming out of the DC/DC converter and into the Arduino. I figured it was better than soldering directly to the input pins…

Here’s the gate wiring from the Arduino shield to the FETs. Gate resistors are integrated into the heatshrunk portion of each cable end. I really should have local pulldown resistors too, but elected to keep those on the shield.

The rightmost gate wire got red shrink because I ran out of black.

I began to add other signal interfacing hardware to the shield at this point. First to be completed is the contactor detector. It’s a wire (the red one) connected to the contactor (through a resistor divider) which enables the software to see whether or not the contactor is latched. One of the problems with Kartroller 5 is that it just let me (or someone) gun the throttle even with the contactor was in the precharge state.

This just caused the controller side voltage to fall under 36 volts, resetting the DC/DC converter, thus shutting the logic off. In turn, the FETs turned off, causing the voltage to rise again, which… well, it led to an unhappy cycle of kart-twitching until I reached for the battery switch.

The next few lengths of wire connect the Arduino to the important I/O – throttle, brake, and reverse.

With all the signal side wiring done, I could start on the software. Here’s a makeshift user interface with a throttle pot, a brake pot, and a reverse switch.

Read more “Kartroller 6: The Blitz”

Gate Driving your Way to Victory

As previously illustrated on this site, LOLrioKart’s motor controller is one big lesson in power electronics that I’m learning as I build it (…and blow it up…and rebuild it). While I must admit that it’s frustrating to have a controller that never really works, and which just sits on the metastable edge between functional and explosive, it’s a valuable learning experience to figure out exactly how to steer this edge towards the functional and reliable side.

You know, like finding out that your oscilloscope inputs are grounded so you absolutely shouldn’t probe a floating ground with it because it’ll dead short your power supply through itself and everything else in the path. Many times.

I found out that’s reason #1 why Segfault’s dual custom H-bridges all exploded. Live and learn, I suppose.

Cross-conduction

Another dominant cause of power amplifier failure is shoot-through, or cross conduction. In your average half-bridge circuit, the worst thing that can happen is your top and bottom side switches on the same leg being turned on at once. That usually results in very high pulsed current draw from the power supply, then…

Alright, so it’s not that bad. But shoot-through will generally blow fuses, melt wires, or destroy an output component (in the worst case causing it to fail short) if you‘re not a pussy don’t use fuses like me.  3 phase block commutation generally avoids this shoot-through phenomenon because it ensures the top and bottom sides of one phase are never switched consecutively.

However, DC motor drivers do not have that luxury, because there is essentially only one phase to switch. Therefore, whether in software or through hardware, provisions are generally made for shoot-through protection. It usually takes the form of a section of delay-circuitry, combinatory logic, a delay state in software, or if you’re Shane, driving optocouplers in inverse-parallel because they form a convenient delay circuit already.

During the times I have experimented with full-bridge or half bridge DC motor drivers, I’ve generally used a variant of the delay circuit presented in 6.131, the same one that is documented on Segfault’s progress report post. It takes a while to make, is nonintuitive, and more complex than it needs to be, taking up 5 of 6 inverters in a 7414 hex inverter.

For a little while I’ve been searching for a FET driver chip that has this function built in. After some digging on Digikey and places like FindChips, I found the IR21844.

Like the Ixys IX6R11P7 chips I favor now, it has a standard low side driver and an isolated, bootstrappable high side. The difference between the 2184(4) and the 6R11 is the input. The 6R11 takes two individual inputs, one high and once low. They do not affect eachother, and you could build in a self-destruct mode for your controller if you wanted because it can command both switches to turn on at once.

The IR21844, however, takes a single input and splits it internally into an inverted and noninverted output. So that means if your input is logical low, then the low side is on and high side is off – and vice versa. Not only that, but it also has internal shoot-through protection (IR calls it “deadtime”). Even better is that the 21844 variant allows you to tune the deadtime to the taste of your favorite mutant semiconductors.

It basically tells me that I wasted a year fumbling with this crap when someone already made something I can just buy – like everything else in life. The 21844 comes in 8 and 14 pin DIP through-hole components (+1) as well as SOIC (ewww… but handy if I ever come out of the course VI closet). And so, I gave a few quarters to the Internet semiconductor gumball machine for some units to experiment with.

Here’s the test circuit I rigged together using the schematic found in IR’s datasheet. I’m reading the two outputs using two channels of the MITERscope. The input is a 50% duty cycle square wave, 5Vpp and 10Khz. The single potentiometer is a 100Kohm unit that I’m using for deadtime adjustment.

See? I wasn’t lying. One input to the 21844 is split into two complementary outputs.

This scope screenshot is actually a little deceiving. The vertical scale is 5 volts per division and the zero levels are located on the X axis (channel 1) and 2 major divisions down (channel 2). What looks like the two square waves not meeting in the center is actually them overlapping. I should have used a wider division setting.

What’s really interesting – and what sold me on these – is the built-in deadtime.

Check this zoomed shot of the above square waves. What you see is an approx. 1us delay between when the low side turns off (channel 1 high to low) and the high side turns on (channel 2 low to high).

This is good. This break-before-make behavior ensures that your +V and GND rails never see eachother in the middle.

Even better is the fact that it does the exact opposite thing on the other side. On a low-to-high transition of the output, the high side turns off before the low side turns on again. Again, break before make. This proves that one output isn’t just a time delayed version of the other, it’s legitimately being trimmed to fit neatly into the other.

One implication of this is that the high side will completely shut off at a point before 0% input duty cycle. This seems to be inherent in the nature of delay stages and I conjecture is part of the reason why control deadbands exist. Complementary to this, the low side will completely shut off at a point before 100%, which must be considered if your drive circuitry is bootstrapped on the high side i.e. does not have its own isolated power supply at all times.

The deadtime adjustment is internally grounded on the 2184 but brought out to a pin on the 21844 variant. You connect it to ground through a variable resistance of your choice – datasheet page 10 gives a rundown on deadtime vs. resistance.

As advertised, the deadtime is adjustable from about 400ns (0 ohms)…

…To roughly 2.5us when my 100Kohm pot was pegged. The 21844 appears to support deadtimes of up to 5 microseconds.

Indeed, when I just straight yanked the pot out of the circuit, all the output shut off. I suppose an infinite deadtime is just like being permanently off.

With this in mind, I went ahead and made a little buck converter just like I did in 6.131. I used two IRF2807 FETs that I had leftover, running in bootstrapped high side mode. It was still running on the 50/50 square wave input. Will it work? Will everything explode?!

Well, what happened first was that I shorted the high side through the scope probe, killing half of the 21844.

Sad.

That’s why I bought a rail of 30.

But then it worked! On the (real) first try, even! That is, well enough to totally smoke a power resistor of too small value while I wasn’t watching.

hey guys i made a power electronic widget that worked on the first try do i win a prize do i do i do i

The next stage was to replace the resistor with something more meaningful. Something that actually does some useful work besides making a small smoke column… I mean, it can do that too, but it should be designed to do otherwise.

I have an idea – let’s try a DC motor!

HO REGEN BRAKING YAY

I probably played with this thing for half an hour – just gunning the motor, then quickly dropping the duty cycle and watching the power supply’s voltage spike up. This half bridge circuit brings me one step closer to a 4 quadrant synchronous regenerative drive for LOLrioKart, and who knows what else. To add the other two quadrants, I just need to make another half-bridge and connect the motor up between them.

Speaking of LOLrioKart, can these little driver chips actually handle semiconductors the size of those I have an excessive amount of? One way to find out is to try driving the gate. This is an IXYS VMM65001F, good to 100 volts (same as a Swapfet) and 680 amps, which is at least three Swapfets. This is a bigger transistor than LOLrioKart can ever hope to push. Just because of that, it’s a good example to test the 2184s on.

Also because it is a convenient half-bridge module, and two of them will easily make an oversized H-bridge for said LOLrioKart.

I drove the gigaFET using the bootstrapped high side.

It took a full 1.7us to turn on, where I defined turn-on as the gate voltage reaching approx. 67% of the drive voltage. There are many ways of defining “turn-on”, this is just one of them.You can even see a little bit of the “Miller Plateau“.

This is not bad given that the on period is very long compared to the switching period. During this switch is when the FET acts like a resistor, dissipating power. LOLrioKart’s PWM runs at 4Khz, which is a half-period of .125 milliseconds, still about 70 times longer than a switching cycle. Not the best, but most likely better than anything else I have on the kart at this moment.

And the turnoff occurs a little faster, since the gate voltage only has to reach 4 volts before it falls under the threshold voltage. The turnoff itself is mostly clean.

So where does that leave me? I now have a method of switching a half-bridge in an orderly manner, without external glue circuitry. I also happen to have enough large semiconductors to make a 600 amp peak capacity H-bridge. I have this dumb shopping cart with a motor on it.

Will there be a kartroller version 6?!