Forums

ADC Read Sequencing for Motor Control

Started by waydan 4 years ago7 replieslatest reply 4 years ago83 views

I am studying embedded control by working on a BLDC motor control with the NXP FRDM-KV11Z development board (Kinetis microcontroller). I’ve read enough articles and application notes to know I should synchronize current measurement with the center of the PWM pulses. However, I’m considering the finer points of aligning the ADC and PWM.

Since the sample-and-hold capacitance needs a few ADC clock cycles to charge, I am concerned that I won’t truly be measuring during the middle of a pulse if I wait till the PWM center to trigger the ADC read.

Example:

  • 10 kHz PWM frequency
  • 24 MHz ADC clock
  • ADC sample time = 10 ADC clock cycles

If a conversion is triggered at the center of a pulse, the capacitance is disconnected from the signal 10 / 24 MHz = 417nS after the pulse center.

I would appreciate feedback for the following questions (and any additional advice folks are willing to share).

  1. Am I correct in thinking that my sample will have a delay?
  2. When should I be concerned about this delay (e.g. when the motor has a low time constant)?
  3. Is it recommended to use a delay timer to preemptively start the ADC read so the end of the sample time and beginning of the conversion line up with the center of the PWM?

Thank you!

[ - ]
Reply by jms_nhMay 31, 2018
1. Yes


2. When your current sense signal has high enough frequency content that a 417ns delay would adversely affect the quality of the samples (hint: di/dt has something to do with it)

3. You could do this, yes.

(just curious, is this a work or personal project?)

[ - ]
Reply by waydanMay 31, 2018

This is a personal project. I’m interested in motor control modules for drones and thought building one would be an interesting way to study electronics and microcontrollers. 

[ - ]
Reply by jms_nhMay 31, 2018

Feel free to PM me on this topic if you have further questions. (not sure you can do that in these forums though -- my email address is jmsachs at gmail dot com)

[ - ]
Reply by Tim WescottMay 31, 2018

There's a good chance that your current is of fairly constant slope -- it depends on your motor inductance and resistance, but unless the motor is insanely small* the L/R time constant should be way more than 100us.  I'd do the math, or give it a whirl while looking at the thing on an oscilloscope.

* It's insanely small if my assumption is incorrect, making me, ipso facto, correct.

[ - ]
Reply by jms_nhMay 31, 2018

L/R (specifically R) generally doesn't matter here. It's V/L.

[ - ]
Reply by Tim WescottJune 1, 2018

Eh, so it is.  It's been a bit since I've done this.

His ADC sample time works out to about 0.5% of his total PWM cycle.  Assuming that the current sawtooth is smaller in magnitude than the average current in the motor, he's going to have less error than that in his current estimate.  For something as dirty as a motor drive, that's probably good enough.

[ - ]
Reply by jms_nhJune 1, 2018
"For something as dirty as a motor drive" -- LOL you're totally right, we're not talking audio signal processing.