Features & Benefits

  • Programmable accelerometer up to 16g
  • Digital output easily connects to the sensor
  • Built in FIFO reduces work for processor

Circuit Function & Benefits

The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either an SPI (3- or 4-wire) or I2C digital interface.

The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing appli-cations, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes of about 0.25°. Using a digital output accelerometer such as the ADXL345 eliminates the need for analog-to-digital conversion, reducing system cost and real estate. Additionally, the ADXL345 includes a variety of built-in features. Activity/inactivity detection, tap/double-tap detection, and free-fall detection are all done internally with no need for the host processor to perform any calculations. A built-in 32-stage FIFO memory buffer reduces the burden on the host processor, allowing algorithm simplification and power savings. Additional system level power savings can be implemented using the built-in activity/inactivity detection and by using the ADXL345 as a “motion switch” to turn the whole system off when no activity is felt and on when activity is sensed again.

The ADXL345 communicates via I2C or SPI interface. The circuits described in this document demonstrate how to implement communication via these protocols.

Figure 1. ADXL345 and ADuC7024 in 4-Wire SPI Configuration (Simplified Schematic: Decoupling and All Connections Not Shown)

Figure 2. ADXL345 and ADuC7024 in I2C Configuration (Simplified Schematic: Decoupling and All Connections Not Shown)

Circuit Description

This circuit uses an ADuC7024 precision analog microcon-troller in conjunction with the ADXL345 digital accelerometer. Both are I2C- and SPI-ready. Figure 1 shows the ADXL345 and ADuC7024 in an SPI configuration, and Figure 2 shows the same devices in an I2C configuration. The CS pin (Pin 7 on the ADXL345) is used to select the desired interface. I2C mode is enabled if the CS pin is tied high to VDD I/O. In SPI mode, CS is toggled to signify the beginning and end of each transmission. When CS is pulled high, this indicates that no SPI transmission is occurring or that an I2C transmission may occur.

Both schematics are simplified, but required connections (supplies, ground connections, etc.) are shown. In these schematics, the ADuC7024 is programmed via UART (connected to Pin 49 and Pin 50). SW2 and SW3 are Reset and Download buttons, respectively, for programming the microcontroller. SW1 is an on/off power switch.

For information on programming the ADuC7024, please see the ADuC7024 data sheet. Sample code for the I2C configuration can be found at CN0133_Source_Code.zip.

Common Variations

Figure 1 shows the ADXL345 in a 4-wire SPI configuration. The ADXL345 can also communicate via 3-wire SPI. Figure 3 outlines this configuration.

Figure 3. 3-Wire SPI Connection Diagram

The circuit described uses the ADuC7024 microcontroller. The same configuration can be applied with any SPI- or I2C-capable microcontroller, as outlined in the diagrams in Figure 4. The standard I2C and SPI connections are used. Pin functions for the two protocols are listed in Table 1.
Figure 4. SPI (left) and I2C (right) Connection Diagrams

Table 1. ADXL345 Pin Functionality in SPI and I2C Communication Modes

ADXL345 Pin Number 
Pin Name 
(Connect to VDD for I2C)
Chip Select
Alternate Address Select
Serial Data Output
Serial Data
Serial Data Input (SPI 4-Wire)/
Serial Data Input and Output (SPI 2-Wire)
Serial Communications Clock
Serial Communications Clock

Sample Products




Available Product
Models to Sample

ADXL345 3-Axis, ±2 g/±4 g/±8 g/±16 g Digital Accelerometer

Contact ADI

ADUC7024 Precision Analog Microcontroller, 12-Bit Analog I/O, ARM7TDMI® MCU




Buy functionality exists in desktop site