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

How to Use Adafruit ADXL345: Examples, Pinouts, and Specs

Image of Adafruit ADXL345
Cirkit Designer LogoDesign with Adafruit ADXL345 in Cirkit Designer

Introduction

The Adafruit ADXL345 is a compact, low-power, 3-axis MEMS accelerometer that measures acceleration with a full-scale range of ±2g, ±4g, ±8g, or ±16g. It is capable of measuring both dynamic acceleration (e.g., motion or shock) and static acceleration (e.g., gravity). This versatility makes it suitable for a wide array of applications including mobile devices, gaming systems, industrial instrumentation, and personal navigation devices.

Explore Projects Built with Adafruit 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 UNO with Adafruit ADXL345 Accelerometer Data Logger
Image of ADXL345: A project utilizing Adafruit ADXL345 in a practical application
This circuit connects an Arduino UNO microcontroller with an Adafruit ADXL345 accelerometer sensor. The Arduino powers the sensor, communicates with it via I2C (using pins A4 and A5 for SDA and SCL respectively), and runs a program to read and output the acceleration data in three axes. The purpose of the circuit is to measure acceleration and provide real-time data for analysis or further processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Leonardo and ADXL345 Accelerometer-Based Motion Detection System
Image of mini project: A project utilizing Adafruit 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 Adafruit 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
Arduino Nano and ADXL345 Accelerometer Interface
Image of Interfacing ADXL345 with Nano: A project utilizing Adafruit 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

Explore Projects Built with Adafruit 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 ADXL345: A project utilizing Adafruit ADXL345 in a practical application
Arduino UNO with Adafruit ADXL345 Accelerometer Data Logger
This circuit connects an Arduino UNO microcontroller with an Adafruit ADXL345 accelerometer sensor. The Arduino powers the sensor, communicates with it via I2C (using pins A4 and A5 for SDA and SCL respectively), and runs a program to read and output the acceleration data in three axes. The purpose of the circuit is to measure acceleration and provide real-time data for analysis or further processing.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of mini project: A project utilizing Adafruit 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 Adafruit 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 Interfacing ADXL345 with Nano: A project utilizing Adafruit 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

Technical Specifications

Key Features

  • 3-axis sensing
  • Selectable measurement range (±2g, ±4g, ±8g, ±16g)
  • 13-bit resolution at ±16g (4mg/LSB)
  • Low power consumption
  • Built-in self-test
  • SPI (3- and 4-wire) and I2C digital interfaces
  • Tap/double tap detection and free-fall detection

Electrical Characteristics

Parameter Condition Min Typ Max Unit
Supply Voltage VDD 2.0 3.3 3.6 V
Output Data Rate 0.1 3200 Hz
Current Consumption Measurement Mode 40 µA
Temperature Range Operating -40 +85 °C

Pin Configuration

Pin Number Name Description
1 GND Ground
2 VCC Power supply (2.0V to 3.6V)
3 SDA I2C Data / SPI Serial Data Input (SDI)
4 SDO SPI Serial Data Output (SDO) / I2C Addr
5 SCL I2C Clock / SPI Serial Clock (SCK)
6 CS SPI Chip Select (Active Low) / I2C Enable

Usage Instructions

Integration into a Circuit

  1. Connect VCC to a 2.0V to 3.6V power supply.
  2. Connect GND to the ground of your power supply.
  3. For I2C communication, connect SDA and SCL to your microcontroller's I2C pins.
  4. For SPI communication, connect SDI, SDO, SCK, and CS to the corresponding SPI pins on your microcontroller.

Best Practices

  • Use pull-up resistors on the I2C data lines if your microcontroller does not have them built-in.
  • Ensure that the power supply is stable and within the specified voltage range.
  • Place the accelerometer as close as possible to the center of mass of the object whose motion is being measured.
  • Avoid physical shock and vibration that exceed the specified limits as they may damage the component.

Example Code for Arduino UNO

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>

Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345);

void setup(void) {
  Serial.begin(9600);
  Serial.println("Accelerometer Test"); Serial.println("");
  
  // Initialize the accelerometer.
  if(!accel.begin()) {
    Serial.println("No ADXL345 detected");
    while(1);
  }
  
  // Set the range to whatever is appropriate for your project.
  accel.setRange(ADXL345_RANGE_16_G);
}

void loop(void) {
  sensors_event_t event; 
  accel.getEvent(&event);
  
  // Display the results (acceleration is measured in m/s^2).
  Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" ");
  Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" ");
  Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.print(" ");
  Serial.println("m/s^2 ");
  
  // Delay before the next reading.
  delay(500);
}

Troubleshooting and FAQs

Common Issues

  • No data is being read from the sensor: Ensure that the connections are correct and secure. Check that the correct voltage is being supplied to VCC.
  • Inaccurate readings: Verify that the accelerometer is properly calibrated. Ensure that the device is stationary during calibration.
  • Intermittent communication: Check for loose connections and ensure that pull-up resistors are in place if required.

FAQs

Q: Can the ADXL345 be used to detect orientation? A: Yes, by measuring static acceleration due to gravity, the ADXL345 can determine the angle at which it is tilted with respect to the earth's surface.

Q: What is the purpose of the CS pin? A: The CS pin is used to enable SPI communication. When using I2C, this pin can be tied to VCC to disable SPI mode.

Q: How can I reduce power consumption? A: The ADXL345 has a low power mode that can be enabled through software. Additionally, reducing the output data rate can also decrease power consumption.

For further assistance, consult the datasheet or contact Adafruit's support forums.