# So you want to build a motor controller, huh?



## Tesseract (Sep 27, 2008)

Part 2

*A Primer on Switching Power*

A quick review of the terms might be in order. First is that frequency and switching speed are not the same thing. Frequency is how often the switches switch; switching speed is how fast each transition is. The faster the switching speed the better... up to a point. There are some huge costs to fast switching, most importantly, the voltage spikes from stray inductances. The equation V=L*(dI/dt); where dI/dt is how fast the current flowing through a circuit is changing, usually in A/uS; L is inductance, usually in uH so it will cancel out nicely with the uS in dI/dt; and, V, the spike produced in volts. Let's say, for example, that we have a hypothetical motor controller rated for 2000A (a Zilla Z2K, perhaps) and that in order to keep heatsink size reasonable we set our switching speed to 100nS. This results in a dI/dt of 20,000A/uS. Ok, now let's say that inside this controller the bank of IGBTs needed to switch this much current is 10" long from the first one to the last one. With careful construction technique we can reduce the inductance of a buss bar-augmented PC board (PCB) to 10nH/inch, thus our 10" long bank will have a total inductance of 100nH or 0.1uH. Multiple everything and you end up with a voltage spike of 2kV every time the IGBTs switch! Clearly, something has to be done to address this spike or else the bank of IGBTs _will fail the very first time they switch!_ That something is usually a snubber, as there is only so much you can slow down the switching before power losses from overlapping voltage and current become untenable. In a later post I will go over the design of such a snubber but for now suffice it to say that if you want to switch more than 10A or so you pretty much need to use a snubber. In some cases you can get away with a "Tranzorb" - the brand name for a ruggedized zener diode - but in general at this power level you need to use an RCD snubber (some discussion of such is in the thread on the KDH12600 controller).

The next mistake I see most often is to not isolate the control circuit from the power switching circuit. Even if the switch is ground-referred, e.g. - the IGBT in a boost chopper, you still need to isolate the power and control (often called "signal") sides from each other because, as shown above, the tremendous currents switched in a dc motor controller produce equally tremendous voltage spikes. Even when those voltage spikes are tamed with a snubber it still produces a lot of noise that will then be coupled back to the control side. The easiest/most practical way to separate the two is with an optocoupler (OC). Pulse transformers can theoretically be used but it takes some real trickery to get them to transfer the full 0-100% range of pulse width that you want in a DC motor controller - they are best left to switching power supply applications only. One of the most important specs for OCs in this application is their Common Mode Rejection, given in dV/dt, usually kV/uS. This tells you how fast you can switch your IGBTs for a given supply voltage without the signal coupling back to your control circuit through the optocoupler _despite the physical separation it provides between each side!_ In general, if an OC doesn't have a CMR spec then it is not suitable for this application. At any rate, a CMR spec of 10kV/uS is usually more than sufficient for motor controllers up to 200V/1000A switching in 100nS.

Finally, there is the current required from the gate drive circuit to both charge the gate of the IGBT (either in a module or a bank of them) to turn it on and discharge the gate turn it off. The average power required is very low, true, but it is not unusual to need the gate drive circuit to provide peak currents of 4-15A for IGBTs in this power range. Folks, the output straight from a 555 timer (~100mA) ain't gonna cut it! For simplicity and reliability I recommend using a dedicated gate driver chip such as the TC4420 (non-inverting) or the TC4429 (inverting - best to use with a phototransistor output OC such as a 6N135). To figure out just how much punch your gate driver will need look for the spec "total gate charge", _Qg_, on the IGBT's datasheet and divide it by the transition time in nS. The answer will be in amps - it's as easy as that. For example, a modern 150A IGBT module might have a Qg of 700nC; if you want to switch it in 200nS that will require your gate driver to both source and sink a peak current of 3.5A. A TC4420/9 will work admirably here. You set the peak current, btw, with the series gate resistor. If your gate driver supply voltage (isolated, of course) is 15V and you need to deliver 3.5A peak then the gate resistor should be... I'm not putting the answer here because, frankly, if you can't answer this yourself you have no business making your own controller! Seriously, this is not rocket science, to be sure, but you at least need to have some level of understanding of Ohm's Law!

End Part 2


----------



## major (Apr 4, 2008)

Tesseract said:


> {See the picture "tesseract-1.png" for the boost configuration.}


Hi Tesseract,

Thanks for sharing. But the diagram does not look like a "boost" configuration to me. Looks like the old chopper, buck converter, assuming capacitor and source were connected to MOT+ and -.

Regards,

major


----------



## Tesseract (Sep 27, 2008)

As far as manufacturers of modules go it is the boost configuration. See, for example, the Microsemi website:

http://www.microsemi.com/catalog/pa...0&P1_Voltage1=600&P2_PMType=PMIGBT&P3_CONF=47

Not to harp on this too much, but as I mentioned in the post it does not matter what order the switch and diode are in, per se, as either configuration can be used to PWM the motor current. It only matters that the motor be connected in parallel with the diode (freewheeling diode, that is).


----------



## major (Apr 4, 2008)

Tesseract said:


> It only matters that the motor be connected in parallel with the diode (freewheeling diode, that is).


 











Buck Converter











Boost Converter


Hi Tesseract,

Boost converters have the load connected in series with the diode.

Regards,

major


----------



## Tesseract (Sep 27, 2008)

major said:


> Hi Tesseract,
> 
> Boost converters have the load connected in series with the diode.
> 
> ...



You do realize we are talking about a 1-quadrant motor controller and so _it will never be operated in the boost configuration (regen) in an electric vehicle!_ I referred to it as a "boost chopper" module because that is how semi manufacturers describe it; if you want to argue the semantics of this then take it up with those folks, not me.

That said, the attached picture shows how both the "boost" and "buck" configuration modules are wired up as a motor controller.


----------



## ga2500ev (Apr 20, 2008)

I just wanted to offer my sincere thanks for this thread. I feel enlightned just by reading it.

ga2500ev


----------



## major (Apr 4, 2008)

Tesseract said:


> I referred to it as a "boost chopper" module because that is how semi manufacturers describe it; if you want to argue the semantics of this then take it up with those folks, not me.


Hey, I know what's goin' on. But it was not real clear, especially to those not well schooled in the art. Now you have clarified it. Thanks.

major


----------



## ga2500ev (Apr 20, 2008)

Tesseract,

In you initial post you cautioned against certain types of IGBT modules because the switching speed was inadequate. Can you point to a sample EBAY auction or website that has a suitable module.

The PowerEX CM600HA-24H 1200V/600A module is ubiquitous on Ebay. Does it pass muster? What parameter on the data sheet should be checked to see if it has sufficient speed for switching? There is a section on resistive load switching times parameterized at 600V/600A. Turn-on/Turn-off delay and rise and fall times are all under 700 ns. So in theory the part should be able to be switched close to the 1 Mhz range, which is several orders of magnitude above any requirements for an EV controller. But what effect does switching an inductive load have upon those parameters?

Thanks,

ga2500ev


----------



## ga2500ev (Apr 20, 2008)

I have a request for the next post in this totally awesome thread:

Can you discuss the specifications for the freewheeling diode. Also can you talk about the impact of the integrated diode that the IGBT modules have?

Again my sincere thanks. In fact, here's a virtual beer for you.

ga2500ev


----------



## Nielmo (Oct 13, 2008)

If you have any experience with H-bridges you may help with some small brain-grinders I have.

When PWM regulating should I turn both transistors off, or is better to just switch the hi or the low side?

When changing polarity on the load is there anything else to consider besides making a slight delay before turning on the other side of the bridge?


----------



## Tesseract (Sep 27, 2008)

ga2500ev said:


> http://www.diyelectriccar.com/forums/../member.php?u=3694
> The PowerEX CM600HA-24H 1200V/600A module is ubiquitous on Ebay. Does it pass muster? What parameter on the data sheet should be checked to see if it has sufficient speed for switching? There is a section on resistive load switching times parameterized at 600V/600A. Turn-on/Turn-off delay and rise and fall times are all under 700 ns. So in theory the part should be able to be switched close to the 1 Mhz range, which is several orders of magnitude above any requirements for an EV controller. But what effect does switching an inductive load have upon those parameters?


Good questions... accurate answers are somewhat complicated; at risk of being called on the carpet unnecessarily yet again I'll go ahead and shorten them. In reverse order, then:

An inductive load does have a significant effect on the switching loss calculation but it does not alter the time it takes the IGBT to switch. Oddly enough, it's a lot easier to calculate the loss switching an inductive load compared to a resistive one... Go figure. The relevant equation for such is:

P_loss_ = V_max_*I_max_*F_s_*T_cross_*10^-6

Where P is in watts; V is in volts; I is in amps; F is in kHz; T is either the rise or fall time in nS. 

E.g. - 150V, 600A, 16kHz, 300nS transition time = 432W

***

Switch that module at 1MHz? Not even close! Add all of the times together on the datasheet: 300nS + 700nS + 450nS + 350nS = 1.8uS. This is the absolute shortest time for one cycle for this device. 1/1.8uS = 555kHz, but even at this best speed it won't be able to reproduce a square wave - more like a trapezoid. the turn on and turn off delay times indicate that there is quite a bit of internal inductance in the bondwires inside the module - the price you pay for convenience!

Furthermore, the minimum "on time" is the rise time + turn-off delay time + fall time, or 1.5uS in this case. That means the minimum duty cycle you could command at 16kHz is approx. 2.4% That sounds terrible but it actually is not even remotely relevant. With a 120V battery pack a buck converter operating at 2.4% will deliver all of 2.88V to the motor. That probably isn't enough to get it to overcome bearing and brush friction... (note to the hypercritical - some simplification was used here).

Bottom line: at 16kHz it's fine. Buy a second just to use as a freewheeling diode (although the FWD is a bit fast given the maximum speed of the IGBT).


----------



## Nielmo (Oct 13, 2008)

major said:


> Hi Tesseract,
> 
> Boost converters have the load connected in series with the diode.
> 
> ...


This is tricky stuff. Tesseracts schematic has no "load" and the motor takes the place of the "coil". That is why it is called boost.

I hope that was perfectly clear.


----------



## ngrimm (Oct 19, 2007)

Hello Tesseract. One of the things I have a question about is the power and voltage requirement of the FWDs. My impression is that they only need to match the maximum voltage, the continuous amperage, and operating speed of of the mosfets. Am I close?


----------



## Tesseract (Sep 27, 2008)

Nielmo - Designing *reliable* high power H-bridges is difficult and the answers to your questions are strongly situation-dependent. Send me a PM to clarify what you are getting at.

ngrimm - With respect to FWD selection, two other important parameters are forward voltage drop, Vf, and "softness". The latter is arguably *the* most important parameter as it indicates whether a diode changes states abruptly or gradually. The softer the diode, the more linear the graph of current flowing through it over time will be when it changes from blocking to conducting or vice-versa. A "snappy" or "hard" diode's same graph will look more "s"-shaped, that is, most of the change will occur in a very brief time even though the "total" recovery time is the same. Snappy diodes stress everything else in the system except, maybe, the buss bars (if used). There usually isn't a speed penalty for designing a diode to recover softly, but if given a choice between snappy and fast or slower and soft I'd generally choose the latter. If that choice is not available or other parameters are otherwise not optimal then you may have to put a snubber across the FWD.

At any rate, the FWD experiences the exact same conditions as the switch, just at opposite times in the cycle, so it should be sized accordingly.


----------



## noubal (Aug 25, 2009)

Hi Tesserect.
Very good explanation. Please continue.

BTW: What IGBT is used in Zilla 1kV and 2kV ?


----------



## yarross (Jan 7, 2009)

noubal said:


> BTW: What IGBT is used in Zilla 1kV and 2kV ?


Probably not 
I think 600V modules should be sufficient for 144V up to 310V. 1k and 2k in Zilla's name denotes amperes.


----------



## JRoque (Mar 9, 2010)

Wow, excellent thread! Why did it stop? Anyone looking into making their own 3 phase controller?

JR


----------



## Salty9 (Jul 13, 2009)

Some people are:

http://sourceforge.net/apps/mediawiki/tumanako/index.php?title=Main_Page

http://etischer.com/awdev/

I am working on developing a controller for an alternator but the full-size controllers are at least an order of magnitude harder.


----------



## piotrsko (Dec 9, 2007)

JRoque said:


> Wow, excellent thread! Why did it stop?
> JR


my $.02:
I am guessing that Tessaract got annoyed after being "flamed" constantly and got too busy DIY'ing his Solitron.

He's still around looking at the site and giving really good info. FWIW, Pretty much him and Major, Eitscher, dmitri, QER and perhaps a couple of others are worth stopping to read the replies.


----------



## JRoque (Mar 9, 2010)

I hear ya. That's too bad since disagreement and discussion is healthy as long as it's kept with respect. Not sure why but on other similar forums like cnczone.com, while there's always a rotten apple or two, most everyone is very helpful and holds off posting until they have something to constructive to say.

I see from the links above and following your list of forum members that there are a few 3PH controllers in the works. I like Eitscher's idea of using a COTS VFD with external IGBTs with current transformer feedback. I wonder how he controls regen voltage levels. I understand that decelerating while carrying a load (ie: car) is pretty much what it takes to get your motor act as a generator. But slamming on the brakes - and assuming he has proportional regeneration - would spike up the voltage to potentially dangerous level for the batteries. Maybe his VFD reads that voltage and applies regen proportionally so it doesn't go over a certain level. In that case, I hope his brake pedal continues past regen and into mechanical braking.

JR


----------



## piotrsko (Dec 9, 2007)

Not sure if anybody is that elegant on regen yet. Tesseract feels regen is a zero sum gain, and I haven't seen any evidence on this site that regen is being used for stuff other than long constant speed downhill runs. I could be wrong.

OTOH, find a thread about 3ph and feel free to ask a gadzillion questions. A lot of people here are really decent and super smart.


----------



## etischer (Jun 16, 2008)

I use the brake light to trigger regen braking. 

At or below 330V I allow 50% regen torque. Between 330V and 340V I linearly taper down to zero regen torque to prevent damage from over voltage. Before I had this limiting feature, I could quite easily hit 350V by accident and fault out the drive. 

I limit regen torque to 50%, this is up to 100A at full rpm. 150% regen is my max, but I have never tried it! The braking torque and coasting torque are settable via my keypad. 

I also have a synchromesh mode where the motor will regen while Im in neutral until the next gear is synchronized, then the motor will coast allowing me to shift very quickly. 





JRoque said:


> But slamming on the brakes - and assuming he has proportional regeneration - would spike up the voltage to potentially dangerous level for the batteries. Maybe his VFD reads that voltage and applies regen proportionally so it doesn't go over a certain level. In that case, I hope his brake pedal continues past regen and into mechanical braking.
> 
> JR


----------



## JRoque (Mar 9, 2010)

Ok etischer thanks. I gathered from your postings and website that you used a standard VFD and added external IGBTs (to increase current handling) and current sensors. Not that this is an easy task but it seems easier and lower cost than building your own from scratch or buying it done. 

I've read that you were planing to sell your design but then desisted as someone else was coming up with a new controller. If you are at liberty to do so, would you mind giving more technical details on your design? Where did you tap the external IGBTs and current sensors? Where are you injecting the DC bus, and doesn't your VFD care that there's 0 frequency on it's "AC" input?

Thanks,
JR


----------



## etischer (Jun 16, 2008)

Most inverters allow you to disable "phase loss trips". 

For now, I've decided the added liablity and time commitment of building/selling/supporting inveters is not the path I want to go down right now. 



JRoque said:


> Ok etischer thanks. I gathered from your postings and website that you used a standard VFD and added external IGBTs (to increase current handling) and current sensors. Not that this is an easy task but it seems easier and lower cost than building your own from scratch or buying it done.
> 
> I've read that you were planing to sell your design but then desisted as someone else was coming up with a new controller. If you are at liberty to do so, would you mind giving more technical details on your design? Where did you tap the external IGBTs and current sensors? Where are you injecting the DC bus, and doesn't your VFD care that there's 0 frequency on it's "AC" input?
> 
> ...


----------

