Electronic – FOC Motor Control Algorithm – ADC sampling

brushless-dc-motormotor

I'm working on implementing the FOC motor control algorithm on an STM32F411 microcontroller. My question is about when you need to sample the phase currents in relation to your PWM pulses. If you turn on the transistors, you'll get an increasing current ramp over the course of your PWM on time (due to the inductance of the motor coils), so how are you supposed to know what the three different phases are doing if they all take their ADC measurements at (about) the same time? The FOC algorithm requires us to sample ADC's in the center of a PWM pulse to best approximate the current through a phase, but how can I get the ADC measurements to line up with one another if all three PWM signals need to be operating independently? Is this confusion due to using edge aligned PWM vs center aligned? Can anyone point me to a paper on how to pull this off?

Thanks and regards,
Craig

Best Answer

I will try to organize my answer on points rather than cramming it into an essay :)

1- As far as i know most people use center aligned PWM in motor control applications.

2- All three PWM signals and there inverse, have the same time base ( main timer ) so they are synchronized even if they have different values (hence they are not independent).

3-The values of the ADC should be sampled at one time , not each of them at the middle of its respective PWM signal. A lot of modern MCU allow for sampling multiple signals at the same time, and conversion is sequential .

4- motor control micro-controller (not sure about STM32F411) use a special event trigger ( microchip calls it that ) that lets the adc sample and covert automatically when the PWM time base reaches a certain value. which could be the start or end of the PWM cycle

5-I would advice you to take a look at TI motor control app notes, STM32 motor control library , and microchip AN1078 Sensorless Field Oriented Control of a PMSM , AN1292 , AN1162 , AN1206 . with PDF that explains the concept and C code for more details

Regards