In a previous project, I experienced great frustration in attempting to implement an accelerometer properly. The intended application was to use the device in a vehicle collision detection system, where sudden chassis impacts would induce detectable swings in gravitational force. With unreliable, unpredictable, and unremarkable results from the accelerometer, the collision detection system stands as the failing-point in that project.
Had I known then what I know now, I would have utilized MATLAB to quickly create a GUI application. One that visualizes accelerometer readings, applies filtering, and allows for threshold testing. Had I possessed this application while implementing collision detection, I may have been able to eliminate unwanted data noise and establish a reliable demarcation between simple body vibrations and actual collisions. Fortunately, I am now making great progress with MATLAB/Arduino experimentation, and have created a diagnostic tool that would have spared my teammates and I the uneccessary stress induced by countless false-positives and many sleepless nights.
The graphic above depicts my application written with MATLAB, where the following options are available:
- Concurrent visualizations of both raw and filtered data.
- Choice between Simple Moving Average (SMA) and Exponential Moving Average (EMA).
- Adjustable filter scaling factors (taps and alpha).
- Data displays of raw/filtered accelerometer readings and threshold pass-counts.
- Start/stop/reset options for threshold pass-counts.
The program is quite useful in obtaining accelerometer behavior and tuning filter/threshold values to accommodate specific use-cases. Currently, selection of threshold indicators (dashed lines) and axis views (solid lines) are set programmatically. I am currently working to implement these features, along with others, into a complete application — an accelerometer test bench...