Measuring average current

Status
Not open for further replies.

ElectroxX

Newbie level 6
Joined
Dec 21, 2011
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,421
I want to measure the average current through a small DC motor switched with PWM. Current is measured via a hall-sensor with voltage output.

I want a stabilized value each ms for a current regulator, meaning that the filter cant have a too big delay.

First I need an analog filter to get rid of noise and such higher than the Nyqvist frequency and I'm thinking of a simple RC filter for simplicity and flat frequency response. My idea here was to choose the RC time constant to be 1ms/5, so that a step change each ms is going through completely after around approx 1 ms. Is this a good design strategy?

Then I guess digital filtering is the way to go? Moving average? Is there some sort of digital filter that has steep filtering characteristics, yet a fast step response?

The program is to be implemented in C on an embedded system.

Personal opinions and tips about publications regarding this are very appreciated.

- - - Updated - - -

Or should I perhaps trig an interrupt at the beginning of each PWM cycle and measure the current on the battery side during the on time, and then average for each period?

Benefits I see would be elimination of high frequency components in the PWM step functions that could cause aliasing and therefore perhaps eliminate some need for analog signal pre-processing. This would also give a more true average on each PWM cycle, instead of an average thats is slowly converging over multiple periods.
 

According to this PDF a moving average filter has the fastest possible step-response but still good noise rejection.
https://www.analog.com/static/imported-files/tech_docs/dsp_book_Ch15.pdf

I also realized that cranking up the PWM switch frequency would keep the DC level about the same but increase the frequency of the first non-DC component.
The amplitude of the non-DC components would then be more effectively filtered by the motors L/R values as well as by an additional filter.

Tips regarding this is still very appreciated though.

EDIT: And an anlog bessel filter seems to be best anti-aliasing filter for this application, due to its fast step response and other good time domain properties.

https://www.analog.com/library/analogdialogue/archives/43-09/edch 8 filter.pdf
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…