Moderators: adafruit_support_bill, adafruit

55 posts
• Page **2** of **4** • 1, **2**, 3, 4

Re: Pothole data smoothing and detection of accelerometer data

The FFT looks interesting and may be a good signature for a pothole. You will need to apply the transform to various segments of the full data set to see if other events have a different signature. If you see dominant frequencies that are consistent for each event then you can pass the raw data through several bandpass filters in unison. The output of each filter will then be an indicator of that event. That may turn out to be better than a series of FFTs. Also, the time frame will be unbroken as the FFT execution time would leave a gap in the raw data. The events will have to be categorized first. I also suspect that resonance in the vehicle suspension system will complicate the FFTs so the A-frame mount might be essential.

I've extracted your two data sets and will attempt to do the numeric integrals this afternoon. I need to go up to the next town this morning to get some loading components.

For curiosity, where are you located?

I've extracted your two data sets and will attempt to do the numeric integrals this afternoon. I need to go up to the next town this morning to get some loading components.

For curiosity, where are you located?

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Thanks man, I really appreciate your help, and no problem take your time. I'm from Pennsylvania all my life haha, Pittsburgh is awesome, :) How is Flordia, lucky bastard :P haha, its crazy in PA today, there are thunderstorms and its like 60 but tonight it will drop to like 28 and snow

At the end of my previous post, there is about 33 seconds worth of data, sampled @ 100HZ, if I wanted to use Matlab to do FFT on various parts of the data I was thinking I could pad 0's on the end of the data of 3283 elements to get it up to 2^12 elements (4096)

The data contains a basic driving scenario, but with me hitting 6 to 9 potholes with my car (OUCH) lol, also there was some rough patches in the road,

Matlab would be able to do FFT on the whole piece of data right? I'll have to research that haha

*Just found out Matlab can directly import data from a CSV file nice!! No wonder this program is like $3000 lol, I have the student version though

You might be right about the A-arm, I'm not sure what wheel hop may be higher frequency than the actual displacement motion of the suspension

At the end of my previous post, there is about 33 seconds worth of data, sampled @ 100HZ, if I wanted to use Matlab to do FFT on various parts of the data I was thinking I could pad 0's on the end of the data of 3283 elements to get it up to 2^12 elements (4096)

The data contains a basic driving scenario, but with me hitting 6 to 9 potholes with my car (OUCH) lol, also there was some rough patches in the road,

Matlab would be able to do FFT on the whole piece of data right? I'll have to research that haha

*Just found out Matlab can directly import data from a CSV file nice!! No wonder this program is like $3000 lol, I have the student version though

You might be right about the A-arm, I'm not sure what wheel hop may be higher frequency than the actual displacement motion of the suspension

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

I got SciDAVis to do an FFT on the whole data set and it must have filled the arrays with zeros to get to 4096, as you expected. There is a sharp peak at 2Hz and a broad one at 13Hz. The former might be pavement section dividers and the later is roughness and suspension oscillations. You can pull out sections of the total data in blocks of 2^n and do FFTs on them. It will be necessary to characterize each type of pavement defect if you want to use the transform to help build individual filters.

The double integral works but I didn't get the displacement magnitude I expected. An A-frame mount might solve both problems.

Warm here in FL today at 78°F and wind from the south with gusts to 25MPH. We have a strong cold front approaching so it will be rock-n-roll tonight.

The double integral works but I didn't get the displacement magnitude I expected. An A-frame mount might solve both problems.

Warm here in FL today at 78°F and wind from the south with gusts to 25MPH. We have a strong cold front approaching so it will be rock-n-roll tonight.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Wow thanks :)

Anyway to share the SciDavis script? I downloaded it as a free alternative to matlab. Looks quite interesting,

to do the FFT code in it, and how would I pull individual sections of 2^n in sciDavis? Use a loop in the matrix?

What displacement magnitude did you achieve? The data is in G-force, would it have to be scaled to get meters or cm as displacement?

Anyway to share the SciDavis script? I downloaded it as a free alternative to matlab. Looks quite interesting,

to do the FFT code in it, and how would I pull individual sections of 2^n in sciDavis? Use a loop in the matrix?

What displacement magnitude did you achieve? The data is in G-force, would it have to be scaled to get meters or cm as displacement?

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

SciDAVis has lots of capabilities but many are not obvious. Every time I use it I find something new. Many features can be found by right-clicking various objects in the tables and graphs. I use it because it's available in both Windows and Linux, and free. It was probably created at a university for engineering student use.

The FFT is started by just highlighting the graph with the plotted data then click menu item Analysis/FFT.

I get a peak displacement of about 2" of a jolt at 26.61 seconds. Maybe that's correct for a dashboard mounted sensor.

Here is the formula to get the integral of Y1(acceleration) into a new column Y2(velocity(ft/sec)).

col("Velocity")+(col("Acceleration")*0.01*32)

Right-click the top of column Y1 and add a new column Y2. In the properties window at the right end of the data area, click the Formula tab. In that window, paste the above formula then click Apply. The new column will be filled with the calculated data. Next, left-click the top of the X column and ctrl-click Y2. At the top menu , click Plot lines and symbols. You will then get the new graph of velocity. Do this again with another new column and integrate velocity into displacement with a scale factor of 12 for inches. The two column arguments in the column Y2 formula need to point to Displacement(Y3) and Velocity(Y2).

I'll try sending you the .sciprj file but it's 4.7MB with the four data sets, X, Y1, Y2, Y3. I don't know if a private message will take attachments.

The FFT is started by just highlighting the graph with the plotted data then click menu item Analysis/FFT.

I get a peak displacement of about 2" of a jolt at 26.61 seconds. Maybe that's correct for a dashboard mounted sensor.

Here is the formula to get the integral of Y1(acceleration) into a new column Y2(velocity(ft/sec)).

col("Velocity")+(col("Acceleration")*0.01*32)

Right-click the top of column Y1 and add a new column Y2. In the properties window at the right end of the data area, click the Formula tab. In that window, paste the above formula then click Apply. The new column will be filled with the calculated data. Next, left-click the top of the X column and ctrl-click Y2. At the top menu , click Plot lines and symbols. You will then get the new graph of velocity. Do this again with another new column and integrate velocity into displacement with a scale factor of 12 for inches. The two column arguments in the column Y2 formula need to point to Displacement(Y3) and Velocity(Y2).

I'll try sending you the .sciprj file but it's 4.7MB with the four data sets, X, Y1, Y2, Y3. I don't know if a private message will take attachments.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Thanks bro :)

I did some FFT I got the same dominate frequencies of 2HZ and 12 to 13HZ peaks, not sure what the 12 HZ peaks are could it be the wheel hope of the tires? or the actual resonant frequency of the car?

Then I applied a bandstop filter of the Low of 2HZ, and a High of 50HZ data looks really clean, but I would have to find a way to apply one in software or in analog with a steep roll off since SciDavis is assuming a perfect filter

I did some FFT I got the same dominate frequencies of 2HZ and 12 to 13HZ peaks, not sure what the 12 HZ peaks are could it be the wheel hope of the tires? or the actual resonant frequency of the car?

Then I applied a bandstop filter of the Low of 2HZ, and a High of 50HZ data looks really clean, but I would have to find a way to apply one in software or in analog with a steep roll off since SciDavis is assuming a perfect filter

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

I would not bother with an analog filter using op-amps as it will be too difficult to adjust and get the right values. The filter link I provided earlier is a good source of numerous designs and easy to implement in the Arduino. What you're getting now might be mainly resonance in the vehicle suspension system. Continue with the raw data and SciDAVis but try a sensor on the A-frame. In that location, you should start to see more of the pavement conditions and less of suspension artifacts. One result should be a much higher amplitude and better shape in the second integral, displacement.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Seems like The actual pothole events s are the higher frequency components:

HIGH PASS FILTER @ 13HZ RED

HIGH PASS FILTER @ 13HZ RED

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

The dominant noise is the broad 13Hz FFT peak but a burst in that value is a good indicator. Try integrating the absolute value of velocity. The burst will have higher energy than the road noise. I'll give it a try here later this morning.

To isolate pieces of the total data set there should be a windowing function, that I haven't found yet. Another trick is to copy the first Y1 column to another, Y2, delete the parts you don't want, then slide it up to the top. You can then plot X and Y2.

To isolate pieces of the total data set there should be a windowing function, that I haven't found yet. Another trick is to copy the first Y1 column to another, Y2, delete the parts you don't want, then slide it up to the top. You can then plot X and Y2.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

You can plot a windowed set of data by highlighting that portion of the Y column and do an Edit/Copy. Then create a new column by right-clicking any Y column heading and select Add Column. Hightlight the top cell of the new column and use Edit/Paste to add the data. Then plot X and the new column.

The integral of abs(velocity) didn't produce anything astounding but the same trick on displacement or another integral of energy might work and produce a notable step. Will try that later.

The integral of abs(velocity) didn't produce anything astounding but the same trick on displacement or another integral of energy might work and produce a notable step. Will try that later.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Thanks man, great ideas too :)

They just built a new walmart around my apartment not open yet, the parking lot is smooth and level. I was thinking of going up there today and getting smooth road data about at least 15 seconds worth. Maybe that will tell us what the inherent noise is to filter out to isolate the bumps

I'm having trouble getting the displacement to work in SciDav, if possible could you email me the script? I can't figure out how to private message on here my email address haha

They just built a new walmart around my apartment not open yet, the parking lot is smooth and level. I was thinking of going up there today and getting smooth road data about at least 15 seconds worth. Maybe that will tell us what the inherent noise is to filter out to isolate the bumps

I'm having trouble getting the displacement to work in SciDav, if possible could you email me the script? I can't figure out how to private message on here my email address haha

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

The private mail function on this board is turned off due to lack of robot/spam prevention.

I am also having trouble getting the numerical integration to work. My previous plots are not correct. The summation value is OK using the column statistics item in Menu/Analysis but the individual cell values are wrong. I'll work on it today.

I am also having trouble getting the numerical integration to work. My previous plots are not correct. The summation value is OK using the column statistics item in Menu/Analysis but the individual cell values are wrong. I'll work on it today.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Have not found a way to do the numerical integral. Looks like one possibility is to use the muParser or Python scripting language. The other way might be to convert the table to a matrix using Menu/Table/ConvertToMatrix then use row and column indexes to do a running sum of the acceleration to get velocity, with appropriate scaling, then velocity to get displacement. Column statistics will give you the data for that particular set but does not plot the results.

I'll try a few things this weekend.

I'll try a few things this weekend.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

Re: Pothole data smoothing and detection of accelerometer data

Thanks man :)

It seems to be counter-intuitive the suspension should move a lot slower than a 10 to 13 HZ dominant frequencies in the FFT that would cause motion-sickness I believe

UPDATE:

As per friends suggestions, I used the full bandwidth of the accelerometer of 1000HZ since 50HZ LPF might have been cutting off some data and used the maximum sampling rate I could get on the arduino.

FFT:

FFT UNFILTERED DATA FULL BANDWIDTH of ACCELEROMETER:

here is a sample piece of data of the pothole event and some bumps and road noise around it:

UNFILTERED DATA POTHOLE EVENT

Added the Diode envelope detector circuit, output looks the same... The accelerometer always output 0 to 3.3Volts not negative... I based this idea on filtering and holding the amplitude of the signal like in radio, but the sensor doesn't go negative voltage. the output didn't change much at all. I picked the RC time constant to be around 2mS, I'm sampling at 2mS 500 Samples/ second The accelerometer voltage is always between 0 and 3.3V though... never goes negative so the diode wouldn't work?

I did not see a HUGE different in increasing the sampling from 100HZ to 500HZ, the signals looks almost the same. Also, the FFT suggests anything over 55HZ or so can be cutoff, the pothole event would be a high frequency event though kinda like a step input? I'm not sure how I can reliably filter and detect the peaks of the pothole event form the surrounding road noise

It seems to be counter-intuitive the suspension should move a lot slower than a 10 to 13 HZ dominant frequencies in the FFT that would cause motion-sickness I believe

UPDATE:

As per friends suggestions, I used the full bandwidth of the accelerometer of 1000HZ since 50HZ LPF might have been cutting off some data and used the maximum sampling rate I could get on the arduino.

FFT:

FFT UNFILTERED DATA FULL BANDWIDTH of ACCELEROMETER:

here is a sample piece of data of the pothole event and some bumps and road noise around it:

UNFILTERED DATA POTHOLE EVENT

Added the Diode envelope detector circuit, output looks the same... The accelerometer always output 0 to 3.3Volts not negative... I based this idea on filtering and holding the amplitude of the signal like in radio, but the sensor doesn't go negative voltage. the output didn't change much at all. I picked the RC time constant to be around 2mS, I'm sampling at 2mS 500 Samples/ second The accelerometer voltage is always between 0 and 3.3V though... never goes negative so the diode wouldn't work?

I did not see a HUGE different in increasing the sampling from 100HZ to 500HZ, the signals looks almost the same. Also, the FFT suggests anything over 55HZ or so can be cutoff, the pothole event would be a high frequency event though kinda like a step input? I'm not sure how I can reliably filter and detect the peaks of the pothole event form the surrounding road noise

- zacharoni16
**Posts:**25**Joined:**Thu Aug 16, 2012 6:21 pm**Location:**Washinston, PA

Re: Pothole data smoothing and detection of accelerometer data

The matrix scheme will probably work by doing a running sum of column 5, velocity, into column 6, displacement. The positions in the matrix can be referred to as cell(i,j) but I find no way to do the running sum over a range of rows, i=1 to i=last row. The program manual is for version 0.1 and not 0.2.4. The menus and tables are much different. If you can find a way to run the row index from top to bottom then we can make it work.

- Arctic_Eddie
**Posts:**208**Joined:**Tue Feb 28, 2012 6:01 pm**Location:**St. Petersburg, FL

55 posts
• Page **2** of **4** • 1, **2**, 3, 4