Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Connect an ADXL345 breakout to Arduino over I²C by wiring power, ground, SDA and SCL, and holding CS high; the usual 7-bit address is 0x53. After confirming the sensor responds and enabling measurement mode, average readings in a stable, known orientation and correct the offsets. Check your breakout’s voltage and logic-level requirements before attaching it to a 5 V Arduino: the bare ADXL345 is not a 5 V device.

What you need to know before wiring

The ADXL345 is a three-axis digital accelerometer with selectable ranges of ±2 g, ±4 g, ±8 g and ±16 g. The bare IC operates from a 2.0–3.6 V supply, supports I²C and SPI, and can provide up to 13-bit output in full-resolution mode. See the Analog Devices ADXL345 datasheet.

Use an ADXL345 breakout board for a typical Arduino build. Breakouts vary: some include a regulator, and voltage-level handling is not uniform. Check the documentation for the specific board’s supply and logic-input requirements before connecting it to a 5 V Arduino. The bare sensor’s I/O range is 1.7 V to its supply voltage, so do not infer 5 V tolerance from the fact that a board is sold as an Arduino accessory.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose I²C or SPI

I²C: simpler wiring and shared bus

I²C is a practical starting point when you want the sensor to share the Arduino’s SDA and SCL bus with other compatible devices. Hold CS high to select I²C. The usual 7-bit address is 0x53; the alternate address, 0x1D, is selected using the breakout’s SDO or alternate-address connection as documented for that board. The address is 7-bit; libraries normally handle the read/write bit themselves. Analog Devices describes the address and interface selection in its AN-1077 application note.

#1 Best Overall
BIGTREETECH ADXL345 V2.0 Accelerometer Board Klipper Input Shaping 3D Printer Hotend Parts Sensor Module Support USB Connection for Voron Stealthburner
  • Plug-and-Play: Effortlessly connect ADXL345 to your Klippered printer with a simple setup, taking advantage of high-performance MCU hardware SPI for data sampling and communication, and enjoy compatibility with various host systems, easily connect to Raspberry Pi or Manta boards + CB1 with USB ports using a standard USB-A to USB-C cable
  • Flexible Mounting Options : Method 1: StealthBurner Direct Mount- Effortlessly install ADXL345 in the designated location, streamlining the setup process and saving valuable time; Method 2: Nozzle Mount- Attach near the nozzle for precise measurements
  • Meets the Needs of Klipper Input Shaping: Accurately measures resonance frequencies, reducing print rippling at high speeds and accelerations for more precise detail
  • Effortless Wiring & Durable Connections: Reserved solder points enable users to customize wiring easily, ENIG mounting holes ensure stable connections and durability
  • What's in the Box?ADXL345 V2.0.1 × 1, M6 x 13 x 2 Silicone Ring × 2, M6 x 8 Socket Head Cap Screw × 1.All parts are rigorously tested before leaving the factory

SPI: extra wires and explicit chip select

SPI uses SCK, SDI/MOSI, SDO/MISO and CS. Connect these to the Arduino’s hardware SPI pins and a digital pin for chip select, following the board and Arduino pin documentation. Configure SPI for mode 3 (CPOL=1, CPHA=1), MSB first. SPI is an option when its bus characteristics suit your project; I²C generally needs fewer signal wires and makes sharing a bus straightforward.

Wire the breakout to Arduino

Use the breakout’s labels and documentation to identify its power input, ground, SDA/SCL or SPI pins, and address-select connection. The exact power pin and voltage depend on the breakout, not just the sensor IC.

Rank #2
AOICRIE 3PCS GY-291 ADXL345 3-Axis Digital Acceleration of Gravity Tilt Module with IIC SPI Transmission for Arduino (3PCS)
  • ☀FULL RESOLUTION: where resolution increases with g range, up to 13-bit resolution at ±16 g (maintaining 4 mg/LSB scale factor in all g ranges)
  • ☀MULTIPLE SENSING DETECT: Activity and inactivity sensing detect the presence or lack of motion by comparing the acceleration on any axis with user-set thresholds. Tap sensing detects single and double taps in any direction. Free fall sensing detects if the device is falling.
  • ☀COMMUNICATION: It uses both I2C and SPI (supports 3-, 4-wire SPI) interface.
  • ☀WIDELY APPLICATIONS: Handsets, Medical instrumentation, Gaming and pointing devices, Industrial instrumentation, Personal navigation devices, Hard disk drive (HDD) protection, Portable gaming.
  • ☀ULTRA LOW POWER: as low as 23 μA in measurement mode and 0.1 μA in standby mode at VS = 2.5 V (typical).
  1. With power disconnected, connect the breakout’s ground to Arduino ground.
  2. Connect the breakout’s power input to a voltage explicitly supported by that breakout.
  3. For I²C, connect SDA to Arduino SDA and SCL to Arduino SCL. Hold CS high, and begin with address 0x53. Set SDO/ALT ADDRESS as the board documentation specifies if you need 0x1D.
  4. For SPI instead, connect SCK, SDI/MOSI, SDO/MISO and CS to the appropriate Arduino SPI and chip-select pins. Leave the interface and pin configuration consistent in your code.
  5. Before powering up, check the board’s regulator and logic-level behavior against the Arduino’s voltage levels.

Install a library and verify communication

Install a maintained ADXL345 library through Arduino Library Manager or use the library vendor’s repository. The SparkFun ADXL345 library repository includes SparkFun_ADXL345_Example.ino and SparkFun_ADXL345_Calibration.ino. The Adafruit ADXL345 library supports I²C and SPI through a unified class. Follow the example matching your selected interface and the library’s current API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Initialize the chosen bus: I²C or SPI.
  2. Call the library’s begin method with the appropriate address or chip-select configuration.
  3. Check that the device responds. For I²C, start with 0x53; if the address-selection wiring is configured for the alternate address, use 0x1D.
  4. Set a range appropriate to the motion you expect. For tilt or gentle movement, ±2 g is a conservative starting point.
  5. Enable measurement mode using the library or device configuration.
  6. Print raw X, Y and Z readings to the serial monitor. Confirm they change when you rotate the board before calibrating.

Calibrate the accelerometer offsets

Offset calibration corrects a stable bias; it does not correct every source of measurement error. Secure the sensor, let it settle, and use a known orientation. Analog Devices’ AN-1077 explains the ADXL345 offset registers and their limits.

Rank #3
Teyleten Robot GY-291 ADXL345 Digital 3-Axis Acceleration of Gravity Tilt Module IIC SPI for Arduino 3pcs
  • Brand new original ADXL345 chip, quality assurance
  • According to the 16-bit two's complement format, it can be accessed through the digital interface SPI (3-wire or 4-wire) or I2C
  • ADXL345 is very suitable for mobile device applications. It can be used for tilt sensing applications while measuring static acceleration of gravity, and it can also measure the speed of vibration caused by dynamic added motion or caused. With its high resolution (4mg/LSB), it can measure changes in the inclination angle of about 0.25°. Use ADXL345 digital output timing acceleration, etc., no timing
  • With high resolution (13 bits) measurement up to ±16g. The digital output data is in 16-bit two-valued complement format, which can be passed through the I2C digital interface SPI (3-wire or 4-wire)
  • Communication method: IIC / SPI communication protocol
  1. Mount the board rigidly on a stable surface and allow readings to settle.
  2. Average a long run of X, Y and Z measurements in the intended reference orientation. Averaging reduces the influence of short-term reading variation.
  3. In the documented calibration orientation, X and Y should be at 0 g and Z at +1 g. Compare each averaged axis reading with its expected value to determine the error.
  4. Apply the opposite-sign correction. For example, if an axis shows a steady error of +156 mg, the correction is approximately −156 mg.
  5. Repeat with additional known orientations if you need to check the balance across the axes.
  6. If using hardware offsets, convert the correction to register steps and write the opposite-sign value. The 8-bit two’s-complement offset registers have a resolution of about 15.6 mg/LSB, so a smaller residual cannot be represented precisely there.
  7. For finer correction, retain any useful hardware correction and subtract the remaining measured bias in Arduino software.

After calibration, recheck readings in the reference orientation and after rotating the board. A stationary accelerometer still senses gravity: a value near 1 g on the axis aligned with gravity is expected, not evidence of motion.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot missing or implausible readings

The Arduino cannot find the sensor

  • Confirm the Arduino and breakout share ground and that the breakout is powered at a supported voltage.
  • For I²C, verify CS is held high, SDA and SCL are on the correct pins, and the selected address matches the SDO/ALT ADDRESS connection.
  • Check that the bus has suitable pull-ups; breakout boards differ in whether pull-ups are included.
  • For SPI, recheck SCK, MOSI, MISO and chip-select wiring, and confirm the code uses the same chip-select pin and SPI mode.

Readings stay at zero or do not change

  • Verify that the device entered measurement mode, not just that initialization succeeded.
  • Check the selected measurement range and ensure the conversion code agrees with the configured mode.
  • Confirm that the library is reading the correct output registers and that both bytes for each axis are combined as signed two’s-complement data.
  • Rotate the board through a known orientation; if all axes remain unchanged, revisit bus communication and measurement-mode configuration.

Readings are saturated or the scale looks wrong

Choose a range that can contain the acceleration you expect, and make sure the conversion code reflects that range and the selected resolution mode. In full-resolution mode, the nominal scale is about 4 mg/LSB; Analog Devices’ AN-1077 gives approximately 3.9 mg/LSB in 13-bit mode. A scale mismatch can make plausible raw counts appear incorrectly converted to g.

Rank #4
HiLetgo GY-291 ADXL345 3-Axis Digital Acceleration of Gravity Tilt Module for Arduino IIC/SPI Transmission
  • The ADXL345 is a small, thin, ultra-low power 3-axis accelerometer with high resolution (13 bits) and measurement range of ± 16g.
  • The digital output data is in 16-bit twos complement format and is accessible via SPI (3-wire or 4-wire) or I2C digital interface.
  • Its high resolution (3.9 mg / LSB) enables measurement of tilt angle changes of less than 1.0 °
  • Low-power mode supports motion-based intelligent power management for threshold sensing and motion acceleration measurement with very low power consumption.
  • The ADXL345 is perfect for mobile device applications. It measures static gravitational acceleration in tilt detection applications as well as dynamic acceleration due to motion or impact.

Use the built-in self-test carefully

The ADXL345 includes an electromechanical self-test. Keep the sensor stable while running it and compare the response with the expected behavior in the datasheet or application guidance; do not treat movement during the test as ordinary acceleration data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 2
AOICRIE 3PCS GY-291 ADXL345 3-Axis Digital Acceleration of Gravity Tilt Module with IIC SPI Transmission for Arduino (3PCS)
AOICRIE 3PCS GY-291 ADXL345 3-Axis Digital Acceleration of Gravity Tilt Module with IIC SPI Transmission for Arduino (3PCS)
☀COMMUNICATION: It uses both I2C and SPI (supports 3-, 4-wire SPI) interface.
$10.59
Bestseller No. 3
Teyleten Robot GY-291 ADXL345 Digital 3-Axis Acceleration of Gravity Tilt Module IIC SPI for Arduino 3pcs
Teyleten Robot GY-291 ADXL345 Digital 3-Axis Acceleration of Gravity Tilt Module IIC SPI for Arduino 3pcs
Brand new original ADXL345 chip, quality assurance; Communication method: IIC / SPI communication protocol
$15.99
Bestseller No. 5
AITRIP 10Pcs ADXL345 3-Axis Accelerometer Sensor Module IIC/SPI Transmission Compatible with for Arduino GY-291
AITRIP 10Pcs ADXL345 3-Axis Accelerometer Sensor Module IIC/SPI Transmission Compatible with for Arduino GY-291
Up to ±16 g accelerometer with high resolution (13) measurement. Digital output; Communication method: IIC / SPI communication protocol
$26.99
Best Value
AITRIP 10Pcs ADXL345 3-Axis Accelerometer Sensor Module IIC/SPI Transmission Compatible with for Arduino GY-291
  • Up to ±16 g accelerometer with high resolution (13) measurement. Digital output
  • ADXL345 is very suitable for mobile device applications. It can be used for tilt sensing applications while measuring static acceleration of gravity, and it can also measure the speed of vibration caused by dynamic added motion or caused. With its high resolution (4mg/LSB), it can measure changes in the inclination angle of about 0.25°. Use ADXL345 digital output timing acceleration, etc., no timing
  • Communication method: IIC / SPI communication protocol
  • The ADXL345 is perfect for mobile device applications. It measures static gravitational acceleration in tilt detection applications as well as dynamic acceleration due to motion or impact.Its high resolution (3.9 mg / LSB) enables measurement of tilt angle changes of less than 1.0 °
  • According to the 16-bit two's complement format, it can be accessed through the digital interface SPI (3-wire or 4-wire) or I2C

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.