FOC implemented

A project log for Ø32 BLDC Controller

Miniature closed-loop controller for brushless DC motors

christopher-xuChristopher Xu 11/21/2023 at 23:134 Comments

I had a joystick control the desired quadrature current, and the controller is able to track the desired I_q while keeping I_d at near zero (plotted in blue and purple).

Red, yellow, and green show the duty cycle of each motor phase, and you can see the space vector modulation (SVM) waveform change magnitude or frequency depending on the desired current and speed of the motor. 


rraetz wrote 11/22/2023 at 09:02 point

Such a great project! There are other similar projects, but the controllers are either rather larger or they do a "pseudo" FOC without actually controlling to Q and D axis currents. Amazing to see that you do it! Keep up the great work! 

  Are you sure? yes | no

Christopher Xu wrote 11/22/2023 at 21:53 point

Thank you! There's still a lot of work left on the FOC here because something messes up at higher desired Q current (overflow in current control loop calculations?). As I actually get to using this in a project I hope to get it more polished :)

  Are you sure? yes | no

rraetz wrote 11/22/2023 at 22:22 point

How is the alignment of your current measurements with the PWM cycle? Could be worth to check if there is an overlap of the switching and the ADC sampling window for the current measurement. Good luck in any case, I am sure you will find a solution! 

  Are you sure? yes | no

Christopher Xu wrote 11/23/2023 at 06:01 point

My current measurements are pretty noisy, so this might be the problem. I'm starting the ADC sampling at the center of the PWM pulse and toggling a GPIO to indicate when the conversions are complete, but at lower duty cycles the GPIO toggle happens after the PWM falling edge so the ADC conversion is taking too long. It's also sequentially sampling the other ADCs for temperature, bus voltage, and reference, which could be unnecessary. It's using DMA right now, maybe setting up the DMA each PWM pulse is inefficient so maybe try just polling or interrupts

  Are you sure? yes | no