Schematic and Description
Moving on from the introduction, I present the schematic and description for my current hard drive motor controller setup.Click for Full Version
Above is the complete schematic for my controller. I'll explain the circuit in sections so it's easier to understand. To begin with, let me start at the beginning with the motor's position sensors and the comparators which turn their small sine waves into proper square waves.
What you see below are the sensors, labeled A, B, and C; these are hall effect bridges as seen on most brushless DC motors which include internal sensors. Rarely you will find motors with sensors that have internal comparators and buffers, in which case you can connect their outputs directly to the logic section of my circuit which will be explained later. For more typical motors such as old HDD motors, most CD-ROM motors, etc you'll need to use the comparators.
As you can see, there are three sensors and three comparators, as many as there are phases in the motor we're using. The hall effect sensors measure the strength of magnetic fields nearby and are thus easily used in a magnetic motor to sense its position. They are built internally like a wheatstone bridge: power is applied to two nodes of the bridge and a voltage difference sensed on the opposite two nodes. In my schematic you can see that the power is applied to all the bridges from the same source. I've used 330ohm resistors because the sensors can only handle a small amount of current. They generate a small voltage difference, usually on the order of 20mV to 100mV which is detected by the comparators. All the comparator does is determine whether one of its inputs is higher than the other and accordingly present a high or low output voltage based on the decision. This means that all three comparators will switch states at the same point for each of their phases. This makes a set of three digital signals that indicate the exact points at which our motor switches from one phase to the next. If you put LEDs on the A, B, and C comparator outputs and rotated the motor, the three lights would blink one after the other in sequence.
The next important part of the circuit is the logic section in the middle. This section's job is to develop the correct commutation levels for the motor. The image below shows the waveform from the previously described comparators. You can see in time from left to right the sensors are switching in sequence.
Notice that the logic circuit turns each phase into a set of high and low outputs. This is very important: the separate high and low outputs allows the ability to have both off at the same time. What this means is that the combined output state means no current is delivered to the load. If the output is neither pulling high nor low, then it will freely float. With a brushless DC motor, this is essential; with a switching convertor you can only drive two inputs of the motor at a time while the third must always float. The reason for this is because the motor also works as a generator. It will generate three sine waves 120° apart from each other and thus when two of them are crossing past each other, the third will be crossing zero volts as seen in the image below. If you have the controller driving one coil positive and the other negative, what do you do about the third that's supposed to be crossing zero?: you stop doing anything at all to it and just let it float past zero on its own. If you leave its output high or low you will be opposing its own voltage and waste a lot of power doing nothing useful. The following shows what three sine waves evenly displaced along 360° look like:
You can see a vertical line which intersects the A phase as it crosses zero volts; in terms of motor rotation, it is 360° or one full revolution past the beginning of the graph at 0°. You can see how all three phases take their turns.
Now that we've generated a proper commutation sequence with which to drive the motor's coils, we need some way of amplifying the voltage and current of the logic stage's outputs to a sufficient level to drive our motor. This where the output stage comes into play; it's depicted at the far right of the schematic and is shown below on its own:
What you see here are a pair of N-channel MOSFETs stacked one atop the other. Either one may turn on if the gate driver receives the according signal from the logic stage previously described. When a MOSFET turns on it will essentially connect the OUT terminal to either the power supply or to ground. You can see that if both of them turned on at once they would connect the power supply directly to ground and effectively short said power supply out. The logic circuit is designed such that there are no possible conditions for which both the HI and LO outputs will be active; this is necessary to protect the output stage in the event that one of the motor's sensors fails. The FAN7390 is a very elegant device known as a gate driver; its job is to cleanly drive the gates of the MOSFETS. The most important aspect is its ability to properly drive the gate of the upper MOSFET which is not referenced to ground. When the lower MOSFET turns on it will charge the 10µF capacitor through the 1N4001 diode and the 10ohm resistor to 15V from the 15V power supply. The FAN7390 then uses this capacitor as a "floating" power supply for turning on the gate of the upper MOSFET. As soon as this gate is turned on, the upper transistor will pull the output to whatever voltage it is connected to, in this case 48V; the flying capacitor is referenced to the output and thus the gate drive is maintained at 15V which saturates the MOSFET but does not damage it. The 1N4001's job is to turn off when the upper MOSFET turns on so that the capacitor is not discharged by the previously explained action. The 10ohm resistor is there to prevent sharp current spikes from occurring when the 10µF capacitor is charged; this reduces EMI(electromagnetic interference) generated by the circuit. If you don't understand the details of this section, don't worry, they are just a brief description of what's going on here; an exhaustive explanation would be its own article!
When you combine the three sections of the schematic into the one shown at the beginning of this article you have a complete motor driver (note that the full schematic shows one output stage for output A; it should be duplicated for B and C from the logic stage outputs). Adjusting the 48V rail up or down will vary the speed of the motor. The MOSFETS can be changed for different voltage and current requirements depending on the motor in use. The devices indicated in the schematic will do well for all small motors found in consumer electronics like CD-ROM drives, hard drives, VCRs, etc. If you try this circuit on said motors, start off with 5V instead of 48V; most of the time 48V will push these small motors to their limits or beyond. I've only specified 48V because that's the upper level I generally use when I want to make things like CD-ROM motors spin very fast. Increase the voltage at your own discretion; some motors can be pushed to extreme speeds and I assume no responsibility if you get one spinning fast enough to blow up. I've blown the ferrite coupling rings out of a VCR head motor and let me tell you it was not pretty; bits flew everywhere and the motor was instantly destroyed. If you hurt yourself, you've done so at your own risk!