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.
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.