ADXL345 Accelerometer Module
ADXL345 Accelerometer Module
The ADXL345 Accelerometer Module is a highly sensitive and accurate three-axis accelerometer module designed to measure static and dynamic accelerations, such as vibration, inclination, and shock. This module is based on the Analog Devices ADXL345 chip, which is a low-power, high-performance, and cost-effective accelerometer.
| The ADXL345 Accelerometer Module is used to measure the acceleration forces in three dimensions (x, y, and z axes) and convert them into electrical signals that can be easily read by a microcontroller or other digital devices. The module is capable of measuring both static and dynamic acceleration, making it suitable for a wide range of applications, including |
Vibration sensing and monitoring
Inclination and tilt measurement
Motion detection and tracking
Impact and shock detection
Gesture recognition
15 mm x 10 mm x 5 mm (L x W x H)
2 grams
The module has four mounting holes for easy attachment to a PCB or other surfaces.
-40C to +85C
| The ADXL345 Accelerometer Module is suitable for a wide range of applications, including |
Industrial automation and monitoring
Robotics and autonomous systems
Wearable devices and fitness trackers
Gaming and virtual reality
Consumer electronics and appliances
Automotive and aerospace systems
Overall, the ADXL345 Accelerometer Module is a high-performance, low-power, and cost-effective solution for measuring acceleration and orientation in a wide range of applications.
ADXL345 Accelerometer Module DocumentationOverviewThe ADXL345 Accelerometer Module is a small, low-power, 3-axis accelerometer with high sensitivity and resolution. It measures acceleration in three axes (X, Y, Z) and provides a digital output. The module is ideal for applications such as vibration monitoring, motion detection, and gesture recognition.Pinouts| Pin | Function |
| --- | --- |
| VCC | Power supply (3.3V or 5V) |
| GND | Ground |
| SCL | I2C clock |
| SDA | I2C data |
| INT1 | Interrupt output 1 |
| INT2 | Interrupt output 2 |CommunicationThe ADXL345 Accelerometer Module communicates with a microcontroller or single-board computer using the I2C protocol.Code Examples### Example 1: Basic Accelerometer Reading with ArduinoThis example shows how to read the acceleration values from the ADXL345 module using an Arduino board.```c++
#include <Wire.h>// Define the ADXL345 I2C address
#define ADXL345_ADDRESS 0x53void setup() {
Serial.begin(9600);
Wire.begin();
}void loop() {
// Read the acceleration values
int x, y, z;
Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(0x32); // X-axis register
Wire.endTransmission();
Wire.requestFrom(ADXL345_ADDRESS, 1);
x = Wire.read();Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(0x33); // Y-axis register
Wire.endTransmission();
Wire.requestFrom(ADXL345_ADDRESS, 1);
y = Wire.read();Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(0x34); // Z-axis register
Wire.endTransmission();
Wire.requestFrom(ADXL345_ADDRESS, 1);
z = Wire.read();// Print the acceleration values
Serial.print("Acceleration (g): ");
Serial.print("X = ");
Serial.print(x);
Serial.print(", Y = ");
Serial.print(y);
Serial.print(", Z = ");
Serial.println(z);delay(500);
}
```### Example 2: Motion Detection with Raspberry Pi (Python)This example demonstrates how to use the ADXL345 module to detect motion using a Raspberry Pi with Python.```python
import smbus
import time# Define the ADXL345 I2C address and bus
ADXL345_ADDRESS = 0x53
bus = smbus.SMBus(1)# Set the ADXL345 to measure acceleration in 2g range
bus.write_byte_data(ADXL345_ADDRESS, 0x2C, 0x08)while True:
# Read the acceleration values
x = bus.read_byte_data(ADXL345_ADDRESS, 0x32)
y = bus.read_byte_data(ADXL345_ADDRESS, 0x33)
z = bus.read_byte_data(ADXL345_ADDRESS, 0x34)# Calculate the acceleration magnitude
magnitude = (x2 + y2 + z2) 0.5# Check for motion
if magnitude > 0.5:
print("Motion detected!")
else:
print("No motion detected.")time.sleep(0.1)
```Additional ResourcesADXL345 Datasheet: [www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf](http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf)
Arduino Library for ADXL345: [github.com/adafruit/Adafruit_ADXL345](http://github.com/adafruit/Adafruit_ADXL345)
Raspberry Pi Python Library for ADXL345: [github.com/martinohanlon/py_i2c_axdl345](http://github.com/martinohanlon/py_i2c_axdl345)