Let's Make Robots!

BLDC motor controlling, the hard way

I am going through two processes now...

The first, is removing the spider webs from electronics capabilities of yesterday ; The second, is (during this process) controlling an HDD 3-phase BLDC motor with arduino.

Yes, I know I can simply use an ESC component and save myself the hassle of "figuring it all out", simply plugging in the speed controller to the motor 3 pins, 12V battery and simple signal from my microcontroller (arduino) to set the speed/direction .. and voilla. That's it.

BUT..where's the fun in that??

For the sake of learning the fine details of how a the phased motor is controlled, I rather "do it all" myself. Just rely on my Arduino for feeding the 3 phase lines through three PWM outputs with extra three digital outputs for indicating a "not connected" state (so to have 3 states: +,-,NC),, fed into 6 sets of gate drives and possibly going through another layer of driver... etc..

Basically, I am following http://www.jimfranklin.info/microchipdatasheets/00857a.pdf (see diagrams on pages 29, 30)

So from what I understand.. and I would LOVE your help in knowing where my below description is off:

1. each of the three phase lines (dubbed A, B and C) should be connected in one of three states: VCC, GND, NC ... Those states are set according to a 6 options, creating an always switching flow trough two coils in one direction of the other - info can be seen here: http://bldc.wikidot.com/p-esc-motor

2. cycles should be timed according to the position of the motor, which is referred to sensor enabled control that can be based on hall sensors.. OR can be based on back EMF.

BUT can also be sensorless, by just ignoring things and timing according to a certain preset you set for a desired speed. (less optimal, but should work quite well, especially with some tunning) 

3. The speed of the motor, and the torque will be set according to the voltage you feed as well as the timing/frequency of the cycle. Torque is also influenced by the right timing of the state switch.

4. protect the microcontroller by not having it connected directly to the motor, in any way or form. protect things from returning currents from the motor (as motors are "noisy")

Basically, that's it. Now, how is that done? Using which components? For this, I will describe my understanding of the digram in the referred PDF..

Again, corrections are highly appreciated, and actually sought after..

a. The 3 states generation: I have two options. I think..

a.1 : In this Here I am following the diagram on the PDF ::: My microcontroller will generate 3 voltages via PWM, as well as 3 high/low signals allowing switching between GND and NC. overall 6 signals. each pair controls a state of one of the 3 phase pins of the motor. The PWM will range between 255 (5V) and 0 (0V, which is equivalent to NC, depending on the electrical circuit). The second line will be used to basically control the switching between the NC state and GND(-) state. By using two gates (in this case: IRF5305 and IRLI3705, as described in figure B-1 on page 29), I can have a phase line connected either to ground or to the the voltage. Using PWM, that voltage is "basically" variable, ranging between my 12V and 0V. However, in this solution I am not sure why I need the TC4469, and not rely only on the IRF5305 and IRLI3705 gates only? Anyone has any idea? aren;t the gates alone, enough to isolate an arduino from the motor and 12V? Can't they be fed directly by C1,C4?

a.2. Instead of this, I can follow a different guide instead (see soon)  ::: I can use a L6234, connect all 6 arduino outputs described above, and skip the need for the TC4469, IRF5305 and IRLI3705, as its all included inside the IC. Right? Though, both where is the fun in that AND its hard (for me) to find L6234. Reading up on it, its basically a triple half-bridge driver. Right? SO, I COULD instead use any other triple half-H or even three seperate half-H ICs. Right??  [http://www.instructables.com/id/BLDC-Motor-Control-with-Arduino-salvaged-HD-motor/step8/The-Power-Electronics/]

How is a.2 different than a.1? Which approach is better? Which approach would isolate my arduino better? and ACTUALLY what is the point, at all, in these TC4469?

b. The positioning of the different capacitors is to protect the circuit from the engine's feedback. Right? When looking at the digram on page 29, I am left with 3 questions:

b.1. Why is the capacitor setup at the top-right of the diagram (where R19 and C6 are located) exist only on the A line? why not on B and C?

b.2. what is exactly that "floating" bit on the middle left, where C1 is connected from the 12V power to GND directly? Why is it not connected to the rest of the diagram? Or is it actually connected, only not specifically indicated as part of the rest of the diagram, since its basically just an "AC protection" of the ENTIRE 12V feed?

b.3. The three resistors R7,R8 and R9 are said (according to note (3)) to be there for controlling the rise/fall of the driver. Here, i'm assuming its for converting a square wave of the phased feeds to something more trapezoid like. However, I can't see how just a resistor would actualy modify the votage in such a way. I would expect that to happen because of a capacitor setup. Not because of a resistor. What am I missing?

 

 

Lastly, I want to sneak in another question I have very hard time finding a good answer for...

How can I find what OTHER components might replace an existing component in a given diagram.

For example, in the diagram I linked to and referred to, there are the MOSFET gates: IRF5305 and IRLI3705. However, if my local electronic store does not carry them.. how can I tell which OTHER equivalent components exist which I might use instead? (and how do I know what implications such a switch may have?).. for example, in case of capacitors (in DC digrams), it is almost always fine to replace a capacitor with a different one of higher capacity. Very rarely there is a potential disadvantage or negative implications to it. However, while its easy to do that, as most capacitors are basically 'the same", a specific IC like IRF5305 or IRLI3705 is (at least for me) totally not the same as all others. I am not even sure if IRLI3705 can be replaced by IRLI3705N....

 So how do I tell?

Would greatly appreciate any feedback, and would love to post updates about the progress of my process.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

So Zener protects the MOSFET from both forward and reverse overvoltage (as can be seen by its current-voltage characteristics [each zenner and its own] - http://upload.wikimedia.org/wikipedia/commons/thumb/0/07/V-a_characteristic_Zener_diode.svg/250px-V-a_characteristic_Zener_diode.svg.png). right?

Zener has higher voltage drop, which is actually good as it comes with a "bonus" of being able to deal better with overvoltage due to better heat dissipation? Correct?

Now, this is something I'm not sure about, as the reverse/forward is a little confusing... but I think I got it

The protection we are looking for, is in the case when the engine generates voltage which is situated between the MOSFET's drain and source (+12V)... that would try to flow from the engine to the the +12V source (as well as to the ground below, on the other [lower] MOSFET). That voltage will then flow through the diode on the irf5305 instead, right? That is, instead of trying to breach the MOSFET. And THIS protection is what we need. right? While it is a REVERSE flow for the MOSFET, its actually a FORWARD flow for the diode. In that sense, both Zener and Schottky are good, while Schottky switches faster (very important for us), but dissipates less heat (bad for us, but not important in this case). This protection is needed and valid only when the coils build more than 12V, because otherwise the difference in voltage is still not enough to try to flow through the MOSFET (as we have 12V on the other end).

How high (in practice) of a voltage can the engine (coil) generate? MUCH more than 12V?

The MOSFET forward protection is when the 12V source might spike might higher, and then instead of building over the MOSFET, between the source and draid, would reverse-flow through the diode, and directly to the coils(which would be bad! right?).. BUT this one is something we don't really need to protect from, since its not likely that our source will surge much above 12V. right? so in this case, forward voltage protection, which is reverse-flow on the diode, is an overkill. Right? (I think I got it)

The reason Schottly is better than Zener is - faster switching [both back and forth?], to allow flow of charge built in the engine to the 12V or the ground below. Right?

By the way, which of the diode protection flows would actually take place? the flow to the ground via the low protected MOSFET? or the  high-end MOSFET connected to the 12+? I am assuming the lower end, because the potential between whatever builds up on the coil and the ground is higher than that and the 12+. am I correct? Or am I TOTALLY off?

 

----

When trying to take your advice about cross-referencing and looking at the details of ICs to consider suitable alternatives, I'm trying to figure something out..

The irf5305 (http://www.datasheetcatalog.org/datasheet/irf/irf5305.pdf) vs alternative irf4905 (http://www.datasheetcatalog.org/datasheet/irf/irf4905.pdf)..

When looking at the specs of the irf4905 insatead, I see that its basically the same type of MOSFET, with the same voltage (VDSS), but lower resistance and higher current specs.. Though are good factors in my case. Right? Not disatvantages.  Price aside, the differences I see listed, all seem positive to me, Am I correct? 

- Ultra Low On-Resistance (not sure if that really helps)

- Fully Avalanche Rated (i must admit I don't know what that is yet.. this one and the other avalanche parameters)

- Higher continuous drain currents (allowing the coils to draw more current = good)

- Higher power dissipation (gets cooler faster = good)

- Slightly Higher forward voltage (good but not important)

- Highrt Reverse recovery charge and other Q parameters (not sure what they mean, but I would guess its not good, but not important)

Looking at the current-voltage characteristics, it seems the alternative MOSFET (Drain to Source), starts flowing at 2V instead of 1V, but that, again, doesn't seem critical to me. Am I wrong? (not sure what the degree difference of the two graphs are.. but it seem to make a difference for the voltages that are higer than 4.5V on the gate)

Did I miss something important?

Is it easy enough to replace one MOSFET with another by using an alternative that is "more or less" the same?

First, when reading data sheets, remember to pay attention to the actual data, not the marketing crap.  For instance, "ultra low on resistance" sounds great, but what does it mean.  The actual data tables tell you.  Compare the actual resistance at the SAME  gate to source voltage.

Lower "on" resistance is almost always better.

"fully avalanche rated" is marketing speak.  You probably don't need to worry about avalanche specs.

Higher drain current is good.  Again, compare the actual numbers under the same conditions, though.

Higher power dissipation is good.  Compare numbers.

Higher forward voltage of what?  

Reverse recovery charge usually means the charge (capacitance) that has to be discharged when current changes direction. Lower is better, but as long as it meets your needs or you can work around it it is ok.  Don't worry too much about it right now.

The voltage you apply to the gate is going to be digital:  It will go from low (about 0) to high(about 12 or whatever) very quickly.  The in between time is when the most power is dissipated by the MOSFET.  The amount of time it takes your circuit to switch with the amount of capacitance on the gate (plus any other there) will determine how much power dissipates as heat in the MOSFET.  You are usually safe using an average, say 6 volts, times the switching time, say 1 microsecond.  When the MOSFET is off, it dissipates 0 (0 amps times 12 volts), when on it dissipates current * current * Ron.  Something like 1amp * 1 amp * 0.2 ohm, or 0.2 watts.  When in between, that same formula works, say 1 amp * 1amp * 4 ohms (whatever the Ron is with gate voltage of 6).  If the switching takes 1 microsecond and happens 10000 times each second, it has  a duty cycle of 1 percent and the AVERAGE power dissipation is about 1 percent of the switching dissipation.  Does that make sense?  Should I clarify it?

Yes, it is easy enough if they are more or less the same.  Most important parameters are:  type (N or P channel), Current and Voltage ratings,  On resistance (at the same gate to source voltage), and gate capacitance.  More capacitance slows down the switching which increases heat.  Large (higher current) MOSFETS have higher capacitance.  Do the calculations to see if it will work and design conservatively, and you should be fine.

Hope this helps. 

Looks like this thread is turning into a third year engineering course!  Oh, well.  I enjoy it.  I will take this in steps since I only have a few minutes right now.

I didn't look at the links you posted yet, and I didn't follow everything you said about the diodes, but it sounds like you have it mostly right.  As for forward and reverse diodes, the arrow on the diode symbol  points the direction current flows.  The line is like a dam to stop the current.  In the case of the zener, it will start conducting at some certain voltage in that direction.  Actually, ALL diodes will do that, just the zener is designed for it.

How high can the voltage go?  High enough to spark across the connections!  Have you ever run an electric drill or similar plug-in tool in the dark?  Notice the sparks inside the motor?  That's what causes them.  Several hundred to several thousand volts in some cases.

Which diode flow takes place?  Normally it will be the diode connected across the MOSFET that just turned off.

That's all for now.  I will try to get back to the rest later.

BTW, it seems like you are really interested in learning this.  I don't mind at all answering these questions (when I can.  I'm no expert) but if you are interested in some good books about this sort of thing I can give you some recommendations.

I am very eager to read your posts here. They are immensely helpful. And very specific to what I am puzzled about. I would be very happy for book recommendadtions. In any regards, all your posts trigger a lot of reading on my part anyway, following a quick google search on issues you talk about.

About the driller experiment.. surely I did. Was wondering though about the voltage potential a coil on a 3 phase BLDC can generate. That's interesting to note. I will experiment with it all as soon as the components arrive. I've been quite busy with my shopping frenzy recently.. so lots on the way.

About the rev/fwd flow.. I just found it interesting and partly-confusing at first that the rev/fwd on the MOSFET is the opposite than that on the internal diode. And, yes, I got the diodes part. And read a lot about the different diode types.

Looking forward to the rest of your reply. Again again, thank you very much for the replies, time and consideration.

I will try to give some basic information that should answer some of your questions.  I haven't looked at your schematics you reference and I'm going from memory only so some of it may not be complete.  But here goes...

To drive the BLDC at least one connection has to be connected to +V and one to GND at any given time, rotating through them.  One is disconnected.  That requires the 3 state driver you mention, which is a half H bridge whether you use an H chip or discrete transistors.  The transistors simply form a half H.  The chip is by far easier and unless you are very experienced will probably be "better" than what you can build.  The transistors in the half H need to be full on or full off, no in betweens.Otherwise power gets wasted heating the transistor instead of turning the motor.  I don't understand why you would use a PWM.  That makes no sense to me.  Maybe I  missed something.

To turn on a MOSFET, the gate needs to be 3 to 5 volts higher for logic level MOSFETS than the source, and 10 to 12 higher for standard MOSFETS.  The "high side" MOSFET, the one that connects to +V and the motor, will have close to +V volts on the source, where it connects to the motor.  Let's say that is 10 V for a +12 V supply.  The gate then needs to be 13 to 22 volts to turn it on all the way.  Plus, it needs to turn off and on VERY fast, or it is in that in between state too long, heating up and wasting power.  MOSFETS have a large capacitance in the gate so it takes a strong driver to charge or discharge that quickly.  Those are two reasons you need driver chips to drive the MOSFETS.  Every device has some capacitance (MOSFETS have a LOT) and those resistors you mention may be depending on that capacitance to slow the rise and fall times.  Again, I haven't looked at the schematics.

For your last question, as Birdmun said cross references are your friends.  But to elaborate a bit, you need to know the specs of the device you are replacing and which ones are important.  That comes from analyzing the circuit operation and experience. Then look for another device that matches or beats all the relevant specs.

Hey. First, like I would soon say to birdmun, Million thanks for the feedback.

From the very clear, to the very vaugue feedback.. they all help a lot, as they open a new route for me to research and learn. Even the very basic terminology.

Indeed, assuming you are correct, I indeed understood the idea of driving the motor the right way.

The PWM is used to drive the motor at a variable voltage. This is mainly for control of speed and torque (alongside the timing). While for now this is still on the theoretical level for me, I will be able to tell more when I actually finish the build process and experiment with different aspects of it. But anyway, all schematics of 3-phase engine, when referring to speed control, talk about PWM feed to emulate voltage levels for controlling the voltage on the coils.

I understand what you are saying about ready-made ICs vs trying to do it on my own. its just a nice practice to try it all on my own. Makes me understand better the inner workings of such chips. 

I THINK I understand what you are saying about the MOSFETs need for high voltage at the gate.. which hints why the drivers or the logical ICs are needed. Btw, that also means that instead of this TC4469, I can simply use voltage (up) regulators to conver the signal from 5V to 12V? or other voltage altering "tool"?

About the capacitance of those and the effect of putting a resistor on the gate to gontrol the voltage's rise/fall on the gate, what I don't understand (given your explanation), is why I would like the voltage to drop/rise gradually on the gate, rather than right away? After all, you said its best to have the MOSFETs change right away and not be in an inbetween state.. so, isn't that how they get there? by having the gate set at a "midranged voltage?

Also, according to the scheme (http://www.jimfranklin.info/microchipdatasheets/00857a.pdf) the gate is fed by a 12V input. BUT you said the gate needs to be 13-22V.. so how can that be? Given that we need to feed a motor and we use a 12V battery, how can the gate use 12V? what does it say about its potential output, if the S is 12V also? I guess I didn't understand the remark about "the gate needs to be 3 to 5 volts higher for logic level MOSFETS than the source, and 10 to 12 higher for standard MOSFETS". Could I bother you for a clarification or reference?

 

LASTLY, while I know what the work itself means (cross referencing) I am not sure about the practice itself.

Lets say I am looking for alternatives for the IRLI3705. Or the L6234... All I know is that its claimed to be a half-H like, 4 "channels", 3 phases chip. Am I missing something? And... I know little about WHERE go to cross-reference/seach-for such an alternative component. Are there online sites or catalouges that are sort of common knowledge that I seem to not know about? How do you guys usually approach such a search?

http://www.allxref.com/search.htm after adding crossreference to the end of a search for the L6234.

I found a supposed cross reference for both the L6234 and the IRLI3705. There is a disclaimer letting the user know that the cross referenced parts are supposed to be comparable based on the specs the manufacturers listed at the time they gathered the data.

Crossreferences are your friend. :)

I know my comment isn't worth 2 cents. Just think, you didn't even have to pay for it. :)

Trying to compare (and cross-rerference :)) opto isolators.. I wanted to make sure I'm not WAY off..

When comparing the following items:

PC817 - http://www.datasheetcatalog.org/datasheet/Sharp/mXruvuu.pdf

LTV-816 - http://www.sparkfun.com/datasheets/Components/LTV-8x6.pdf

PS2501 - http://www.sparkfun.com/datasheets/Components/ps2501.pdf

(and their 2x and 4x sisters)..

I get the feeling that these are "basically" the same. All three are opto isolators (all three come in 1 to 4 packaged sets), all three are 5mA,5V forward (actually ps2501 is 80mA,6V, but for 5V, 5mA all are suitable), 5000V isolation (breakdown?) voltage... am I missing something very important, some very critical parameter, about opto isolators?

Am I way off? Or very correct?

As you may have noticed the email update system isn't quite functioning like it has before.

I can't speak to the usefulness of the options you have located, but, I would imagine if they meet your specs you should be in good shape to use whatever you can find, and afford.