Post-processing Noisy Accelerometer Data
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
Post-processing Noisy Accelerometer Data
What have people been using to filter their accelerometer data? I've tried a simple moving average by oversampling at 50Hz and averaging every five data points to match by GPS, but it still doesn't get anything close to being recognizable. I've then averaged again such that I'm essentially averaging over a full second. It makes the acceleration look a lot smoother, but still not matching what I think I should be seeing based on GPS speeds. In addition, averaging over a second seems to be a bit much.
My question is: how have people been filtering their accelerometer data? Has anyone done any FFT analysis or something else fancy?
My kart didn't have space for vibration isolators, so I had to hard mount it to the bottom of the pan. I'm sure this is causing issues, but at the moment I don't have a better option.
My question is: how have people been filtering their accelerometer data? Has anyone done any FFT analysis or something else fancy?
My kart didn't have space for vibration isolators, so I had to hard mount it to the bottom of the pan. I'm sure this is causing issues, but at the moment I don't have a better option.
I'm in a very similar predicament right now from my kart. I did some vibration isolation, but I don't think its possible to have enough. I haven't had enough time in the last week to do much with it yet. Below is a sample of what i saw seeing. The GPS speed was at 10Hz, the accelerometer at 100Hz. I just filled in the gaps in GPS speed with previous to graph it, hence the steps.
- Attachments
-
- Accel Data Kart.png (96.65 KiB) Viewed 19504 times
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
Completely. I'll post a similar graph later as well.
What is really weird is the part of braking in the middle of your run of acceleration. I've got the same phenomena which simply doesn't make sense. In addition, I have the same problem in my Lemons car where full throttle down the straight I'd all of a sudden have the accel go negative and then back positive again. Not a blip, like a second long.
I'm wondering if the noise is just taking over and causing the accelerometer to max out, resulting in weird data.
Are you doing a prior 50 point average? I would try doing a centered 49 point average as it is more accurate (though still pretty inacurate as filtering goes). You'll end up delaying all of your acceleration data if you do a trailing moving average because you are trying to pair GPS data with accelerometer data which is essentially an average of a quarter second in the past.
What is really weird is the part of braking in the middle of your run of acceleration. I've got the same phenomena which simply doesn't make sense. In addition, I have the same problem in my Lemons car where full throttle down the straight I'd all of a sudden have the accel go negative and then back positive again. Not a blip, like a second long.
I'm wondering if the noise is just taking over and causing the accelerometer to max out, resulting in weird data.
Are you doing a prior 50 point average? I would try doing a centered 49 point average as it is more accurate (though still pretty inacurate as filtering goes). You'll end up delaying all of your acceleration data if you do a trailing moving average because you are trying to pair GPS data with accelerometer data which is essentially an average of a quarter second in the past.
I think that it is virtually all noise. It just oscillates peak-to-peak. I think what we view as being a filtered signal is really just noise. If you look at the distribution of points its clear that a large majority are at the peaks of +/- 2.4gs
- Attachments
-
- Accel Histogram.png (34.68 KiB) Viewed 19497 times
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
Here are my plots of acceleration. I did a 49 point average, centered around the data point I was interested in. This is lateral acceleration with a rotax (aka, only rear brakes) kart, so I SERIOUSLY doubt that I'm able to get much more than 1, 1.25 G's of braking. I am certainly not able to get much over a G of acceleration.
You'll notice in the first graph that my speed is increasing while the averaged acceleration shows I am waffling between braking and acceleration. I assure you I am flat down the straight.
You'll notice in the first graph that my speed is increasing while the averaged acceleration shows I am waffling between braking and acceleration. I assure you I am flat down the straight.
- Attachments
-
- Picture1.png (116.2 KiB) Viewed 19469 times
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
When you log with the car off/not moving or the unit outside the car, do you still get the noise?
If not, then most likely you need vibration isolation. If you're trying something, please post pictures of what you're doing. I recommend true isolation mounts, meaning there is nothing rigid connecting the unit to the chassis of your car - not even a through-bolt. A piece of rubber between the unit and the car does nothing if you still bolt it directly to the chassis, if that makes sense. You might have to play around with different durometer rubbers or other materials to see what works.
My vote is that you're likely hitting a vibration resonance with your mounting and its causing the noise.
for isolators, try using engine mounts for small engines used in mowers mopeds, etc. I use them for a lot of stuff and they work great. You only need about 1 inch of additional space under the unit.
If not, then most likely you need vibration isolation. If you're trying something, please post pictures of what you're doing. I recommend true isolation mounts, meaning there is nothing rigid connecting the unit to the chassis of your car - not even a through-bolt. A piece of rubber between the unit and the car does nothing if you still bolt it directly to the chassis, if that makes sense. You might have to play around with different durometer rubbers or other materials to see what works.
My vote is that you're likely hitting a vibration resonance with your mounting and its causing the noise.
for isolators, try using engine mounts for small engines used in mowers mopeds, etc. I use them for a lot of stuff and they work great. You only need about 1 inch of additional space under the unit.
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
Success!
Installing vibration isolators on my kart made things better, but not necessarily awesome. The data was still very noisy, but at least it wasn't maxing out the accelerometer.
However, a simple moving average in excel wasn't cutting it. I decided to step up my game and pull out Matlab and doing some true filtering. I used a 2nd order low pass filter (actually a butterworth) with a cutoff frequency of 0.5Hz, and my data looks significantly better than it ever did before (see picture). I need to play around with the cutoff frequency, but this alone is close enough to truly get information from.
From here I need to :
1. correct for the "double sample" phenomena where RCP captures an extra data point ever 10 data points (with the same time code) - this probably messes up the filter slightly because it assumes a constant time interval.
2. Figure out the best frequency for cutoff
3. Analyze all of my data.
Anyone know of program that does this which is free (matlab is NOT)? This isn't really a sustainable solution for most of the RCP community.
Installing vibration isolators on my kart made things better, but not necessarily awesome. The data was still very noisy, but at least it wasn't maxing out the accelerometer.
However, a simple moving average in excel wasn't cutting it. I decided to step up my game and pull out Matlab and doing some true filtering. I used a 2nd order low pass filter (actually a butterworth) with a cutoff frequency of 0.5Hz, and my data looks significantly better than it ever did before (see picture). I need to play around with the cutoff frequency, but this alone is close enough to truly get information from.
From here I need to :
1. correct for the "double sample" phenomena where RCP captures an extra data point ever 10 data points (with the same time code) - this probably messes up the filter slightly because it assumes a constant time interval.
2. Figure out the best frequency for cutoff
3. Analyze all of my data.
Anyone know of program that does this which is free (matlab is NOT)? This isn't really a sustainable solution for most of the RCP community.
- Attachments
-
- Picture10.png (154.83 KiB) Viewed 19431 times
This is great, thank you for sharing! Yes, the accelerometer will simply faithfully record what it's experiencing.
Ideally we could integrate this into the RaceAnalyzer software. If you feel it could be useful, please share your Matlab algorithm and we'll see what we can do for massaging the data upon import.
Thanks, this is great work!
Ideally we could integrate this into the RaceAnalyzer software. If you feel it could be useful, please share your Matlab algorithm and we'll see what we can do for massaging the data upon import.
Thanks, this is great work!
Actually, I found a rather interesting DSP library supporting various filtering:
https://github.com/vinniefalco/DSPFilters
Could be fairly straightforward to integrate as a post processing step into RaceAnalyzer.
https://github.com/vinniefalco/DSPFilters
Could be fairly straightforward to integrate as a post processing step into RaceAnalyzer.
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
Matlab has a built in butterworth creation function and filtering function, so I was just using those. However, Butterworth or simple low/high/band pass functions aren't super hard to implement (which you've found above).
I did a quick search myself and ended up programming the results of this page in to an excel document to test it out. http://www-users.cs.york.ac.uk/~fisher/mkfilter/
It works great! I know I could remember how to calculate the transfer functions, but this page and Matlab did it for me. I'm sure it is in the code you found as well.
I think this is a great thing to include in code. The software filter works pretty darn well so long as you don't max out the sensor.
I did a quick search myself and ended up programming the results of this page in to an excel document to test it out. http://www-users.cs.york.ac.uk/~fisher/mkfilter/
It works great! I know I could remember how to calculate the transfer functions, but this page and Matlab did it for me. I'm sure it is in the code you found as well.
I think this is a great thing to include in code. The software filter works pretty darn well so long as you don't max out the sensor.
I too would like to see filtering available either in RaceAnalyzer or in the RaceCapturePro itself, for most all channels. Rpm to filter out blips, accelerometer to smooth the data, and to also smooth out data on other analog inputs. I guess post processing filters in RaceAnalyzer would be better so you can adjust settings as required without having to re-record data.brentp wrote:Actually, I found a rather interesting DSP library supporting various filtering:
https://github.com/vinniefalco/DSPFilters
Could be fairly straightforward to integrate as a post processing step into RaceAnalyzer.
-
- Posts: 101
- Joined: Tue Jan 15, 2013 1:37 pm
I haven't done an FFT yet, though I promise I will as soon as I get my MatLab computer back (should be soon).
I recently found out how Motec and some of the other big name data systems do their filtering. They run the data through the filter once and then reverse the data and run it through again. The second time through doesn't filter all that much (because the noise is already filtered out), but it returns the data to being in phase. I did this with my excel butterworth filter and it works REALLY well. Perfect looking data that is 100% in phase with the original data.
This function in MatLab is called "filtfilt", which I vaguely remembered but forgot about until I was reminded. When filtering is added to RaceAnalyzer it should 100% do this form of filtering where there phase is preserved.
I recently found out how Motec and some of the other big name data systems do their filtering. They run the data through the filter once and then reverse the data and run it through again. The second time through doesn't filter all that much (because the noise is already filtered out), but it returns the data to being in phase. I did this with my excel butterworth filter and it works REALLY well. Perfect looking data that is 100% in phase with the original data.
This function in MatLab is called "filtfilt", which I vaguely remembered but forgot about until I was reminded. When filtering is added to RaceAnalyzer it should 100% do this form of filtering where there phase is preserved.