Learning more about brushless DC motor control have been on my to-do list for several years, ever since I learned of another maker's problems with motor control algorithms that did not suit the task. I'm still not ready to dive into this field yet, but I thought I've collected enough potential sources of information that it's worth writing them down.

ESP32 MCPWM

When I looked at ESP32, one of the features that caught my eye was its motor control pulse-width modulation (MCPWM) peripheral. I used it for my Micro Sawppy rover project which used it to control DC gearmotors in each of the rover's six wheels. But it is also applicable for controlling two brushless DC motors. Espressif's ESP32 BLDC control example project looked interesting. Putting it to work directly without modification requires a motor with integrated hall sensor and additional hardware (MOSFETs and gate drivers) I don't have at the moment. I've noticed that MCPWM seems to be missing from more recent Espress microcontrollers, does this mean customer demand hasn't been high enough to justify continued development? If so, that's a shame but also a warning I might not want to get too invested in a feature of uncertain future.

SimpleFOC

For something more fully-featured than an Espressif demo, I could look at SimpleFOC. It's a library for Arduino framework that supports many microcontrollers with Arduino cores. Ranging from the original ATMega328P to STM32 to ESP32. (ESP32 port claims to use its MCPWM peripheral.) This is promising, but SimpleFOC documentation seems to be aimed at people who already knew a lot about brushless motors and know what they want. I need to do more studying before I can absorb information within.

There are a few "reference implementations" for power circuits controlled by SimpleFOC software, but it looks like most of them are out of stock due to the global semiconductor shortage. There are also projects that build on SimpleFOC like this custom wheeled robot controller featured on Hackaday.

VESC

Another open-source project for brushless motor control is VESC. Its documentation is even more opaque to me than SimpleFOC was. (One of them could be built on top of the other for all I know.) What I got out of VESC site is that its primary focus are on brushless motors of sizes suitable for carrying a person around: electric skateboards, scooters, etc.

Theory of Operation

Looking online for beginner-level introductions, I first found How to Make Advanced BLDC Motor Controllers which, despite the name, stayed quite beginner-friendly and did not get very advanced. Here I learned terminology like "trapezoidal drive" which is easier to implement than "sinusoidal drive" which is what field-oriented controllers like SimpleFOC and VESC does. I also learned of dangers like "shot-through condition" which risks short-circuiting and blowing out our controller circuit and/or our power supply.

Another beginner-friendly article is How to Power and Control Brushless DC Motors. This is the second time I got a beginner's primer from Digi-Key's Article Library. The previous lesson involved USB power delivery. And with these two successes, I think I should look around that library to find more educational resources. It didn't take long before I found Controlling Sensorless, BLDC Motors via Back EMF.

Of course, this study syllabus is only important because I want to understand what's going on behind the scenes. If I just want to spin a motor, the easiest thing to do is to buy a commercial controller. Which I've also done to see what I can learn.