Accel-only breakout board (working)

By: paul

2010-06-13 10:10:39

Boards from Laen's PCB group order arrived today, and I'm happy to say the Accel-only breakout board works. This was inspired by Sott's design, but with support for 5 volts, and using I2C. I'll have 4 more kits at the next Monday meetup. The kit has all parts except the MMA7455 chip, and the kit's FREE if you build it or wreck it trying. So far, I've only written a tiny test program. Here's the code:
#include <Wire.h>

void setup() {
  // enter measurement mode

void loop() {
  signed char x, y, z;
  Wire.requestFrom(29, 3);
  while (!Wire.available()) /* wait */ ;
  x =  Wire.receive();
  while (!Wire.available()) /* wait */ ;
  y =  Wire.receive();
  while (!Wire.available()) /* wait */ ;
  z =  Wire.receive();
  Serial.print("x = ");
  Serial.print(", y = ");
  Serial.print(", z = ");

Obviously there's quite a lot more that can be done with the code, but at least this prints raw numbers and they clearly do change if you move the board around, or tilt it on axis. Clearly quite a lot more software work is needed to turn the raw acceleration numbers into useful X, Y, Z displacement and/or tilt angles.
Back to archive index