A brushless motor uses the same principle, however the coils remain stationary, and the magnets rotate. The motors used on machine tools generally have the magnets rotating inside the coil laminations, but in some applications it is common to have the magnets rotating outside the coil. The two layouts are sometimes termed "inrunner" and "outrunner". The outrunner style can produce a great deal of torque for the motor volume, simply because the magnetic forces are working at the maximum possible radius. The drawback of the outrunner style is that coil cooling is more difficult. The most common use for outrunner motors is in model aircraft, where the airflow from the propellor produces adequate cooling. In both configurations the motor output shaft is fixed to, and rotates with, the magnets.
Brushless motors are almost always three-phase machines, which in practical terms means that they have three power wires. These are generally referred to as phases A B and C, or sometimes U V and W. The phases are linked together internally such that connecting A to a positive voltage and B to ground (or any lower or negative voltage) will produce a current flow into the A phase and out of the B phase. The A phase is wrapped around a set of soft iron laminated poles inside the motor, the B phase round a separate set, and the C round a third set. The A to B current will thus produce a North magnetic charge on the A poles, and a South magnetic charge on the B poles. (In practice depending on how the motor is built, it could be the opposite way round). A two-pole motor would have one pole piece for each phase, and a single North and South pole on the permanent magnet rotor. Motors generally have 4, 6 or 8 poles, meaning that the magnetic rotor has two Norths and two Souths, three of each or 4 of each respectively.
The combination of three electro-magnets and 2 permanent magnets means that it is possible to always keep the rotor "chasing" the electromagnet poles as long as the phases are excited in the right sequence, for example
A->B A->C B->C B->A C->A C->B A->B (and repeat)
This pattern is fixed, there is no other way to do it other than the reverse pattern, which runs the motor the other way (but see Sinusoidal Commutation later) and has the helpful feature for three-phase H-bridge drives that no phase ever switches directly from Positive to Negative without being Off in the interim, limiting the danger of what is called "Shoot Through" where both high-side and low-side drivers devices are "On" at the same time, short-circuiting the bridge with expensive results.
In a conventional DC motor the correct sequencing of the phases happens automatically due to the action of the commutator. With a brushless motor there is no commutator, and so the phases are switched on and of by external electronic circuitry in the drive. To make this possible the drive needs to know the rotor position, so that the correct combination of the 6 possible current paths described above can be driven. This requires some form of position feedback from the motor to the drive. This is often accomplished by using three Hall sensors ( http://en.wikipedia.org/wiki/Hall_effect ). These are arranged around the motor in such a way that the rotor magnets turn them on in six different combinations to indicate 6 different rotor positions, corresponding to the 6 current flow patterns. To run the motor in the reverse direction it is necessary to reverse the current flow.
A good animation of a 2-pole, trapezoidally-commutated, inrunner brushless motor can be found here: http://www.townbiz.com/animations/2-pole_bldc.html I suggest single stepping through the animation, watching how the 3 hall signals change the 6 high/low bridge driver switches, and how the poles alternately pull and push the rotor. Then come back to this page, read it, and possibly go back to the animation.
Reference works, online and paper, will generally describe this system in such a way as to suggest that there is only one Hall sensor pattern which describes unambiguous rotor angular positions and matches one phase current pattern each. In practice there is no universally accepted convention for where zero rotor degrees is and there are a number of possible ways to arrange the hall sensors around the motor to measure the rotor angle. As an example, the following table shows the phase excitation to hall-signal pattern for a specific motor. (Rapidsyn)
This shows a common pattern, but some motors produce 000 and/or 111 patterns and even then, depending on the relative position of the sensors and phase poles there is no convention that, for example, 100 always means A->B for clockwise torque. One common variant of this pattern uses the opposite phase polarities, unfortunately this doesn't mean that the motor runs the other way, it means that the rotor angle and electromagnetic phase angle run in opposite directions, converge and the motor stops. What needs to happen is that the rotor "chases" the electromagnetic field, but never catches it.
This pattern of 6 distinct phase patterns is called Trapezoidal Commutation, it works well and is very simple. However, it does result in a significant (13%) torque ripple which also leads to a certain amount of motor noise.
Consider the situation where a small movement of the motor is required to rotate a leadscrew: No useful torque will be produced until the electromagnetic phase angle has moved 10 degrees or so relative to the rotor, and then it will have to move back 10 degrees to remove the torque. This would be an almost impossible drive system to tune. Also, running in this mode the motor is taking full rated current at all times and will get hot.
A better solution is to actively control the motor position using a closed-loop controller and to only ever apply enough current to hold position or speed and to apply that current at the phase angle which gives the maximum possible torque for the curent, ie at 90 degrees to the rotor angle. This is clearly only possible if the rotor angle is known. Operating like this the motor will take zero current while stationary and under no load, but can apply full torque with only a few encoder counts of displacement if the feedback loop is well tuned (typically full holding torque might be generated with only 0.18 degrees of shaft displacement with a 1000 line encoder, this is even "stiffer" than a stepper motor).
"Stepper Mode" operation can be useful for initial motor alignment to an encoder index or known rotor alignment, however.
The HAL bldc component has been designed to bridge between these various combinations, it can be configured to take input from several combinations of motor feedback devices and output many different types of motor drive signals.
A typical section of HAL code using the bldc component might look like this
loadrt bldc cfg=qH,a6 addf bldc.0 servo-thread addf bldc.1 servo-thread
net enc0 encoder.0.rawcounts => bldc.0.rawcounts net H1 bldc.0.hall1-out =>
=== Input Options==
<To be continued. Sorry>