I've been working on trying to drive old hard drive motors with an Arduino UNO. All the motors I have appear to be 3-phase BLDC. My first move was to try and get a 3-phase PWM output from the AVR uC. I managed to do that but I've since done enough research to learn that my simple square wave output isn't likely going to be adequate to the task, between the information on wikipedia and Atmel's own design notes on sensorless BLDC control.
I'm probably still quite a ways away from being able to spin the spindle, as it were, but I have this code that I probably won't otherwise have a use for. (incidentally, I think that sensing the back EMF of the motor and using that to trigger interrupts to properly sequence the motor is a pretty neat trick)
So, what can I do, if anything, with a 3-phase simple square wave PWM signal? Anyone want me to post the code? It also does 2-phase pulses, FWIW. The 2-phase is pretty straight-forward, while the 3-phase, I ended up using interrupts on the timer counter edges. And, yeah, it makes heavy use of direct access of the AVR registers, as the wiring interface defined for the Arduino libraries isn't sufficiently powerful.
If you search through various Atmel application notes you will find that they have lots of information on controlling both sensorless and sensor based brushless DC motors:
KE7GKP:
It is not clear from your question whether you actually got the motor to turn with your 3-phase square waves?
It is also not clear how you are driving the motor windings. Since it is unlikely that you have a motor that can run on the 20mA safely available from an Arduino output pin, what kind of circuit are you using to allow your Arduino to control the kinds of currents required by something like a hard drive motor?
I think I didn't make my original post sufficiently clear. No, I didn't get the motor to turn, which isn't really surprising. I spent a fair amount of time getting the code to work to produce the three-phase square waves, so I thought I'd see if anyone had suggestions for other things (obviously not 3-phase BLDC motors) that such a setup might be useful for, and if anyone was interested in the code.
As far as driving the motor, I do have some app notes from Atmel that cover doing sensorless BLDC motor control with the AVR uC, so I'll be looking into that more. I'll probably end up getting the kit they mention in the app notes as well. I have a pile of MOSFETs but they don't switch nearly fast enough for this kind of application.
I have a pile of MOSFETs but they don't switch nearly fast enough for this kind of application.
That seems quite surprising. I would expect that any MOSFETs you could find would be completely capable of not only switching the gross 3-phase waveforms, but even high-frequency PWM also. What makes you think they are not fast enough?
When I first tried hooking everything up and looking at it through the scope, the output of the MOSFET wasn't changing much - it would drop a little bit before the next pulse output from the uC. That said, I just hooked it all up again and probed the gate and source of the MOSFET and it appeared to be working correctly this time around, so I probably just had things miswired initially.
When I first tried hooking everything up and looking at it through the scope, the output of the MOSFET wasn't changing much - it would drop a little bit before the next pulse output from the uC. That said, I just hooked it all up again and probed the gate and source of the MOSFET and it appeared to be working correctly this time around, so I probably just had things miswired initially.
You might specify what specific mosfet transistor you are using and how you are driving them with the digital output pins. If they are not specificaly LOGIC level type mosfets then they won't turn on reliably with just +5vdc.
Interestng - do you have data on any of the motors - RC brushless motors have very low winding resistance and overpowered for many small projects (making servomotors for instance) - reusing hard drive motors would be nice - let us know if you suceed.
I note many hard drive motors are 4-wire - how are the windings connected?
I don't have any documentation for the motors. I suspect many of them are made specifically for the drive manufacturers. I suspect they're wye windings rather than delta, given what I've read, that delta windings are typically used in high-torque applications.
WRT the MOSFETs I have, they're 8A and 80A P-channel power MOSFETS that I had left over from a variety of LED lighting projects. I was only fiddling with them to see if they would do anything at all, with no real expectations that they'd be useful. For driving the BLDC motors, I'll almost certainly need N-channel transistors instead, or perhaps to just buy an off-the-shelf H-bridge IC. No doubt there's a lot more to it, and I'll have to do some research before I make any further progress, but I also have a list of project ideas to dig into right now, and as multiple orders of parts have arrived in the past couple of days, I'll be distracted for a while. So no progress on the PWM BLDC motor control for a while XD