How to remove or filter the drift problem in measured Strain signal? I have the strain signal of a lateral beam of a car measured at sampling rate 1,200Hz from data acquiring system. Even after using temperature compensation in strain gage, we are getting drift. So I wanted to remove drift in post processing of the strain signal. I have tried using High pass filter (HPF) of order 10th with cutoff freq = 200Hz, but I am losing peaks of the strain signal. So HPF is not useful. 

Which filter is suitable to remove drift for strain signals? considering the fact that I want to retain peaks  and what other methods I can use to remove the drifts?

Also, what are the exact factors to consider in choosing the cutoff frequency for HPF? and how to check it is correct?

I have attached the strain signal and HPF filtered signal of 10th order.
The usual first approach to this is to use a DC Blocker:
$$
y[n] = \alpha y[n-1] + x[n] - x[n-1]
$$
where $0 &lt; \alpha &lt; 1$, $y$ is the DC blocked signal and $x$ is your original signal.

If I simulate your signal and apply the DC Blocker to it, the results are in the figure below.

It should preserve the peaks well.

R code to implement it below.



How to choose $\alpha$ ?

This really depends on what you are going to use the data for later.  If it's a control application, then phase is probably important to you.

More generally, you want to JUST remove the DC component and not much else.  In that case, just look at the magnitude frequency response of the filter.

As you can see from the plots below, low values of $\alpha$ (less than $0.9$ tend to have a bigger impact on the lower frequencies.  Hence, I tend to use values of $\alpha$ between $0.9$ and $1.0$.







R Code Below

#27468

T &lt;- 1000
Npeaks &lt;- 10

idx_peaks &lt;- runif(Npeaks,1,T)

strain &lt;- rnorm(T) + c(seq(1,2*T/3,1) ,seq(2*T/3+1,0,-2))/100

strain[idx_peaks] &lt;- strain[idx_peaks] + 10

detrended &lt;- 0*strain
alpha &lt;- 0.9

for (k in 1:length(strain))
{
  if (k&gt;1)
  {
    detrended[k] &lt;- alpha*detrended[k-1] + strain[k] - strain[k-1]
  }
  else
  {
    detrended[k] &lt;- 0
  }
}

par(mfrow=c(2,1))
plot(strain,col="blue", type="l")
plot(detrended,col="blue", type="l")