Brushless motor control : a solution
TreeLab
Posts: 138
Greetings All;
A coworker and I have recently finished controlling a hard-drive spindle motor using a prop, a schmitt trigger and three darlingtons. It involves attaching a marked spoke-disk (laser printed onto a plastic sheet) to the spindle, and detecting the passage with an optointerrupter. It has excellent speed control from 20-120 rotations per second, with speed fluctuations of less than 0.5 Hz. Acceleration is amazing, and it self-starts reliably. The motor and transistors all run cool even at top speed. We have been using motors with ~3 ohms/coil; we will be testing higher-speed SCSI drives soon. The prop code is in SPIN.
Would this be useful to anyone else?
Cheers!
Paul Rowntree
A coworker and I have recently finished controlling a hard-drive spindle motor using a prop, a schmitt trigger and three darlingtons. It involves attaching a marked spoke-disk (laser printed onto a plastic sheet) to the spindle, and detecting the passage with an optointerrupter. It has excellent speed control from 20-120 rotations per second, with speed fluctuations of less than 0.5 Hz. Acceleration is amazing, and it self-starts reliably. The motor and transistors all run cool even at top speed. We have been using motors with ~3 ohms/coil; we will be testing higher-speed SCSI drives soon. The prop code is in SPIN.
Would this be useful to anyone else?
Cheers!
Paul Rowntree
Comments
Absolutely! On of the things on my electronics To-Do list is to control a brushless motor. If you have source code and schematics, you could post them into the completed projects forum.
Driving hard drive motors has also been on my todo list for a long time, having a stack of dead drives with their motors pulled out waiting in my junk box.
There was much discussion here a few months ago about how to do this so many others will also be interested.
Do you have a means of riving in reverse? I always had a vision of some kind of little robot using those motors. Direct drive to the wheels which are actually the platters.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
These motors have very low torque on startup, and I give it an electronic kick to get going. I do not know if being forced to move the bot would allow the start process to engage. Only one way to find out.
I will prep the package and let you know when and where it ended up.
Cheers!
Paul Rowntree
Post Edited (TreeLab) : 2/11/2009 1:53:26 PM GMT
I did think that low speed torque would be an issue in this application but never got around to finding out what they can deliver when pushed hard. They seem to give a hefty kick last time a gave one a jolt from a battery. Perhaps they would not like that abuse for very long[noparse]:)[/noparse]
The start up process is an issue. Basically in this application it would have to be constantly starting, stopping, reversing...
I imagine the controller would have to have fairly accurate knowledge of the spindle angle at all times such that it can be driving the motor in approximately the correct phase for maximum torque even when stationary. So some kind of angle sensor is probably required.
Still if that's not a possibility there must be many other uses for them with your driver.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Actually, here is an approach that I discarded because I needed high speed : instead of a spoked wheel to track rotations, you could have a grey-scale gradation that would tell the prop what the absolute angle is just by using a simple ADC like a MCP320x. Or an digital absolute shaft encoder This should control the small, slow and vaying directions
Cheers!
Paul Rowntree
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
TreeLab, does your driver really know the orientation of the spindle to within 2.5 degrees at all times? Even when stationary at start up?
I imagined you have so many "spokes" on your disk to get that resolution but are relying on counting from some kind of "North" marker when turning.
I had thought of printing a grey scale on paper and gluing it to the back of the motor side of the platter. With perhaps only five bits of resolution. We could interface two wheels directly to a Prop using 10 pins. With the magic of Grey scale one can get the position very quickly just read the 5 pins and then waitpne (to whatever value was last read). In PASM the motor will never beat you.
Anyway that gives a pretty good angle measurement even when stationary so we can drive the thing for maximum torque in what ever position at whatever speed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
I said 2.5 degrees, since that is half the width of any sector. It would be more honest to say that it is somewhere inside this 5 degree window. Plus, the motor has 4 equivalent coils (some motors have 3) on each pole, so again, I should be more precise to say that I know in which coil zone I am working, and the maximum uncertainty is 5 degrees. I can slow the rotor with my finger (ouch) and it seems to be able to track the perturbation (since this is slowing it down). If more speed is needed, I will go for PASM. I do not have a 'North' marker. I was thinking of an absolute position tracker with a wider spoke somewhere, but I am not sure how/if/why I would use the information. The reason that I have so many spokes is so that I know in advance when we are getting close to the next coil (6 spokes per coil) so I know if I have enough time remaining to keep energizing the current coil. The whole thing shudders to a halt if you overstep the coil boundary (it actually starts to brake I think, then gets yanked to the next one, and so on).
They would be very cool wheels for a bot.
Cheers!
Paul Rowntree
Thank you in advance .
To my knowledge, there is no distinction between the three coils inside the motor, BUT there is a sequence of windings, and the sequence determines the rotation direction.
If you have a std 4 wire motor, then the resistance between one of them and each of the other three should be about the same (~3 ohms for std motors, 1 ohm in high speed SCSIs). This is the common lead, and the other three correspond to each of the three coils. If you measure the resistances between any two of these coil-wires, it will give about twice the resistance as from the common to the coil winding.
You CAN figure out which is the A-B-C by turning the motor with your hand and measuring the voltage generated from the common to each of the three coils. They will be 120 degrees out of phase with each other. Or, just don't worry about it (this is my preferred route!). Hook up the motor in some known sequence of coils (e.g. drivers 1, 2 and 3 connected to coils A,B,C, and the common connected to 12 V), and if it does not turn the way you want, just reverse any two of the three coil leads (e.g. 1,2,3 --> B,A,C).
There is another thread on this project (http://forums.parallax.com/forums/default.aspx?f=25&m=329281) that includes a description of the (big) package that is now in the Object Exchange under Motor Control, as well as some very good ideas by other Forum contributors. It is very stable, and offers good speed control and 100% assured start up behaviour without manually kicking it. I am working on an assembler version of the code that should be even more robust (less likely to get lost if you try to push to too high a speed) and perhaps a bit faster. I will modify the above-cited thread when the code is ready.
Cheers!
Paul Rowntree
Thank you TreeLab for this important information. This code is reliable way to get the motor going in one direction , what if we want to run it 2 directions : one Clockwise direction and after little time Anticlockwise (without interchanging any two of the three drive pin definitions) ? Is it possible ? And is it enought a power supply of 1A (12V) to spin this motor ?
I am sorry for asking alot of questions.I like this project.
Thank you in advance
Cheers!
If you wanted to go in either direction, it would be relatively easy to add a flag that would control the start up and run directions, but the motor would have to come to a full stop before restarting in the other sense.
I am using a REGULATED 12 V 3.3 A supply, but depending on the speed, this is an overkill. I usually am running at about 60% duty cycle for ~60% of each coil's activation time; my speed control disables the output under these conditions about 40% of teh time at 100 Hz. So using this, I estimate that the power is being applied ~22% of the time. With a coil resistance of 3 Ohms and a 12 V supply, the coil would draw 4 amps at peak, then pehaps 0.8-0.9 A average current.
For power supplies, oversizing is usually a good idea, and it usually avoids problems. So while 1 A will work, you will be pushing everything to the limits.
Note that if you are using a wall-wart power supply, the above advice has a caveat : less expensive unregulated supplies will deliver higher voltages when lightly loaded, so buying an unregulated wall wart that can deliver 12 V, 3 A will probably expose the coils to higher voltages than expected, much higher instantaneous powers (P=V*V/R), and potentially more danger of overheating. My supply cost ~$10.
Cheers!
Paul Rowntree
With single track Gray codes there is are say 5 opto detectors spaced equally around the circle at the SAME radius. A single "track" of light/dark drawn on the circle is what they are detecting. This track has strategically placed "gaps" such that only one opto sensor changes state at a time. They give an example of 5 sensors resolving 30 positions within a rotation.
I have never heard of "single track Gray codes", seems they were invented in 1996. Given that a hard drive platter is very reflective it would be easy to paint an intermittent dark track on it and make such a shaft encoder for the hard drive motor controller. Being cheap I want to use normal LEDs as opto detectors.
Knowing the motor position at all times, even when stationary at start up would make slow speed control and reverse much easier.
Just wish I had time experiment....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Cheers!
Paul Rowntree