A quick project to use the freescale accelerometer sensor with the arduino used, as always, with the bare gcc + avrlibc and avrdude to write the firmware.

First keep in mind that the internet is full of projects like this which uses the same device.

The intention is to read with the analog to digital converters the 3 axis (xyz) value and print them via the serial port only if these values have changed of a certain amount (#define CHANGED).

Schematics edited with fritzing:

image

If you have a different version of the mounted device, like this:

image

then just keep the correct pin in use, they should have the same nomenclature. In this case we have the x,y,z axis pins which have to be connected to the A0,A1,A2 Analog input pin in the arduino. I've used the 3V3 instead of the 5V, which should be fine as well. Just pull-up the sleep pin of the device.

See the code on my gitweb site. The serial port is fixed to 115200,n,8,1.

-> Send a comment: Unless requested otherwise I may add it, or some extract, to this page.