# Should we use a digital low pass or high pass filter to remove sensor bias?

Consider a continuous signal oversampled at, say $$2 \;kHz$$, and then system digital low pass filtered to a $$100\;Hz$$ frequency which is the control loop frequency. It is known that there is some bias in the signal since it is an accelerometer output.

1. If we use a discrete derivative with a discrete integral in series, will this remove (atleast some of) the DC bias in the signal?
2. Correspondingly it seems a better idea to use a high pass filter rather than a low pass filter although this will invite noise. Is a notch filter how people deal with accelerometer signals and should one go with a high pass approach in case of the unavailability of a notch filter (since the signal necessarily contains bias)?
3. Does the same logic hold if one designs the filter in the continuous domain?
• dsprelated.com/showarticle/58.php
– MBaz
Apr 6, 2021 at 15:28
• What's the application ? A control loop ? How big is the offset ? Sometimes the best thing to do is simply to ignore the offset
– Ben
Apr 6, 2021 at 15:29
• @MBaz thanks for the article. It seems a lot of is a duplicate of the author's DC blocker algorithms paper by Yates and Lyons. Apr 6, 2021 at 15:43
• Try a dc-removal IIR filter. Include this filter in your control loop analysis to make sure your gain and phase margins are right.
– Ben
Apr 6, 2021 at 15:48
• Unless the accelerometer estimate somehow parallels a direct position measurement of some sort, you're out of luck. Your "should we use" question is immaterial, because without that independent position measurement, both choices are bad enough that "best" cannot apply to either. I think you need to tell us more about the application. Apr 6, 2021 at 16:47

## 2 Answers

First of all, your application is a control loop. While I agree that a DC bias can impact the performance, I don't think this will cause your integrator to go to infinity. After all, a control loop has feedback so eventually the DC bias will cause your actuator to compensate for DC bias buildup.

Secondly, if you want to remove the DC offset. There are 2 standard techniques. One, calibrate your sensor and remove the DC offset from the measurements. Second technique, use a DC-removal IIR. Try to balance DC rejection and phase shift as the phase shift will take away some phase margin. Generally, we don't use FIR filters in control loops as they cause significant phase shift which could make your loop unstable.

Edit : If you filter the measured acceleration with a high-pass filter, you will not be able to follow a DC reference, only an AC reference. Are you sure that's what you want?

• Thanks for the answer which summarizes the control issues cause by bias. I'm implementing a model based optimal control which looks like PD in implementation, so the same issues are true whether I action is added or not. I agree with the answer that FIR filters in control loops introduce significant phase shifts. Does that mean that the schemes in the Yates and Lyons paper is to be used with caution in the sense of accounting for the phase introduced by the investigated FIRs in that paper? Apr 6, 2021 at 16:20
• Would you also please let me know that it is accurate to say that, the cascaded differentiator/integrator $\equiv$ fixed-point DC blocker technique in the Yates and Lyons paper is an IIR while the general linear-phase dc blocker is a FIR? Apr 6, 2021 at 16:41
• the fixed-point DC blocker is an IIR while the general linear-phase dc-block is an FIR filter.
– Ben
Apr 6, 2021 at 16:47
• Double integration in closed-loops is not the same as double integration in open loops.
– Ben
Apr 6, 2021 at 17:08
• The DC bias might drift, the gain might change with time and temperature, etc... Usually control loops are more focused on stability than accuracy.
– Ben
Apr 6, 2021 at 17:13

If we use a discrete derivative with a discrete integral in series, will this remove (atleast some of) the DC bias in the signal?

Yes (if your integrator starts at state 0).

Note that this is a CIC filter.

Also notice an offset should be present in your accelerator data, or you just got lost in space.

Correspondingly it seems a better idea to use a high pass filter rather than a low pass filter although this will invite noise.

Well, seeing that by definition of "low-pass filter", the DC component remains untouched, this doesn't only seem to be a good idea, but mandatory.

Is a notch filter how people deal with accelerometer signals and should one go with a high pass approach in case of the unavailability of a notch filter (since the signal necessarily contains bias)?

It depends on what people are doing for what purpose. My guess is you want to estimate something from your accelerometer observation. Maybe Kalman filters are what you're after?

Does the same logic hold if one designs the filter in the continuous domain?

This has nothing to do with continuous or discrete time. So, yes.