I was hoping to add an accelerometer to Wallie to help detect collisions with obstacles. Alas it’s not to be.

I had purchased a breakout board for the MMA8452Q accelerometer from sparkfun. It was on clearance at the time so I bought it on a whim. Luckily it’s one of the more sensitive accelerometers (2g) so I was thinking it should work for my purposes.

I soldered on the headers and wired it up.



It’s a 3.3V device but it seems you can connect it to the Arduino pins with no problems. However, you have to power it from the Arduino’s 3.3V pin and not 5V.

The chip talks to the Arduino through I2C. If you look at the photo yo can make out that SDA and SCL are connected to A4 and A5, which is the I2C bus. Also make sure you never connect it to any pins that are outputting 5V, i.e. if you happen to run a sketch that sets A4 to output mode and sets it to max value then you’ll probably ruin the device so beware.

There is already a well written MMA8452Q library that handles reading and writing to the device. The accelerometer has a lot of options. You can checkout the full specs yourself.

In the end, however, the sensitivity I needed to detect Wallie stopping (i.e. hitting something) was so high that the device was also picking up the natural vibrations of the whole machine as it moved. Drats.

I need to find some other method to detect lack of forward motion. Maybe something like the sensor in a computer mouse?

Still it was useful to learn how to use the accelerometer.  It’s a very cool gadget.


Comments welcome

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s