TRIPLE AXIS ACCELEROMETER(ADXL345)
TRIPLE AXIS ACCELEROMETER(ADXL345)
The triple axis accelerometer is used to sense
the tilt in position on three dimensional axis.The ADXL345 is a small, thin,
low power, three-axis MEMS accelerometer with high resolution (13-bit)
measurement. It measures the static acceleration of gravity in tilt-sensing
applications, as well as dynamic acceleration resulting from motion or shock. We can interface tilt sensor with Arduino to automatically identify the
tilt.
Application:
- Accelerometer is used for motion sensing.
- It is used in navigation analysis.
- It can be used in GPS with e-compass systems.
Sample Project With Arduino:
In this we going to identify the axis i.e. to know the position like whether it is in landscape or portrait using the ADXL 345 sensor.
Materials required:
- ARDUINO UNO
- ADXL345
- Bread Board
- Jumper wires
Circuit:
Code:
#include<wire.h>
#define
accel_module (0x53)
byte values[6] ;
char output[512];
void
setup(){
Wire.begin();
Serial.begin(9600);
Wire.beginTransmission(accel_module);
Wire.write(0x2D);
Wire.write(0);
Wire.endTransmission();
Wire.beginTransmission(accel_module);
Wire.write(0x2D);
Wire.write(16);
Wire.endTransmission();
Wire.beginTransmission(accel_module);
Wire.write(0x2D);
Wire.write(8);
Wire.endTransmission();
}
void
loop(){
int xyzregister = 0x32;
int x, y, z;
Wire.beginTransmission(accel_module);
Wire.write(xyzregister);
Wire.endTransmission();
Wire.beginTransmission(accel_module);
Wire.requestFrom(accel_module, 6);
int i = 0;
while(Wire.available()){
values[i] = Wire.read();
i++;
}
Comments
Post a Comment