3-Phase BLDC Motor Controller will Run you $20 in Parts

If you’re an active shopper on RC websites, you’ll find tiny motors spec’ed at hundreds of watts while weighing just a few grams, like this one. Sadly, their complementary motor controllers are designed to drive them at a high speed, which means we can only hit that “520-watt” power spec by operating in a max-speed-minimum-torque configuration. Sure, that configuration is just fine for rc plane and multicopter enthusiasts, but for roboticists looking to drive these bldc motors in a low-speed-high-torque configuration, the searches come up blank.

The days in the dust are coming to an end though! [Cameron] has been hard at work at a low cost, closed-loop controller for the robotics community that will take a conventional BLDC airplane motor and transform it into a high end servo motor. Best of all, the entire package will only run you about $20 in parts–including the position sensor!

“Another BLDC motor controller?” you might think. “Surely, I’ve seen this before“. Fear not, faithful readers; [Cameron’s] solution will get even the grumpiest of engineers to crack a smile. For starters, he’s closing the loop with a Melexis MLX90363 hall effect sensor to locate the rotor position. Simply glue a small magnet to the shaft, calibrate the magnetic field with one revolution, and–poof–a wild 14-bit encoder has appeared! Best of all, this solution costs a mere $5 to $10 in parts.

Next off, [Cameron] uncovered a little-known secret of the ATMEGA32u4, better known as the chip inside the Arduino Leonardo. It turns out that this chip’s TIMER4 peripheral contains a feature designed exclusively for 3-phase brushless motor control. Complementary PWM outputs are built into 3 pairs of pins with configurable dead time built into the chip hardware. Finally, [Cameron] is pulsing the FETs at a clean 32-Khz — well beyond the audible range, which means we won’t hear that piercing 8-Khz whine that’s so characteristic of cheap BLDC motor controllers.

Curious? Check out [Cameron’s] firmware and driver design on the Githubs.

Of course, there are caveats. [Cameron’s] magnetic encoder solution has a few milliseconds of lag that needs to be characterized. We also need to glue a magnet to the shaft of our motor, which won’t fly in all of our projects that have major space constraints. Finally, there’s just plain old physics. In the real world, motor torque is directly proportional to current, so stalling an off-the-shelf bldc motor at max torque will burn them out since no propeller is pushing air through them to cool them off. Nevertheless, [Cameron’s] closed loop controller, at long last, can give the homebrew robotics community the chance to explore these limits.

32 thoughts on “3-Phase BLDC Motor Controller will Run you $20 in Parts

  1. “which means we can only hit that “520-watt” power spec by operating in a max-speed-minimum-torque configuration”

    What’s the power of a motor at 0 RPM at an arbitrary amount of torque?

    The article’s complaint is a bit of a “duh” moment. Of course you can’t get the full wattage out at arbitrarily low speeds because you are limited in current. The BLDC motors simply aren’t designed to run slow, and if they were designed to run slow they would have a much higher number of poles and they wouldn’t be tiny anymore.

    What is actually needed is a cheap and small harmonic drive gearbox in between: https://en.wikipedia.org/wiki/Harmonic_drive

    1. zero movement = zero (useful) work being done = zero power…

      also – higher number of poles = more iron instead of copper, so you will not get the same power output

    2. Would love to find a “cheap” harmonic drive!

      I’ve been having some success with a 3D printed cycloidal reducer with ball bearing rollers https://en.wikipedia.org/wiki/Cycloidal_drive

      I’m using the plate gear design equations in here: https://www.researchgate.net/publication/245126576_On_the_lobe_profile_design_in_a_cycloid_reducer_using_instant_velocity_center

      3D printed even out of PLA works okay, CNC routed out of Delrin holds up a lot longer.

      At the moment I’m using a similar hall sensor and magnet and using that feedback to control the speed command to a commercial sensorless ESC. That works okay, but still won’t develop maximum rated torque at zero speed, which would be great.

        1. I don’t think it’s present in the assembly but there should be a file for it.

          It’s basically just a cup over the motor with two roller bearings that push the sine wave out.
          Hit me up via PM if you have any extra questions

        1. A car alternator is in the 600 to 1200W range. Not too bad for an e-bike. But really heavy and of low efficiency – as you wrote. And it needs excitation current, which can be considered wasted.

  2. I hope he gets this to work with a capacitive encoder like the CUI AMT102-V. One of the older 12-bit absolute encoders might be something to consider as well. “Milliseconds” of feedback lag is just ugly.

    1. Honestly, the CUI ones are not much better. I have had a heck of a time tuning motors with those on them for position loop, at least. Put on a standard HEDS optical encoder and tuning was a breeze. Buried in the documentation there is a note about interpolation lag in the AMT encoders.

    1. You glue the magnet to the end of the shaft, not to the side of it.

      Assuming the magnet is symmetrical, you can balance it perfectly.

      It’s also possible to file the end of the (steel) shaft flat and place it between a C shaped magnetic circuit. When the shaft rotates it changes the magnetic reluctance of the gap, which can be measured with the hall sensor.

  3. Tried to watch the video but got too frustrated by the guy on the left constantly interrupting (and constantly being corrected by the guy on the right). Pissed me right off.

  4. I work with electric power steering motors. They seem like they may be perfect for this application. Has anyone tried to use one? It could be a bit difficult to separate the ecu from the motor. You could try to use it. It does have the high current drivers in it but the CAN and soft limits in the software may get in the way. These motors have a disc magnet on a post driven into the end of the shaft for the speed feedback. I haven’t had time to experiment with them yet. I was wondering if anyone beat me to it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s