Electronic – arduino logging acceleration data

accelerometer

I had a general question about logging accelerometer data on the Arduino or any microcontroller.

I had a KXPS5-3157 accelerometer hooked up analog mode to measure z-axis vertical acceleration in a car going over bumps.

My question is that would I have to have an accurate time reference like a real time clock or some piece of code that kept accurate time to plot acceleration G force? Since acceleration is based on time.

I want to get the vertical acceleration of potholes, but to make the data meaningful I want to plot it, but acceleration is based on time, so is it possible to have the Arduino log it with time? Or it doesn't matter?

Best Answer

What you're worried about is sampling jitter. I wouldn't sweat it for this application; running the sampling code in a loop will tie the sample time to the crystal oscillator on the Arduino, which should have more than adequate stability for your application.

Sample rate is something you should think more about, however. In order to resolve the acceleration from hitting a pothole, which is generally a short event, I'd recommend sampling rates in the range of 200Hz - 2kHz. The higher the better, at the cost of increased storage to hold all of the samples.

At lower sampling frequencies, you'll still see an acceleration spike from hitting the pothole, but it's likely that you'll miss the actual peak of the event due to sampling error. As a result, it will look less severe in your data than it actually was.

As an aside, it's fun to look at what your suspension does for you. Mount a high fullscale accelerometer directly to the unsprung mass (i.e. on your wheel hub). That will show you what the acceleration looks like before it's mechanically filtered by your suspension.