Home PageAdxl335

ADXL335

The ADXL335 is a triple axis accelerometer with extremely low noise and power consumption – only 320uA!  The sensor has a full sensing range of +/-3g. Looking to buy or find the datasheetLook here.
I used the breakout board from sparkfun which is an easy way to connect it to the arduino. There is no on-board regulation, provided power should be between 1.8 and 3.6VDC. I cheated and still used the power pins from the arduino to power the board at 5v. The board comes fully assembled and tested with external components installed. This includes a 0.1uF capacitors set the bandwidth of each axis to 50Hz.

To test the functioning of the adxl335 accelerometer i used the program below and connected it to the arduino like this. Basically the VCC and GND pins are generated by the arduino analog PINS 4 and 5. Of course the software should take care of that and power the VCC to +5V and the GND to GND or else it will not work.  Below are some accelerometer readings collected by the positioning the y-axis of an ADXL335 2g accelerometer at various angles from the horizontal level. If  each axis is placed in the same plane the values should be the same. Of course if you alter the sensitivity the values will be different. With the axis horizontal (i.e. parallel to ground or 0°), the accelerometer reading should be around 512, but values at other angles will be different.  For different accelerometer (e.g. the ADXL302 5g one) the values will also be different. B ecause you know that straight down the accelerometer should read 1g you can also calibrate the values to g.

 

shop button

 Here is a screenshot of the ouput.

acceleration table

Here a picture of the setup.

ADXL335 software

Show »

/*
 ADXL3xx
 
 Reads an Analog Devices ADXL3xx accelerometer and communicates the
 acceleration to the computer.  The pins used are designed to be easily
 compatible with the breakout boards from Sparkfun, available from:
 http://www.sparkfun.com/commerce/categories.php?c=80

 http://www.arduino.cc/en/Tutorial/ADXL3xx

 The circuit:
 analog 0: accelerometer self test
 analog 1: z-axis
 analog 2: y-axis
 analog 3: x-axis
 analog 4: ground
 analog 5: vcc
 
 created 2 Jul 2008
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe 
 
 This example code is in the public domain.

*/

// these constants describe the pins. They won't change:
const int groundpin = 18;             // analog input pin 4 -- ground
const int powerpin = 19;              // analog input pin 5 -- voltage
const int xpin = A3;                  // x-axis of the accelerometer
const int ypin = A2;                  // y-axis
const int zpin = A1;                  // z-axis (only on 3-axis models)

void setup()
{
  // initialize the serial communications:
  Serial.begin(9600);

  // Provide ground and power by using the analog inputs as normal
  // digital pins. This makes it possible to directly connect the
  // breakout board to the Arduino. If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(groundpin, OUTPUT);
  pinMode(powerpin, OUTPUT);
  digitalWrite(groundpin, LOW); 
  digitalWrite(powerpin, HIGH);
}

void loop()
{
  // print the sensor values:
  Serial.print(analogRead(xpin));
  // print a tab between values:
  Serial.print("t");
  Serial.print(analogRead(ypin));
  // print a tab between values:
  Serial.print("t");
  Serial.print(analogRead(zpin));
  Serial.println();
  // delay before next reading:
  delay(100);
}

You can download it from here.

 

arduino adxl335adxl backadxl front

 

 


Leave a Reply to Anonymous Cancel reply