Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use ADXL345: Examples, Pinouts, and Specs

Image of ADXL345
Cirkit Designer LogoDesign with ADXL345 in Cirkit Designer

Introduction

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.

Explore Projects Built with ADXL345

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino Nano and ADXL345 Accelerometer Interface
Image of Interfacing ADXL345 with Nano: A project utilizing ADXL345 in a practical application
This circuit features an Arduino Nano interfaced with an ADXL345 accelerometer for measuring acceleration. The Arduino provides power and I2C communication to the accelerometer, enabling it to capture and process motion-related data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Leonardo and ADXL345 Accelerometer-Based Motion Detection System
Image of mini project: A project utilizing ADXL345 in a practical application
This circuit interfaces an ADXL345 accelerometer with an Arduino Leonardo via I2C communication. The Arduino provides power and ground to the accelerometer and reads acceleration data through the SDA and SCL lines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO and ADXL345 Accelerometer Data Logger
Image of Accelerometer ADXL345 Circuit Diagram: A project utilizing ADXL345 in a practical application
This circuit features an Arduino UNO microcontroller interfaced with an Adafruit ADXL345 accelerometer for motion detection, powered by two parallel-connected 18650 Li-ion batteries. The accelerometer communicates with the Arduino over I2C, and the system is designed for further code development to utilize the motion sensing capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Multi-Sensor Monitoring System with Battery Power
Image of Wind turbine 2.0: A project utilizing ADXL345 in a practical application
This circuit is a sensor monitoring system powered by a 7.4V battery, regulated to 5V using a 7805 voltage regulator. It uses an ESP32 microcontroller to interface with an ADXL345 accelerometer, INA219 current sensor, BMP280 pressure sensor, and an IR sensor, all connected via I2C and GPIO for data acquisition and processing.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with ADXL345

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Interfacing ADXL345 with Nano: A project utilizing ADXL345 in a practical application
Arduino Nano and ADXL345 Accelerometer Interface
This circuit features an Arduino Nano interfaced with an ADXL345 accelerometer for measuring acceleration. The Arduino provides power and I2C communication to the accelerometer, enabling it to capture and process motion-related data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of mini project: A project utilizing ADXL345 in a practical application
Arduino Leonardo and ADXL345 Accelerometer-Based Motion Detection System
This circuit interfaces an ADXL345 accelerometer with an Arduino Leonardo via I2C communication. The Arduino provides power and ground to the accelerometer and reads acceleration data through the SDA and SCL lines.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Accelerometer ADXL345 Circuit Diagram: A project utilizing ADXL345 in a practical application
Arduino UNO and ADXL345 Accelerometer Data Logger
This circuit features an Arduino UNO microcontroller interfaced with an Adafruit ADXL345 accelerometer for motion detection, powered by two parallel-connected 18650 Li-ion batteries. The accelerometer communicates with the Arduino over I2C, and the system is designed for further code development to utilize the motion sensing capabilities.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Wind turbine 2.0: A project utilizing ADXL345 in a practical application
ESP32-Based Multi-Sensor Monitoring System with Battery Power
This circuit is a sensor monitoring system powered by a 7.4V battery, regulated to 5V using a 7805 voltage regulator. It uses an ESP32 microcontroller to interface with an ADXL345 accelerometer, INA219 current sensor, BMP280 pressure sensor, and an IR sensor, all connected via I2C and GPIO for data acquisition and processing.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Mobile devices for screen orientation and motion detection
  • Wearable technology for activity tracking
  • Gaming controllers for motion sensing
  • Robotics for tilt and vibration measurement
  • Industrial equipment for vibration monitoring
  • Automotive systems for impact detection and navigation

Technical Specifications

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)

Pin Configuration and Descriptions

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)

Usage Instructions

How to Use the ADXL345 in a Circuit

  1. Power Supply: Connect the VDD pin to a 3.3 V power source and the GND pin to ground.
  2. Communication Interface: Choose between I²C or SPI:
    • For I²C, connect the SCL and SDA pins to the corresponding I²C lines on your microcontroller.
    • For SPI, connect the SCLK, SDI, and CS pins to the SPI lines on your microcontroller.
  3. Interrupts: Use the INT1 and INT2 pins to handle interrupts for specific events (e.g., free-fall detection, activity detection).
  4. Pull-Up Resistors: For I²C communication, use pull-up resistors (typically 4.7 kΩ) on the SCL and SDA lines.
  5. Bypass Capacitor: Place a 0.1 µF ceramic capacitor close to the VDD pin for power supply decoupling.

Important Considerations and Best Practices

  • Voltage Levels: Ensure the I/O voltage levels match your microcontroller's logic levels.
  • Measurement Range: Configure the measurement range (±2 g, ±4 g, etc.) based on your application requirements.
  • Data Rate: Set an appropriate output data rate (ODR) to balance power consumption and performance.
  • Mounting: Minimize mechanical stress and vibrations during mounting to avoid measurement errors.

Example Code for Arduino UNO

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
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Communication with the ADXL345

    • Cause: Incorrect I²C address or wiring.
    • Solution: Verify the I²C address (default is 0x53) and check all connections.
  2. Incorrect or No Data Output

    • Cause: Device not in measurement mode.
    • Solution: Ensure the POWER_CTL register is set to enable measurement mode.
  3. High Noise in Readings

    • Cause: Poor power supply decoupling or mechanical vibrations.
    • Solution: Add a 0.1 µF capacitor near the VDD pin and minimize external vibrations.
  4. Interrupts Not Triggering

    • Cause: Interrupts not configured correctly.
    • Solution: Verify the interrupt configuration registers and ensure the INT1/INT2 pins are connected.

FAQs

  • 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.