Overview

The ADXL345 is a small, thin, ultra-low power 3-axis MEMS accelerometer manufactured by Analog Devices. It measures static acceleration of gravity in tilt-sensing applications as well as dynamic acceleration resulting from motion, shock, or vibration.

It features high resolution up to 13 bits at ±16 g\pm 16\text{ g} (4 mg/LSB4\text{ mg/LSB} scale factor maintained across all ranges), an integrated 32-level FIFO buffer, activity/inactivity monitoring, tap/double-tap detection, and free-fall detection.

Quick reference

Module VCC3.3 V to 5.0 V DC (onboard LDO)
Chip VDD / VDDIO2.0 V to 3.6 V DC
Full-scale ranges±2 g,±4 g,±8 g,±16 g\pm 2\text{ g}, \pm 4\text{ g}, \pm 8\text{ g}, \pm 16\text{ g} (user selectable)
ADC resolution10-bit (fixed 10-bit at ±2g\pm 2\text{g}) up to 13-bit (FULL_RES mode)
Sensitivity3.9 mg/LSB3.9\text{ mg/LSB} (in FULL_RES mode)
Communication interfacesI2C (up to 400 kHz), 3-wire / 4-wire SPI (up to 5 MHz)
Default I2C address0x53 (ALT ADDRESS = LOW) / 0x1D (ALT ADDRESS = HIGH)
Measurement current145 µA active, 0.1 µA standby

Pinout

Standard GY-291 Breakout Header

PinNameTypeDescription
1VCCPowerSupply voltage (+3.3 V to +5.0 V DC)
2GNDPowerGround (0 V)
3CSDigital InputChip Select (HIGH = I2C Mode, LOW = SPI Mode)
4INT1Digital OutputProgrammable Interrupt 1 pin
5INT2Digital OutputProgrammable Interrupt 2 pin
6SDO / ALTDigital I/OSPI Data Output / I2C Alternate Address pin
7SDA / SDIDigital I/OI2C Serial Data / SPI Serial Data Input
8SCL / SCLKDigital InputI2C Serial Clock / SPI Serial Clock

Specifications

ParameterSymbolMinTypMaxUnitConditions
Chip Supply VoltageVDDV_{DD}2.02.53.6VDC
Measurement CurrentIDDI_{DD}145180µAVDD=2.5 VV_{DD} = 2.5\text{ V}, ODR=100 HzODR = 100\text{ Hz}
Standby CurrentISTBI_{STB}0.10.5µAStandby mode
Sensitivity (FULL_RES)SS3.53.94.3mg/LSBAll gg ranges
Output Data RateODRODR0.11003200HzSelectable via BW_RATE
Operating Temp RangeTOPT_{OP}-4085°C

Key Registers

AddressRegisterAccessResetDescription
0x00DEVIDR0xE5Device ID register (returns 0xE5)
0x2DPOWER_CTLR/W0x00Power control (Set bit 3 Measure = 1 to enable measuring)
0x2EINT_ENABLER/W0x00Interrupt enable control (Single/double tap, freefall, data ready)
0x31DATA_FORMATR/W0x00Set range (±2g,±4g,±8g,±16g\pm 2g, \pm 4g, \pm 8g, \pm 16g) & FULL_RES bit [3]
0x320x37DATAX0..DATAZ1R0x00Read 6 bytes for X, Y, Z acceleration data (LSB first)
Note

16-bit Signed Data Assembly: Read 6 consecutive bytes starting at DATAX0 (0x32). Combine bytes in Little-Endian format: int16_t x = (int16_t)(data[1] << 8 | data[0]);.

Wiring

ADXL345 BreakoutMicrocontroller (Arduino Uno / ESP32)Notes
VCC3.3V (or 5V)Power supply
GNDGNDGround
CSVCC (or 3.3V)Must be pulled HIGH for I2C mode
SDASDA (A4 on Uno, GPIO21 on ESP32)I2C Data line
SCLSCL (A5 on Uno, GPIO22 on ESP32)I2C Clock line
SDOGNDPull LOW for address 0x53, HIGH for 0x1D

Common mistakes

  • Forgetting to set POWER_CTL Measure bit: The ADXL345 powers up in standby mode (0x00). Software MUST write 0x08 to POWER_CTL (0x2D) to enable active measurement.
  • Leaving CS pin floating for I2C mode: If CS is floating, electrical noise can pull CS LOW, causing the chip to switch into SPI mode and stop responding on the I2C bus.
  • Reading single bytes instead of multi-byte burst: When reading DATAX0 to DATAZ1 over SPI, bit 6 (MB - Multiple Byte bit) in the instruction byte must be set to 1 to enable auto-increment address reads.

Notes

  • Free-fall detection triggers when total vector acceleration X2+Y2+Z2\sqrt{X^2 + Y^2 + Z^2} drops below a user-configured threshold (typically <0.5 g<0.5\text{ g}) for a minimum duration.

Assets & downloads