FOC is a pretty complex topic, but I’ll try and explain it as simply as I can and keep the ElecEngg terms to a minimum (this is a good place for it, right?). I’ll also include some background on electric motors, so hopefully this post is a good one-stop-shop for people getting up and running with motor theory. Going to be a long one - sorry about that
Basics of Motors
A motor spins because of the interaction between a permanent magnet, and a changing electromagnetic (EM) field. The changing electromagnetic field is controlled by “windings” of copper wire. Passing current through these windings creates an electromagnetic field. A motor is made in two halves - the stator (the part that is stationary), and the rotor (the part that turns).
To make the motor turn, we control the electromagnetic field on one part of the motor (in our case, the stator, but not always!) such that it’s constantly ahead of the permanent magnet on the other part of the motor (again, in our case, the rotor). The attractive force will make the two halves of the motor spin relative to each other.
Here’s a diagram that might help. Note that the stator is generating the EM field, and the rotor is a permanent magnet.
Brushed and Brushless
Now, a Brushed Motor uses a physical “brush” which electrically contacts the motor’s commutator to change the direction of the electromagnetic field as the rotor turns - keeping the electromagnetic field ahead of the permanent magnets. Here’s another diagram to help visualise this:
(Note that the rotor of a brushed motor generates the EM field rather than the stator as we saw above)
The reason we dont use brushed motors is because the brush-commutator system increases frictional losses in the motor. And, of course, there’s an extra part that can now wear out (the brushes), causing the whole motor to fail. There are other reasons too, mostly relating to the torque the motor can produce (brushed motors aren’t as good as brushless in this regard).
A BLDC (Brushless DC) motor, obviously, doesn’t have brushes. So, how do we get it to turn? Well, we move the electromagnetic field in a solid state way (with transistors - electronic switches - controlled by chips on a circuit board). In a simple sense, a BLDC motor runs on a three-phase system. There are three voltages that are put across the motor’s windings.These voltages control which of the windings have what strength of magnetic field. Effectively, each separate winding produces its own field that adds up with all the rest to become a single electromagnetic field pointing in whichever direction we chose (even in a direction not directly in line with a winding pair).
A brushless outrunner is a motor where the outside spins - rather than the inside (as with the above diagram). Here’s another diagram that should clear things up:
Outrunners are mechanically better than inrunners (where the inside turns) because the torque is applied to a larger-circumference device (for the math nerds, the moment arm is longer). Outrunners intuitively therefore lot more common. There are also some construction benefits to this design. Also notice how there are a lot of magnets involved. The same basic principle applies, but this time with more coils so we can get a smoother turning action (more on that later). The motor above has 14 poles (7 pole pairs). This is fairly typical on a BLDC outrunner.
ESC - Electronic Speed Control (and why we need them)
This three-phase control is what the ESC (electronic speed controller) is for - it generates the (ideally sinusoidal, but not always) voltage curves that drive the motor. You can’t just plug in a BLDC motor and expect it to spin - you need to be controlling the electromagnetic field somehow. Thus, use an ESC. (Quick note for newcomers: VESC is a special type of ESC that is more suited to electric skateboarding). Here’s another diagram (phase A for the voltage across winding pair A1-A2, phase B for voltage across pair B1-B2, etc.)
Notice how the infinitely smooth sinusoidal signal is turned into a “steppy” (PWM - pulse width modulation) signal before being applied to the motor. This must be done because the ESC uses transistors, which are either on or off. Not in between. That’s why we use PWM to control the motors - it effectively “turns on” the voltage for a certain percent of the time, acting like the voltage was just constantly at said certain percent. Many motors have more than 3 winding pairs, as above. This is to produce a “more round” magnetic field. That’s a terrible bit of physics, but it does make operation much smoother. Note that it’s all still three-phase (three seperable electromagnetic fields) though.
When you control the fields in this way, you produce a (relatively) smoothly rotating electromagnetic field that makes the permanent magnet part of the motor spin. Because you’re effectively switching a transistor on and off to control the sine waves here, this is where you get ERPM (electronic revs per minute) compared to actual RPM. In the BLDC outrunner above, the ERPM will be 7 times the RPM of the motor, because you’re dealing with 7 pole pairs worth of switching frequency. (If you’re using a VESC, you’ll come across ERPM and may want to read a better explanation )
FOC - Field Oriented Control
There are a few important variables we haven’t addressed when it comes to motor control. These are:
- Starting from a stand-still
- Knowing where to actually point the electromagnetic field
- Changing the speed without throwing everything out of balance
These are more-or-less what FOC is in charge of. Before we can do any of the above, we need to know where the rotor is. We can either use a sensored setup to measure it directly (ideal, but more expensive) or a sensorless setup that guesses the rotor position based on BEMF (back EMF).
Side note on sensorless systems
BEMF is voltage generated by the motor. See, when a magnet spins in a copper coil, it generates a current. With current, comes voltage. This is the basic operating principle of a generator. When a motor spins, it generates a current in the opposite direction to the current being used to power the electromagnetic field in the motor.
We can measure this current (the BEMF) to determine where the permanent magnets are relative to the motor’s windings. Downside of this is that you can only guess where the rotor is when it’s spinning, so you may have a hard time starting the motor smoothly.
Back to FOC, when we know where the rotor is, we want to point the electromagnetic field so that it produces the maximally efficient torque on the permanent magnets. This diagram explains it pretty well:
Once we know where the rotor is, FOC accounts for a ton of things like BEMF, voltage/current phase difference (basically “lag” in the way the motor runs) and the way we want to change (or hold) speed, and will tell the ESC how to position the electromagnetic field so we have optimal operating conditions.
Finally! With all that behind us, I can say this: The underlying operation of FOC involves a fair bit of vector math, but what it does is simple: “FOC keeps the magnetic fields of the stator and the rotor offset by the right angle to produce the most optimal torque”.
Note also that other types of control systems exist to do what FOC does, but they all achieve similar goals. FOC is simply one of the most efficient ways of doing it.
If there are any questions or need for clarification, I’m happy to help!