The ADXL345 is a small, thin, low-power, 3-axis accelerometer capable of high-resolution (13-bit) measurements at up to ±16g. It is designed for applications requiring precise motion sensing, tilt detection, and gesture recognition. The device supports both I2C and SPI communication protocols, making it versatile and easy to integrate into a wide range of projects.
The ADXL345 offers a robust set of features and specifications that make it suitable for various applications. Below are the key technical details:
Parameter | Value |
---|---|
Supply Voltage (VDD) | 2.0V to 3.6V |
I/O Voltage (VDDIO) | 1.7V to VDD |
Power Consumption | 40 µA in measurement mode |
Measurement Range | ±2g, ±4g, ±8g, ±16g |
Resolution | 13-bit |
Communication Protocols | I2C, SPI |
Operating Temperature | -40°C to +85°C |
Data Output Rate | 0.1 Hz to 3200 Hz |
The ADXL345 is typically available in a 14-pin LGA package. Below is the pinout description:
Pin Number | Pin Name | Description |
---|---|---|
1 | VDD | Power supply (2.0V to 3.6V) |
2 | GND | Ground |
3 | CS | Chip Select (SPI mode) or I2C Address Select |
4 | INT1 | Interrupt 1 output |
5 | INT2 | Interrupt 2 output |
6 | SCL/SCLK | I2C Clock / SPI Clock |
7 | SDA/SDI/SDO | I2C Data / SPI Data In / Data Out |
8-14 | NC | No Connection (leave unconnected) |
The ADXL345 can be used in a variety of circuits and applications. Below are the steps to integrate and use the component effectively:
Wiring: Connect the ADXL345 to the Arduino UNO as follows:
Install Required Libraries: Use the Adafruit_ADXL345
library for easy integration. Install it via the Arduino Library Manager.
Example Code: Below is a sample Arduino sketch to read acceleration data from the ADXL345:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>
// Create an ADXL345 object
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345);
void setup() {
Serial.begin(9600);
// Initialize the ADXL345
if (!accel.begin()) {
Serial.println("Failed to find ADXL345 chip");
while (1); // Halt if the sensor is not detected
}
Serial.println("ADXL345 initialized successfully!");
// Set range to ±16g for maximum sensitivity
accel.setRange(ADXL345_RANGE_16_G);
}
void loop() {
sensors_event_t event;
accel.getEvent(&event); // Get acceleration data
// Print acceleration values for X, Y, and Z axes
Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" m/s^2 ");
Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" m/s^2 ");
Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.println(" m/s^2");
delay(500); // Wait for 500ms before the next reading
}
No Data Output
Inconsistent Readings
Device Not Detected
0x53
) and try replacing the sensor.Q: Can the ADXL345 operate at 5V?
A: No, the ADXL345 operates at a maximum of 3.6V. Use a voltage regulator or level shifter if interfacing with a 5V system.
Q: How do I switch between I2C and SPI modes?
A: The communication mode is determined by the CS pin. Pull CS high for I2C mode or low for SPI mode.
Q: What is the maximum sampling rate of the ADXL345?
A: The ADXL345 supports a maximum data output rate of 3200 Hz.
By following this documentation, you can effectively integrate and use the ADXL345 accelerometer in your projects.