Wednesday, July 18, 2012

Putting Everything Together Part 7: Accelerometer

Just finished the code for the BMA180 accelerometer today. I rewrote Dr. Bunn's code for the accelerometer into a library. The program will initialize the BMA180 and then output the acceleration felt in the horizontal and vertical axes (AH, AV). Here's a sample of the code (with the accelerometer on the table monitoring natural vibrations):

The Fritizing picture looks like this:
Since I didn't want to spend all the time making a custom part for the BMA180, I just used the generic "mystery part". From left to right, the pins on the custom generated BMA180 are: VDD, GND, INT, CS, SCK, SDO, SDI, VIO. These should match the order of the pins on the real model as well.

The blue wire connects to 3.3V pin on the Arduino Duemilanove, the black wires connect to the GND pin, the red wire connects to A4 (SDA) and the orange wire connects to A5 (SCL). Thus, on the Arduino Mega/ADK, we would connect the red wire to pin 20 and the orange wire to pin 21.