Quantity | 3+ units | 10+ units | 30+ units | 50+ units | More |
---|---|---|---|---|---|
Price /Unit | $7.23 | $7.08 | $6.86 | $6.57 | Contact US |
Arduino Triple Axis Accelerometer ADXL345 Sensor Board Module
Breakout board for the Analog Device ADXL345. The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.
The ADXL345 is well suited to measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0°.
Several special sensing functions are provided. Activity and inactivity sensing detect the presence or lack of motion and if the acceleration on any axis exceeds a user-set level. Tap sensing detects single and double taps. Free-fall sensing detects if the device is falling. These functions can be mapped to one of two interrupt output pins. An integrated, patent pending 32-level first in, first out (FIFO) buffer can be used to store data to minimize host processor intervention. Low power modes enable intelligent motion-based power management with threshold sensing and active acceleration measurement at extremely low power dissipation.
Specifications:
- 2.0-3.6VDC Supply Voltage
- Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V
- Tap/Double Tap Detection
- Free-Fall Detection
- SPI and I2C interfaces
Documents: DataSheet
Ardiono Simple Code:
//I2C (sparkfun breakout)
#define Register_ID 0
#define Register_2D 0x2D
#define Register_X0 0x32
#define Register_X1 0x33
#define Register_Y0 0x34
#define Register_Y1 0x35
#define Register_Z0 0x36
#define Register_Z1 0x37
#include
int ADXAddress = 0xA7 >> 1; // the default 7-bit slave address
int reading = 0;
int val=0;
int X0,X1,X_out;
int Y0,Y1,Y_out;
int Z1,Z0,Z_out;
double Xg,Yg,Zg;
void setup()
{
Wire.begin();
Serial.begin(19200);
delay(100);
// enable to measute g data
Wire.beginTransmission(ADXAddress);
Wire.send(Register_2D);
Wire.send(8); //measuring enable
Wire.endTransmission(); // stop transmitting
}
void loop()
{
//--------------X
Wire.beginTransmission(ADXAddress); // transmit to device
Wire.send(Register_X0);
Wire.send(Register_X1);
Wire.endTransmission();
Wire.requestFrom(ADXAddress,2);
if(Wire.available()<=2)
{
X0 = Wire.receive();
X1 = Wire.receive();
X1=X1<<8;
X_out=X0+X1;
}
//------------------Y
Wire.beginTransmission(ADXAddress); // transmit to device
Wire.send(Register_Y0);
Wire.send(Register_Y1);
Wire.endTransmission();
Wire.requestFrom(ADXAddress,2);
if(Wire.available()<=2)
{
Y0 = Wire.receive();
Y1 = Wire.receive();
Y1=Y1<<8;
Y_out=Y0+Y1;
}
//------------------Z
Wire.beginTransmission(ADXAddress); // transmit to device
Wire.send(Register_Z0);
Wire.send(Register_Z1);
Wire.endTransmission();
Wire.requestFrom(ADXAddress,2);
if(Wire.available()<=2)
{
Z0 = Wire.receive();
Z1 = Wire.receive();
Z1=Z1<<8;
Z_out=Z0+Z1;
}
//
Xg=X_out/256.0;
Yg=Y_out/256.0;
Zg=Z_out/256.0;
Serial.print("X= ");
Serial.print(Xg);
Serial.print(" ");
Serial.print("Y= ");
Serial.print(Yg);
Serial.print(" ");
Serial.print("Z= ");
Serial.print(Zg);
Serial.println(" ");
delay(200);
}
Package Included:
- 1 x Triple Axis Accelerometer ADXL345 Module