Measuring PWM current

Status
Not open for further replies.

ilium007

Well-known member
Hi - I am using a Teensy 3.6 to generate a 20kHz PWM signal and need to measure current being consumed. I understand that measuring PWM current is difficult given you could be measuring at a PWM transition such as rising / falling / low / high. I don't quite know how to approach this. I assume I need a way to measure current only at the high point of the duty cycle, take x number of samples over time and then average the readings.

At 20kHz I have a .00005s (0.05us) period so somehow I would need to measure at 0.05us periods at the point the PWM signal is high. I am not sure how to do this.

I am looking at using the INA219 current sensor - http://www.ti.com/lit/gpn/ina219

https://learn.adafruit.com/adafruit-ina219-current-sensor-breakout/downloads

Any ideas ?
 
If you are just interested in the average current, then most measurement systems will actually do this by default -- they don't (instantaneously) sample the signal and then digitize it. For instance, the TI chip you mention will filter (== average) the signal.

If you are interested in the peak during the PWM, you would have to sample it (use a sample-and-hold IC), or and ADC that can sample and convert quickly and then trigger it during the PWM high. Note that many loads may have a capacitive element to them and the current you measure may not be the value you expect.
 
You just need to sample the current several times faster then you are switching. The teensy adc can easily sample fast enough as long as you use DMA sampling. You can also take the measured current as a voltage and filter it down to the average. What specifically are you trying to accomplish with the current?
 
Status
Not open for further replies.
Back
Top