Active Filter Design: Motor Controller Current Sensing

I'm using a Hall Effect sensor (ACS704ELC) to measure the motor current through an H-bridge. The FETs are being driven with an Intersil HIP4081 FET driver. I am using PWM (20k Hz)to control the motor.

The Hall Effect sensor outputs a 2.5v DC signal at 0 Amps, and 2.5v

+133mV/A as current increases. My goal is to read the RMS motor current using an ADC channel on my MCU. It is clear that I have to low pass filter the signal first, but I am not sure how to decide on the proper cut off frequency. Filtering the signal to a point where I can sample/RMS it within the MCU (in a reasonable manner) is fine. I understand that in order to recover all of the remaining (after filtering) freq components, I need to sample at atleast twice the bandwidth. But what dictates my passband, stop band (cuttoff), passband attenuation? How do you figure out within what frequency range the motor current be calculated from?

I am in the process of setting up a sweet FFT module on my scope which will allow me to view the actual motor current (voltage output of hall effect) in f-domain.

I'd appreciate any suggestions, thoughts on how I should go about picking the proper filter parameters to meet my goal.

Thanks, Mike

Reply to
Mike
Loading thread data ...

The purpose of the filter is not so much to allow recovery of what gets thru the filter as to reject components that would impair signal recovery, due to aliasing, without the filter. The stop-band rejection needed is determined by how large the expected problematic components are and what accuracy is to be maintained in the converted samples. So, for example, if you had a 16 bit converter and wanted to suppress a fullscale signal at 0.55 Fs, (so that it does not alias as 0.45 Fs), you would want something like 98 dB rejection at that frequency, perhaps more depending on what you will do with the data.

As you can see, you need to know the expected magnitude of unwanted signals at the filter input and output.

What information are you trying to extract from the current? If your intention is to use current-mode control, then you need to preserve content somewhat beyond the servo loop bandwidth and watch the phase response carefully. If you mean only to detect stalls or overheating, a 10 Hz response would be plenty, without any phase concerns.

If you are doing current mode control, I would suggest closing that loop in the analog realm. Sampling delay and filter phase response response to avoid aliasing will be a source of much fun or frustration otherwise, unless your loop bandwidth requirements are lax.

You're welcome.

--
--Larry Brasfield
email: donotspam_larry_brasfield@hotmail.com
Above views may belong only to me.
Reply to
Larry Brasfield

In article , Mike wrote: [...]

I assume you mean the that RMS will be taken over some small finite time.

I'm not sure why you say "it is clear" that you need to filter it. Have you looked at the spectra of what is coming out of the sensor. It may already have most of its energy at low frequencies. The windings of the motor are fairly inductive so the high frequencies of the voltage waveform will be reduced.

Also, remember that any high frequencies that are really in the motor current do add to its RMS. You don't want to filter too much before you take the square.

The best way to attack this sort of problem is usually to start with the highest sample rate ADC you can reasonably deal with. Your filtering will mostly happen in digital land.

A small point:

Actually, you need to sample at a little more than twice. Nyquist frequency is the first frequency you can't fully characterize not the last one you can. Imagine a sine wave at Nyquist that just happens to pass through zero at the sampling point. Your ADC won't see it at all.

If the RMS reading doesn't need to be fast enough to get results within a cycle or two, you can take advantage of that fact. You can do like a sampling scope does. Allow the sampling time(s) to move over the repeated waveform so that you digitize what it is at many places within the cycle. Effectively what you are doing is aliasing the repeated waveform down to a lower frequency.

[...]

Look at what you really get from the Hall sensor before you go very far in the design. There may be huge spikes electrostatically coupled into the signal or some other dreadful thing to deal with.

--
--
kensmith@rahul.net   forging knowledge
Reply to
Ken Smith

In theory. In practice, it is often easier (when other signals are unknown) to work out the cutoff frequency based on aliasing and control loop requirements, then arbitrarily choose a 1st or 2nd order filter.

A huge reduction in measured noise can be achieved by synchronising the ADC sample with the center of the PWM waveform - this means the sampling is as far from the switching edges as possible. Its trivial to do with symmetric PWM, whereby the pwm counter counts 0 to FS then back down to

0, so FS always corresponds to the centre of the pwm.

IOW the phase delay added by the filter subtracts from your closed-loop phase margin. If you had, say 60 degrees phase margin (a good number) and the input filter had the same cutoff as the closed-loop bandwidth, then the phase shift at Fcl is 45 degrees, so your loop actually has 15 degrees phase margin, IOW rings like a bugger.

If you pay attention, it can work very well. with modern micros its now easy to use a simple RC filter, oversample to hell and then digitally filter/decimate.

cheers Terry

Reply to
Terry Given

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.