LSM9DS0 As Impact Sensor

A recent project of ours involved using a sensor to detect when a small remote-controlled car hits an obstacle. What better sensor to use than the Adafruit LSM9DS0, a sensor-equipped with a 3-axis accelerometer. There are a few alternative sensors available with the concept of detecting impacts, especially when used on a small scale. Of course, the concept of obstacle avoidance is also an option, but we’ll save that for another project.

Getting Started

To start off the project, we needed to figure out what materials we need to get things going. We used the following:

1 x Arduino Uno R3
1 x Arduino Proto Shield
1 x Adafruit LSM9DS0
1 x Set of wires

Assembly

Before all the soldering and attaching of components, we had to decide on the pin configuration first. With the LSM9DS0, we can simply follow the Adafruit guide found here. The connection is as follows:

ArduinoLSM9DS0
5VVin
GNDGND
A4SDA
A5SCL

When the wiring is done, it’s time to test the setup. To do so, we first have to download the Adafruit LSM9DS0 library in our Arduino IDE. If you’re not sure how to do so, follow the Adafruit guide here.
Select and upload the “lsm9dsotest” code. After the successful upload, you should see the following in the serial monitor:

And with that, the initial assembly is done.

Impact Sensing Code

The most basic explanation of an impact is that a collision occurs between two objects, and both objects experience an acceleration in the opposite direction. Although not the most effective and scientific way to sense an impact, what we did is to detect when a specific value of acceleration is experienced in the opposite direction of the car’s movement, an alert is given. So with that, we create the code.

See also  Rain Notifier using Arduino

Prototype

With all the preparations done, we finalized the assembly. Using an Arduino Proto Shield is an excellent way to create a prototype without soldering and provide more room for expanding and adding more components. In this case, however, we chose to solder the parts due to the collisions that the assembly will be going through.

With this setup, when the accelerometer detects an acceleration towards the back, the LED on the top right corner of the Proto Shield will flash. With that, we have our oversimplified impact sensor.