Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

displacement signal from accelerometer

It took me a while but I found a very simple explanation for what I think you are seeing.

 

The variations you see which appear to depend on the low frequency band edge are due to the filter transient which is excited by the large offset in your data.  Remove the offset and the transient effect is minimal.  While it is still present, there is very littel energy exciting it so it does not show.

 

The attached VIs will show what I did.  The Spectral Analysis.vi has the data from your raw acceleration data.txt file saved as default in the all rows control.  I read the data one time using Read from Spreadsheet File.vi with all rows as an indicator. I removed the File VI, changed the indicator to a control, and made the curretn value default.  This way I do not need to read the file each time.  If you want to read from other files just put the File Read VI back in.  Array Subset removes the header row. By the way the data was saved with insufficient resolution on the time axis, so I ignored that data. This makes the time and frequency axes incorrect.  All three accelerations are shown on Waveform Graph. Everything else only looks at the x accelerations. A switch (Remove Mean?) allows the user to choose to remove the offset or not.

 

The test Bandpass Filters.2.vi shows several veiws of the signal at various stages of the processing.  It is connected as a sub VI of the Spectral Analysis.vi, but you can run many variations on the same data without rerunning Spectral Analysis.vi.  The only time you need to rerun Spectral Analysis.vi is when you want to change Remove Mean?  The Signal? Noise switch selects between the signal produced by Spectral Analysis.vi and a white noise signal generated internally.  The white noise has a uniform spectrum which makes it useful for looking at the filter frequency responses.

 

Start by setting the switches to Signal? = True and Remove Mean = False.  Run the VIs. Change the low cutoff freq and the Lowpass first? values while watching the graphs. Note that the "real" signal spectral peaks remain at the same freqeuncy and amplitude while the low frequency "ramp" varies directly with the low cutoff freq setting.

 

Next set Remove Mean = True and repeat. Notice that the large low frequency components are gone.

 

Switch to Noise and run test Bandpass filters.2.vi.  Not that the spectrum grpahs change according to your frequency settings but you never see the large transients.

 

Think of the signal with the offset as your "real" signal of amplitude ~ 2 peak to peak superimposed on an square wave of amplitude 40 and frequency ~ 1/5000.  The ringing you see is the response of the filter to the first half cycle of that square wave.

 

Lynn

Download All
Message 11 of 14
(3,747 Views)

Thanks Lynn for your efforts! I've not had a chance yet to test your method in my VI, but what you've shown me is what I want to achieve. I have a few things to try now and I'll mark this as the solution when (or if) I have it working.

 

It seems to me that the main difference between my program and what you've done is the mean subtraction. I was aware that the large offset in the data caused a problem but I thought that I had solved it using the Normalise Waveform Offset, which looked as if it had removed the offset and centred the waveform around 0. This didn't remove the large feature below 5Hz that you see in the FFT (spectral analysis) prior to subtracting the mean, however, so this is why I used the bandpass filter.

0 Kudos
Message 12 of 14
(3,729 Views)

Hi Lynn,

 

I've had chance to have a good play with your VI and some ideas of my own. In short, my problem still exists but now I know why. Here's the update:

 

Your VI was an excellent demo of the filters in action but sadly the mean subtraction doesn't work very effectively when I integrate my signal twice to get the output in meters. To try and figure out what was going on I decided not to use my data at all and instead use pure sine waves so I made a new VI, which is attached. It turns out there are two problems, 1. the offset in the data and 2. the offset induced by the integration. In the attached VI you can add an offset to see how it affects the data. The for loop was initially to add several sine waves together to make a single compound signal but I didn't get round to that but you can change the number of waves. Anyway you can add an offset to the data and the FFT show it how your VI output it with an offset - with a large spike <3Hz. Click the remove offset button and it disappears. There are two methods to remove the offset and you'll find they are both equally effective in this instance, however, change the units to m from g and the story changes. The offset from Normalise waveform is more effective as you can see from the velocity plot, where subtracting the mean still induces a gradient (albeit a shallow one) in this. This isn't a good starting point for the second integration, so Normalise Waveform is the best method there, although still not perfect.

 

The integration itself includes an offset in the resultant data, described HERE. Anyway, this new offset needs to be removed but because my method isn't perfect (maybe the mean and offset combined will work, I'll try that now) none of it is working properly and the data is always a little wrong, except when I use Simulate Signal (except at 400Hz where there's a strong gradient in the displacement???).

 

It's odd how the single wave looks like there's interference??? Using Simulate Signal you can see this appear as the frequency is increased. Must be the low freq (offset) portion shown so prominently in the FFT?

 

Strange things are happening. Any suggestions/insight? I'm still working through possible solutions please don't dedicate any time to this unless you really want to.

 

Cheer!

idt

0 Kudos
Message 13 of 14
(3,697 Views)

Just as the velocity has an offset due to the integration constant, the displacement will have one also.  You may need to remove the offset before displaying the displacement.

 

Another factor is partial cycles. At any frequency where the time or number of samples generated does not rpduce an integer number of complete cycles of the waveform, that partial cycle at the end will introduce an additional offset.  The integration constant can take care of it, but you basically will not know what the constant should be (with real signals at least) because you will not know the exact frequency and phase.

 

What you see that looks like interference (I think) is mostly aliasing on the graphs.

 

Lynn

0 Kudos
Message 14 of 14
(3,688 Views)