

The ADXL345 is a small, thin, low-power, 3-axis accelerometer with a digital output. It is capable of measuring acceleration in three dimensions (X, Y, and Z axes) with high resolution (13-bit) and a wide measurement range of ±2 g, ±4 g, ±8 g, or ±16 g. The device communicates via I²C or SPI interfaces, making it versatile and easy to integrate into a variety of systems.








The ADXL345 is designed for low-power operation and high performance. Below are its key technical details:
| Parameter | Value |
|---|---|
| Supply Voltage (VDD) | 2.0 V to 3.6 V |
| I/O Voltage (VDDIO) | 1.7 V to VDD |
| Measurement Range | ±2 g, ±4 g, ±8 g, ±16 g |
| Resolution | 13-bit |
| Communication Interface | I²C (up to 400 kHz) or SPI (up to 5 MHz) |
| Power Consumption | 40 µA in measurement mode, 0.1 µA in standby |
| Operating Temperature Range | -40°C to +85°C |
| Dimensions | 3 mm × 5 mm × 1 mm (L × W × H) |
The ADXL345 is typically available in a 14-pin LGA package. Below is the pinout and description:
| Pin | Name | Description |
|---|---|---|
| 1 | VDD | Power supply (2.0 V to 3.6 V) |
| 2 | GND | Ground |
| 3 | CS | Chip Select (SPI mode) or I²C Address Select |
| 4 | INT1 | Interrupt 1 output |
| 5 | INT2 | Interrupt 2 output |
| 6 | SCL/SCLK | I²C Clock / SPI Serial Clock |
| 7 | SDA/SDI/SDO | I²C Data / SPI Data In / Data Out |
| 8-14 | NC | No Connect (leave unconnected) |
Below is an example of how to interface the ADXL345 with an Arduino UNO using I²C:
#include <Wire.h> // Include the Wire library for I²C communication
#define ADXL345_ADDRESS 0x53 // I²C address of the ADXL345
#define POWER_CTL 0x2D // Power control register
#define DATA_FORMAT 0x31 // Data format register
#define DATAX0 0x32 // X-axis data register (low byte)
// Function to initialize the ADXL345
void setupADXL345() {
Wire.begin(); // Initialize I²C communication
Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(POWER_CTL); // Select the power control register
Wire.write(0x08); // Set the device to measurement mode
Wire.endTransmission();
Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(DATA_FORMAT); // Select the data format register
Wire.write(0x01); // Set range to ±4 g
Wire.endTransmission();
}
void setup() {
Serial.begin(9600); // Initialize serial communication
setupADXL345(); // Initialize the ADXL345
}
void loop() {
int16_t x, y, z;
// Read X-axis data
Wire.beginTransmission(ADXL345_ADDRESS);
Wire.write(DATAX0); // Request starting from the X-axis low byte
Wire.endTransmission(false);
Wire.requestFrom(ADXL345_ADDRESS, 6); // Request 6 bytes (X, Y, Z)
if (Wire.available() == 6) {
x = Wire.read() | (Wire.read() << 8); // Combine low and high bytes
y = Wire.read() | (Wire.read() << 8);
z = Wire.read() | (Wire.read() << 8);
}
// Print the acceleration values
Serial.print("X: "); Serial.print(x);
Serial.print(" Y: "); Serial.print(y);
Serial.print(" Z: "); Serial.println(z);
delay(500); // Wait for 500 ms
}
No Communication with the ADXL345
Incorrect or No Data Output
High Noise in Readings
Interrupts Not Triggering
Q: Can the ADXL345 operate at 5 V?
A: No, the maximum supply voltage is 3.6 V. Use a voltage regulator or level shifter if needed.
Q: How do I change the measurement range?
A: Write to the DATA_FORMAT register to set the desired range (±2 g, ±4 g, etc.).
Q: What is the maximum sampling rate?
A: The ADXL345 supports a maximum output data rate of 3200 Hz.
Q: Can I use both I²C and SPI simultaneously?
A: No, you must choose one communication interface at a time.