Arduino logging vertical acceleration data

accelerometerarduinofftsignal

I'm doing a project where I want to start and stop recording of accelerometer data set up to measure the vertical acceleration Z axis of a car's suspension movement when it hits a pothole. I want to be able to do FFT on the accelerometer data and try to find a "pattern" that represents a pothole event so I can detect potholes from other events just as car door slamming shut, etc…

My question is I'm not sure what sampling rate I would need to be sampling to get the SHM of the suspension when it hits the pothole. Right now I just have my accelerometer a KXPS5-3157 in analog mode connected to my Arduino and I have a button that you hold in to have it log data, when you let go of the button it will stop logging and start a new session. I do this so I can press and hold the button right before I drive over a pothole to get the data.

Should I use Timer1 for example? I think I would need accurate timing with the acceleration data to make it meaingful? Since Acceleration is with time, I'm not sure what sampling rate or how to make the Arduino do like 1 sample/sec or 10 samples/sec. It seems like the frequency of the pothole with the suspension operations in the 5 to 10HZ range of mechanical motion. Rarely anything after 13HZ dies out fast below 3dB so it can be ignored.

Any idea on how to detect pothole events? Not even sure FFT would be the right direction. I want to plot the data from the serial port, but plotting it right now I just have acceleration with no time reference???? I think I need a time reference with the data

Best Answer

Yes, you need a time reference. A timer interrupt which sets off the ADC conversion is usually the best bet. Its also possible to let the ADC free-run and use periodic (every n-th) reading. That makes for OK time data, if not great.

As for the frequency of sampling, what you need to figure out is the bandwidth that you need. Suppose the vibrations that ensue are have a frequency of x Hz, you would need atleast 2x Hz to reconstruct a vibration assuming its purely sinusoidal. This is sort of a theoretical limit. Since a pothole isn't going to produce a sinusoidal vibration, and theory doesn't always translate directly to real life, you'd probably need to sample at atleast 10x Hz.

For something like a car, I would guess the vibrations to be in the order of, say, 10Hz to 1KHz. (For reference, buildings generally vibrate at sub 1-Hz. Small metallic objects designed to withstand vibration and things like rockets would vibrate in the 50-200 Hz range. Tuning forks vibrate at Kilohertz, usually , like the 32.768 KHz tuning forks commonly used in electronics for time keeping, and quartz crystals vibrate in the MHz range). So a sampling rate of above 10KHz is porbably more than enough. You could try with less and see if it works, but I really haven't done any calculations for cars to be sure. I'm fairly confident 1KHz should be as far as the vibrations should go, and it'll probably be less than than in reality.

EDIT : If you're only really interested in the large scale vibration of the car, as you say 10-13Hz is what you are interested in, 100Hz should be enough. I'd sample at 1KHz to be safe.