LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement baseline drift correction for 1 hz data

How can I rid a measured signal of baseline drift? Ideally I would like to do this in real-time, but for now post processing is sufficient. The signal is coming from a sensor and is at 1 hz. I have attached a graph of the sensor output (on vertical axis) against time (horizontal axis). The graph shows baseline drifting upwards. The data between individual peaks should all be close to zero.

 

I have read that a high-pass filter could be used, but a simple attempt did not produce anything meaningful.

 

I am using LV 2014 SP1 Professional Development System.

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 9
(5,002 Views)
That looks like a connection problem. What is the sensor? What DAQ card? What configuration (rse, differential)? What physical connections?
0 Kudos
Message 2 of 9
(4,975 Views)

Hi Gurdas,

 

is this some kind of acceleration sensor? Or anything else working with "dynamic" signals (in contrast to "static" ones)?

 

You could implement an algorithm that detects those "close to zero" ranges and does a zero offset correction regularly…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(4,962 Views)

I agree with Dennis. It seems a connection problem.

 

About the high pass filter you used, which cut frequency did you choose?

 

 

 

 

0 Kudos
Message 4 of 9
(4,951 Views)

drifts can have many sources...   

bias currents , temperature .....

and since the thread starter didn't tell us what he is measuring ...

But he has to make shure not to leave the input range 😉

 

 

here are two ways to play with

green is a simulated wfrm

red  ignores values greater 2, integrate the rest with a factor and subtract it.

white subtract the result of a medianfilter with a length greater than twice the  pulse length.   

 

Bias filter.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 9
(4,928 Views)

Thank you for the prompt response. Here's some more information.

 

But before that, can we just look at the problem as presented? I mean, what if I just want to fix the drifting baseline for THIS already acquired data and I do not know anything about its source. So, simply consider the data as numbers where we have to pull down the baseline. Makes sense or am I going off the deep end here  🙂

 

More information

 

The data is from measurement of a pollutant. No NI DAQ hardware is involved, though the control software is in LabVIEW. The measurement equipment is mated to a tablet running the LV code and acquisition is over bluetooth. The sensors are connected as differential. The DAQ hardware OEM has provided LV channel creation, timing, start, read, and stop VIs for acquisition.

 

This is not an accelermeter or any kind of dynamic signal.

 

Timing VI config

rate: 100

samples per channel: 100

sample mode: continuous

 

Read VI config

number of samples per channel: 100 (I average the 100 samples to report one sample per second).

 

GerdW: We did a zero calibration at the start of the acquisition and it was subtracted. I have considered the option of finding the new zero between each of those peaks and subtrating it from that section and the peak. But that would mean manually finding the new zero and subtracting, right?

 

AC_85: I tried the 'Equi-Ripple HighPass.vi' with defaults.

 

 

I also have access to the "Developer Suite All Inclusive", so if VIs from a LV toolkit are going to be helpful, let me know.

 

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 6 of 9
(4,912 Views)

A very important question is:

What features of the data provided do you want to extract?

Any filter will have an impact on the data, but what is the information you are looking for?

 

A highpass with a very loooong periode ( low frequency)  will shift the 'base line' sligthly below zero since there are positve pulses....

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 9
(4,903 Views)

Henrik,

 

Thanks for the drift filter VI, looks like an useful idea! I will try it on my data later today. I do not follow exactly what is happening in the "red" method, but that one seems more appropriate than the white.

 

What I would like to do is shift the baseline to zero and keep the peaks. In my case, the baseline constitutes of the values of the signal between the peaks. In real life what is happening is we are measuring a pollute event between sampling clean ambient air. The pollute events are the peaks and the clean ambient air is the part between the peaks.

 

At this stage, I am not too concerned noise and whether baseline is exactly at zero. As long as that strong visible drift is fixed while still keeping the relative rise of the peaks intact, I am good.

 

Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 8 of 9
(4,884 Views)

upon request here is a 2010 version..

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 9
(4,575 Views)