Accelerometer – ADXL335

Check out accelerometer comparison from sparkfun

The ADXL335 is a small, thin, low power, complete 3-axis accelerometer with signal conditioned voltage outputs. It measures acceleration with a minimum full-scale range of ±3 g. It can measure the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion, shock, or vibration.

Board comes fully assembled and tested with external components installed. The included 0.1uF capacitors set the bandwidth of each axis to 50Hz.

There is no on-board regulation, provided power should be between 1.8 and 3.6VDC.

DO NOT CONNECT THIS STRAIGHT TO THE BU0836 JOYSTICK CONTROLLER! THE BU0836 OPERATES AT 5V AND WILL FRY THIS SENSOR IF CONNECTED TO IT!

DO NOT CONNECT THIS TO THE 5V PIN ON THE ARDUINO! USE THE 3.3V PIN TO POWER THIS SENSOR!

Arduino Connection

  • VCC to 3V3
  • GND to GND
  • X to Analog In 0
  • Y to Analog In 1
  • Z to Analog In 2
  • ST not connected (self-test)

Arduino Code

// Reads values from an accelerometer with X, Y and Z connected to analog
// inputs 0, 1 and 2 respectively and prints out the values via the serial port.
int x, y, z;

void setup()
{
Serial.begin(9600);           // sets the serial port to 9600
}
void loop()
{
x = analogRead(0);       // read analog input pin 0
y = analogRead(1);       // read analog input pin 1
z = analogRead(2);       // read analog input pin 2
Serial.print("accelerations are x, y, z: ");
Serial.print(x, DEC);    // print the acceleration in the X axis
Serial.print(" ");       // prints a space between the numbers
Serial.print(y, DEC);    // print the acceleration in the Y axis
Serial.print(" ");       // prints a space between the numbers
Serial.println(z, DEC);  // print the acceleration in the Z axis
delay(100);              // wait 100ms for next reading
}