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.

I will chime in on your last minute question.

Crossreferences are your friend. :slight_smile:

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

:)Depending on the

:slight_smile:

Depending on the conversion rate of the local currency, even 1 cent can be a lot.

Thanks for the time you took to read through my question and throw a bone in. Appreciated.

Trying to compare (and

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?

Ok… update

So… Update

I didnt get yet the individual components, to build my own half-H… But I got a 4 channel DC motor driver. Its Full-H, but I figured that as long as I have Enable per motor, Full-H can be simply used as Half-H, if I just use one terminal of the bridge. 

So I indeed plugged the arduino to the driver, used 3 of the 4 channels, wrote a little Arduino sketch cycling through the 6 states, plugged the three outputs (though only the first “pin” of each) to the three coils on the HDD, and… what do you know… the motor turns.

Depending on the delay between the states, different speeds are reached, Also, for now I control the voltage via the power supply. Its effect is how jerly the movement of tyhe motor is on very low RPM and to some degree how strong (and less-so, fast) the rotation is.

So, the theory employed successfully. a very basic ESC using Full-H in a Half-H configuration with arduino. I still plan to build my own Half-H using MOSFETS though… I’m not chickening out of this one.

AND for now its a sensorless ESC… so can’t really trust on a good motion, because the change between states it TOTALLY no based on the position of the motor, as it actually should do. For this, I have to measure the back EMF… but I can’t really do that until: a) I get my oscilloscope to be able to “see” what I get on the a common leg. b) I pipe the output of this leg through a comparator and schmitt trigger and feed it into the arduino (probably using interrupt), to be able to control proper timing of phase switching.

I did get into some problem. I can’t really get the motor to get to real HDD speeds… like 5400RPM or 7200 or whatever the HDD is supposed to be able to operate at. I can’t really tell why yet. The phases are properly set, as far as I can tell. And I’ve trued it with different voltages… what I don’t really know is what is the right interval to switch the phases at. The delay is a key component here. 

I have to keep on digging. Any advices?

More Updates

bdk6… Before I address your notes, let me first say… I broke the speed barrier I had before.

I did so by:

a) Improving the code, by switching the arduino ports all at once, using the port buffers instead of individual port commands. This helped greatly, as now I turn off one circuit and turn the other one on at the exact same time, instead of sequentially. 

b) Accelerating slowly towards the higher speed. (though, again, its a temporary solution because I don’t have access to the back EMF or hall sensors)

c) other improvements to the code such as bitwise operations, getting rid of debugging (which slows down the execution) etc…

I’m still not sure what RPM I have, but it seems fast. Would wait for some sensors which might help me soon, measure speed. I also need to be able to commutate better, by reading position or using backEMF.

I got to a point where the motor is actually running on 14V and on a loop of 400microSec… meaning, each cycle roughly takes 2.4 miliseconds. If its 4 cycles per rotation, its 100 rotations per second or 6000RPM. Not too bad not totally sensorless controller :wink:

 

1. Rearding the back EMF… Yes. I think I could do that. I am not sure if such readings could be done fast enough to catch up with high RPM. Old disks operate at 5400 to 7200 (New ones are at 10-15K). And indeed, as evidently is true, each rotation is few cycles… so the back EMF is probably at a rate of 4-8xRPM. So… we are talking about 20K-cycles per minute or so. That is 360 readings per second. If Arduino can managed to read at a speed of 10K as you say, it would be fast enough. Having said that,  I can’t reall read the BackEMF directly in the arduino, as it is coming back from the engine, and that one is in the 12V range which can not be connected directly to the Arduino.

Regardless, what would make more sense is to feed the backEMF into a voltage comparator and (as the notes say) look for the zero-crossing. Then, take 33% of the cycle time as a delay and use that as the queue to move a phase… However, once you do that, you start moving things out of the Arduino and into electronics… Basically moving into building a full hardware-based ESC with discrete components. Very cool, but might be a little too far for what I want to do, which is learn the basics of it all. For that, I would probably limit the top RPM I aim for, to something that the Arduino can handle. However, before messing with EMF, I probably would benefit greatly from an Oscilloscope, as I can “see” the data I’m supposed to work with. Plus, it would be nice to be able to tell: a) What RPM I’m at. b) What Torque I have. I can do (a) once I get some reflection sensor of the sort. Any idas about (b) though?

 

2. About acceleration, yes. I already did that. The voltage required, takes a fine balance, as the commutation timing is “blind”. For now I use fixed voltage as fed from the second power supply, and depending on what I’m testing, change the voltage on that supply to see the effect.

3. yes. I’m not sure how many, but I think about 4 to 8 of those cycles are needed. I can test it tomorrow.

Now I need to

I) Test the speed and possibly torque

II) Get an oscilloscope

III) Get BackEMF into the equation

 

 

BTW, the drive is ST320014A

BTW, the drive is ST320014A ( http://www.seagate.com/support/disc/manuals/ata/usx20pmbu.pdf )

5400 RPM. So maybe I reached its maximum speed… Would be nice to measure.

So…

It pretty much doesn’t work like I need it to…

What happens when I feed it direct voltage/current, is that, at best, its moving a LITTLE, but does not get to, and stays VERY fixed at a certain point. Its pretty easily deflected with the hand and doesn’t seem to really be fixed on a certain point.

What I need is for it to stay VERY firmly at a given point/angle.

Look at this video for example: http://www.youtube.com/watch?feature=player_detailpage&v=uJKxUPlhvZY#t=341s (at 5:40). The head moves to a very specific exact position, and stays there quite fixed. It then can jump from any point, to any point, very quickly and accurately.

I can’t seem to get my coil to do that.

and another example

seems to be that the HDD can control the head position, very fast and very accurately

http://www.youtube.com/watch?v=4sz4VHCj2Ho

I was thinking about

I was thinking about ascelleration/descelleration, but indeed reached to a point where I realized I needed to know the exact position to do that, and thats a no-go, as the idea is to drive the heads passively, without reading the disks (which are now gone).

As for current, a pretty considerable force can be created, when pushing it to the limit. Which gave rise to another idea… a spring (or rubber band, for short term experimentation). When attaching the heads to a spring, pulling the heads to one direction, it is way easier to control the position of the head, by applying different currents. It worked well enough.

At this point, I realized what I was looking to do with the coil is not really a suitable use for those. I have a specific idea in mind that I am thinking about implementing and it seems that a galvanometer or a fast step motor would be more suitable for my needs. So at this point its back to the drawing board :slight_smile:

But it was certainly fun tearing down HDDs and messing with their inside. It was very educational so far, learning the schematics of an H bridge, implementing a crude ESC and running an HDD 3-phased motor. I am waiting on the scope now, and other parts to be able to implement a back EMF enabled ESC, as well as my own H bridge driver.

In parallel to that, I will move forward with my design and start experimenting with Galvos and step motors now. Shopping time!

Actually…

One idea I have is keeping the HDD intact, with the plates as well, and trying to hack into its control board, so that instead of controlling the engine and coil directly, I will tell the board itself to “seek” a certain cluster. Mapping different clusters to degrees, I could then control the angle of the heads very accurately, using the already existing mechanisms and electronics. That requires a different level of hacking… interface and protocol hacking. But that one is for a later time.

Sorry for the late reply.

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.