Electrical – How do ESC’s read PWM

motor controllerpwm

I am curious how ESC's read a pwm signal. I previously thought they interpret the average voltage of the signal, and determine their AC output rate based on that.

However an ESC's output is based on pulswidth in between 1-2 ms, regardless of the period (assuming it is in 50-500 hz for my ESC's). So clearly it can't be only looking at avg. voltage, since 1.5 ms duty cycle corresponds to different average voltage for different periods.

So if not avg. voltage then what? Are they able to exactly pinpoint rising/falling edges?

Best Answer

They use a microcontroller, that also generates the 3-phase output switching waveforms.

The simplest way for a microcontroller to read a pulse width is with the internal timer peripherals. It varies a bit with the type of MCU, but generally a counter (perhaps 16 bits wide) is started at the positive edge, counts some fixed frequency pulses based on the MCU clock, and then triggers an interrupt or flag when the negative edge occurs. The value in the counter gives you the width of the pulse. You can have another timer running that times out if a new pulse is not received within a set period of time.

Even an internal RC clock is good enough in stability and accuracy to read that kind of PWM.

If the counter clock frequency is, say, 4MHz then a 16-bit counter can measure up to a 16ms pulse with +/-125nsec resolution. A crystal clock would be good to a few tens of ppm accuracy, an RC clock probably to +/-0.5%.

If you want to know more about a specific ESC, look up the full datasheet for the particular MCU they designed in, and read the datasheet section on timer-counter peripherals.

Related Topic