Triple Axis Accelerometer Breakout - ADXL345

Replacement:SEN-09836. We added an extra decoupling cap and some mounting holes. This page is for reference only.

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

The ADXL345 is well suited to measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0°.

Several special sensing functions are provided. Activity and inactivity sensing detect the presence or lack of motion and if the acceleration on any axis exceeds a user-set level. Tap sensing detects single and double taps. Free-fall sensing detects if the device is falling. These functions can be mapped to one of two interrupt output pins. An integrated, patent pending 32-level first in, first out (FIFO) buffer can be used to store data to minimize host processor intervention. Low power modes enable intelligent motion-based power management with threshold sensing and active acceleration measurement at extremely low power dissipation.

Not sure which accelerometer is right for you? Our Accelerometer and Gyro Buying Guide might help!

  • 2.0-3.6VDC Supply Voltage
  • Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V
  • Tap/Double Tap Detection
  • Free-Fall Detection
  • SPI and I2C interfaces


Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • davev / about 14 years ago / 3

    //Arduino I2C ADXL345 example code
    //Dave Vondle, 11/16/09


    define X0 0x32

    define X1 0x33

    define Y0 0x34

    define Y1 0x35

    define Z0 0x36

    define Z1 0x37

    void setup()
    Wire.begin(); // join i2c bus
    Serial.begin(19200); // start serial for output
    Wire.beginTransmission(0x1D); // transmit to ADXL345
    Wire.send(0x2D);// POWER_CTL
    Wire.send(0x09);// measurement mode, 4hz wakeup
    Wire.endTransmission(); // stop transmitting
    void loop()
    Serial.print(getDir('x'), DEC); // print as an ASCII-encoded decimal
    Serial.print("\t"); // prints a tab
    Serial.print(getDir('y'), DEC);
    Serial.print(getDir('z'), DEC);
    Serial.println(""); // prints a newline
    byte requestByte(char dir){
    Wire.beginTransmission(0x1D); // transmit to ADXL345
    Wire.endTransmission(); // stop transmitting
    Wire.requestFrom(0x1D, 1); // request 1 byte from ADXL345
    return(Wire.receive()); //
    int getDir(char dir){
    int var;
    }else if(dir=='y'){
    }else if(dir=='z'){

  • Rsimonton / about 15 years ago / 2

    I have been working with the XL345 and a Parallax Propeller controller. It's been frustrating to say the least. I am programming in assembly using two wire SPI to communicate. I have been able, at times, to consistently return a device ID and also data from the X-axis, but no sooner does it start to make sense and then nothing. I have been through my timing code to ensure I have a symmetric clock signal and it looks correct. This has also been done without a scope though. It is weird, it will start working for no apparent reason, then I continue working on my code and then it just quits. My clock is at about 2Mhz, which should work, but I will slow it down and see what it does. The documentation from AD could have used some more examples!

  • ItsLeeOwen / about 12 years ago / 1

    Does anyone know how to get a reading and compensate for the sensitivity at default levels?

  • Member #153002 / about 13 years ago / 1

    What are the range of values reported by ADXL345 (in decimal) for X, Y and Z ? i mean what are the values reported by ADXL345 when held horizontal (parallel to ground)and at various 90 degree positions.

  • hbx / about 13 years ago / 1

    I'm working on this accelerometer too and I've set it up following the datasheet, i.e. Vdd and GND to Arduino, SDO to GND, CS to Vdd, SCL and SDA to pins 5 and 4 and 4k7 pullup resistors to Vdd each. This means I2C mode with the alternate address.
    I've set this all up on a breadboard, checked everything 3 times but still have the thing stop at Wire.endTransmission() at different parts of the program. Sometimes it also stops at Wire.begin(). Sometimes it works though.
    I wrote something to print the return of Wire.endTransmission() if it wasn't 0, but usually when it freezes nothing is printed.
    I've read the comments here but I fix it. I tried a few things, changing the resistance of the pullups, using a different part of the breadboard and reducing my code to just communicating over I2C. The problem still persists.
    Can anyone help? I'm most concerned about the freezing at Wire.endTransmission(). Thanks!

  • Flare / about 14 years ago / 1

    I am actually making a 6DOF with 3D accelerometer and 3D gyroscope and using I2C communication. I am using 700 Ohms as the pull-up for the I2C.
    Problem: The accelerometer seems to have ~100 counts in variation. The center looks like it's at the right value: for example 2 axes are pretty close to 0 while the other is close to 256 counts (for gravity). I can change which axis gets the 256 counts by reorienting my pcb. So I appear to be getting some meaningful data, but corrupted by noise. I am doing the following for the accelerometer:
    1) Set the data output rate to 3200 Hz
    2) Set the resolution to 13-bit, +/- 16g
    3) Set to measurement mode
    4) Collect data every 400 Hz by reading addresses 0x32 to 0x37
    Example plot (temporarily disabled the gyroscopes):
    I would appreciate any feedback regarding where I am going wrong.

    • Sparko4Marko / about 14 years ago / 2

      Assuming your numbers are correct, the first thing I notice is that your data retrieve rate is substantially slower that your sample rate. You will lose data if you don't keep up with the sample rate.
      I would suggest - and I'm no expert on inertial navigation - but slow down your sample rate to a more modest value - say 200Hz or 400Hz.
      I assume you are leaving CPU overhead to do something useful with the data once you have it - and keep up with the sample rate. If your number crunching is limiting your data retrieval rate to 400Hz, then your sample rate on the accelerometer should be about half that (200Hz) to avoid Nyquist aliasing.
      That said, if your power supply is clean and you are communicating with the device, that's 90% of the battle. The rest is software.
      Check your FIFO mode (reg 0x38) and watermark/overrun bits (reg 0x2e). If you are set to FIFO mode, you may just be reading the same 32 bytes over and over.
      If you still need help, send me your setup code. mdlougheed - at -

    • Member #230817 / about 13 years ago / 1

      Did you manage to fix this issue? I seem to be having similar problems with noise... Thanks!

  • mathgenius / about 14 years ago / 1

    If you are needing to talk to this chip over a longish wire (>20cm) I would recommend using the i2c interface, as it seems to be much more robust. I can talk i2c over about 200cm of wire, without any extra caps or other tricks.

  • Kevin Vermeer / about 14 years ago / 1

    Sigh.... Can't believe AD thinks that a FIFO buffer can be patented.
    Here's hoping that the patent lawyer that handles the case can find, somewhere, somehow, a bit of prior art, and that we won't have to pay Analog Devices every time we need to use a FIFO in our code, or every time we want to pipe some commands in *nix.

  • fa / about 14 years ago / 1

    After using Razor9Dof IMU, I design my pcb and I added the ADXL345.
    But now, I can't get the datas in a loop, I can configure the ADXL, but I can't read more than one register.
    For example, I can read Device id as 229 and sending stop condition. After 1second, when I send the Start condition, ADXL not give any respond...
    Any help would be very appreciated

  • Mik / about 14 years ago / 1

    I wonder why everyone cares about I2C interface,
    i tried SPI in arduino - it worked with no problem.
    And AVR has SPI-to-USB modules - so it it would be possible attach several of them to a computer.

  • YellowFlower / about 14 years ago / 1

    is there any information that can be found on the general error output of this chip, for the purposes of kalman filtering?

    • Sparko4Marko / about 14 years ago / 1

      Funny you should mention Kalman filtering...
      I couldn't find anything specific in the datasheet, but one approach could be to use the specified +/- 0.5% full scale nonlinearity. This would give you a linearly increasing error band with higher accelerations - sort of a "bow tie" shape with zero error assumed at zero g (freefall). You would be assuming higher error at higher accelerations.
      The device operates in two modes - a "locked" 4mg/LSB, independent of scale and a ratiometric mode that I would assume is as good as the stability of your power supply. In either case, this is another uncertainty to be quantified.

  • Sparko4Marko / about 14 years ago / 1

    4. After a power-on reset, the device will be in standby mode (not taking data). Do all your configuration first (i.e. data rate, g-range etc), then tell the device to start measurements by setting the D3 bit of the POWER_CTL (0x2D) register. The device WILL NOT take measurements until you tell it to do so.
    4a. If you tell the device to stop taking measurements by resetting the D3 bit of POWER_CTL, the X, Y & Z Accelration registers will retain the last values they contained.
    4b. Repeating - the device may appear dead if you do not tun on the measurement mode.
    4c. MOST OF THE REGISTERS DO NOT NEED CONFIGURATION FOR SUCCESSFUL BASIC OPERATION. For grins - after proof of life by a successful read of the DEV_ID register, try just issuing a 0x08 value to the POWER_CTL to turn on measurements and read the X,Y & Z accel registers.
    I am using the SparkFun LCD-08625 as a controller which has I2C built in. I had this part operational in under an hour - figuing in the time it took to address the wait state problem above.
    No worries.

  • Sparko4Marko / about 14 years ago / 1

    This is definitely a RTFM part. RTFM then RIA (Read it again!). Having said that, it is not that difficult to get running in I2C mode.
    Here are a few hints:
    1. Make sure the SDO and *CS lines are tied high to set the primary I2C address and I2C mode respectively.
    2. Search for and read the UM10204 I2C-Bus Specification and User Manual.
    2a. The section on computing the proper I2C bus pullup resistors is most valuable.
    2b. I used 3.3k ohm buss pullups for my project. Enough to use both the 100kHz standard and 400kHz fast data rates while accounting for a fair amount of open air bus wire(furrball) capacitance.
    3. For whatever reason, during the single and multi byte read cycle, you may need to add a time delay to your code after sending the register address and waiting for the device to ACK before sending the restart/read mode command. My code would hang up the device until I added a short delay (ACK status fetch).
    3a. This device is really sensitive to hanging up in I2C mode if you FUBAR the communications. This will require a full power disconnect and restart - A simple soft reset will not do.

  • BTW SFE, you should really make a tutorial for this product. It sells like coal anymore and is very, very frustrating.

  • Well I tried this device with a 5V Arduino, except the power going to the accelerometer on VCC was 3.3V. The thing is, the voltage going to the data pins was more than that. Probably around 4.5 to 5 volts. Of course it didn't work, but what are the chances of it getting damaged from that slight excess of voltage?

  • YellowFlower / about 14 years ago / 1

    Please Help!!!!
    I'm having a headache with this sensor.
    i am using 4-WIRE SPI mode to communicate with the device.
    my problem is with the SPI.
    The code gives no sign of the SPI data ever being sent, (only the first byte).
    however. when i twist the pins of the sensor slightly to alter the contact point the SPI seems to be communicating properly. however the accelerometer never seems to respond. ie it never returns 0x28 or '(' in ASCII for the register 0x2D.
    how likely is it that the chip is damaged?
    when it is powered there is 3.3V across the VCC and GND Terminals (indicating cotinuity). but there is no current. i get no current on my multimeter in series at a range of 200uA. i dont get any current in any range above that either. could this indicate a manufacture fault? or ESD damage? or something else?

    • Metalrex / about 14 years ago / 1

      Join the club.. I have been working for weeks on trying to read register values from this sensor (4-Wire SPI). Many have had issues with this sensor and are not able to read a simple DEVID from it or even get it powered up. I have yet to try this from Sondergaard:
      It would appear that the ADXL345 SDO line -- at least when configured for 4-wire SPI, the only configuration I'm testing -- is VERY SENSITIVE TO RINGING.
      I STRONGLY RECOMMEND applications insert a damping resistor in series with the ADXL345 SDO line. I used 27 ohms here to solve the problem.

      Before this fix, I could not get the correct device ID response. Pressing my thumb all over the breakout board changed the device ID response and sometimes made it OK. After much gnashing of teeth I finally discovered this issue.

      So I think I will try that next.. I have even been confirming the data I am sending with a digital memory scope.. This sensor does not like to respond correctly, or at all!

  • ance / about 14 years ago / 1

    I'm trying out the self test feature as shown in the application section of the datasheet (pp 20-21). However, I am getting a value out of range in the z axis (-212 LSB where it's expecting a range of 75-875 LSB.
    Would anyone know what I would need to do?

  • k1 / about 14 years ago / 1

    if i needed to run two of these at the same time on an arduino, is it just a matter of switching one to the alt address, and wiring it into the an4/an5 lines?

  • esa / about 14 years ago / 1

    I need your help for the footprint of that modul. I want to design pcb which is included ADXL345. However there is no information about the dimension of the module, the size of pads, the distance between pads... How can I find these informations?

    • k1 / about 14 years ago / 1

      last page on the datasheet

      • esa / about 14 years ago / 1

        But the dimensions on the datasheet are about the sensor on the module. The module has 8 pin outs, however the last page on the datasheet there are 14 pin outs. How can I find the dimensions of the module or is there a standard for it?

  • Sondergaard / about 14 years ago / 1

    To follow up on my two earlier comments regarding sensitivity to noise and ringing: apparently there was some RFI getting into my circuit as well as the power and ringing problems I experienced. A solid ground is essential. Again, this is running 4-wire SPI on 2.7V digital power.
    This really is the most finicky part I have ever used. It doesn't take much to make it misbehave by not receiving and/or sending SPI data as expected. But with the extra power filtering, the damping resistor on the SPI output line, and a solid ground with limited RFI pickup, it finally seems to be happy.

  • Wolf12886 / about 14 years ago / 1

    If anyone else is having trouble getting this board working in i2c mode, make sure you've got a pull-up on the SD0 line. It took me a few hours of debugging to figure out that SD0 was floating low and causing the chip to switch to its alt address.

  • Sondergaard / about 14 years ago / 1

    It would appear that the ADXL345 SDO line -- at least when configured for 4-wire SPI, the only configuration I'm testing -- is VERY SENSITIVE TO RINGING.
    I STRONGLY RECOMMEND applications insert a damping resistor in series with the ADXL345 SDO line. I used 27 ohms here to solve the problem.
    Before this fix, I could not get the correct device ID response. Pressing my thumb all over the breakout board changed the device ID response and sometimes made it OK. After much gnashing of teeth I finally discovered this issue.

  • Sondergaard / about 14 years ago / 1

    This module has just two 0.1 uF decoupling capacitors, BUT the AD documentation suggests much heavier noise isolation -- 10 uF and 0.1 uF in parallel AFTER a resistance up to 100 ohms.
    Turns out AD is not kidding. I had terrible problems with inconsistent behavior until adding 10 uF decoupling and inserting a 27-ohm resistor in series with the 2.8V power supply I was using.
    I am still having trouble talking to the blasted thing via SPI, can't get the expected device-id value out, but at least the behavior is now consistent.
    Those having trouble with this breakout board might want to try adding this heavy-duty decoupling/isolation in accordance with AD recommendations! Wow what a finicky part.

  • Olfox / about 14 years ago / 1

    Before buying this module,
    Do you think that I can use Two axes ( x and y ) to mesures the tilling of a mobile and the third axe to mesure the acceleration o f this mobile?
    Thanks a lot !

  • davev / about 14 years ago / 1

    in the above code after "#include" write:
    (less than sign)wire.h(greater than sign)

  • lgg2 / about 15 years ago / 1

    I am having also problems with it. In I2C mode, sometimes is working, sending data, and stops, later continue. Other times it doesn't work nothing (this breakout). An EEPROM in the same bus work without problems...
    The same in two boards:
    - ArduinoNANO 5v + ShiftLevel
    - ATmega328p 3.3v + FT232RL Breakout
    Internals pull-ups disabled. External: 4k7, 1k, 10k and nothing.
    Any idea?

    • lgg2 / about 15 years ago / 1

      Hello again,
      A desesperted try and... works. The problem (in my case) seems to be the SCK pin. It seems to be "not_soldered_as_must" and after a fe minutes of work, went to fail. Giving heat with the soldier and pushing a bit in that area can work.
      If some one try this, be careful. The board pad can disappear easy (in my case, with several times over the same area, happened, and it is no easy make a bridge over).

  • lond / about 15 years ago / 1

    I have used the break out board for a couple of weeks now, and I had no problem to access it via i2c after setting up the right right registers.

  • tz / about 15 years ago / 1

    at my blog, harleyhacking, I have some example code that uses a 3.3v (8mhz) arduino to read the chip at the maximum rate of 3.2khz (13 bits, 3 axes).

    • EyeTic / about 15 years ago / 1

      tz, thanx for the code. I'm not sure how to use C code with the Arduino, I was hoping for a piece of authentic Arduino code or at least a point in the right direction. I'm kinda lost, I'm not even sure I have the wiring right (I'm trying to I2C communicate with the chip). Thanx

  • EyeTic / about 15 years ago / 1

    I just got this, did anyone find some Arduino/Processing code for this thing? Would be very helpful. Thanks

  • tz / about 15 years ago / 1

    Next update could you do one non-cantilevered?
    (The data sheet says it is a bad idea)
    It could fit the standard 0.7 inch breadboarding, sockets, etc.and have 4 pins each side and be much more stable.
    (Also if you could add some unpopulated SMD resistor pads to pull up the I2C, and/or have solder jumpers to pull up CS and SA so I could do I2C by just running 4 wires).

  • Rsimonton / about 15 years ago / 1

    As I interpret the docs, the 2g mode is always 10 bit. In the high res mode 4g is 11 bit, 8g is 12 bit and 16g is 13 bit. This gives you a consistent resolution over the entire range. The g values are plus and minus and the data is two's complement so you are losing one bit for a sign.

  • dimkasta / about 15 years ago / 1

    Also the datasheet is a bit vague on the actual resolution settings.
    Does it work with 16bit resolution @+-2g ?

  • tz / about 15 years ago / 1

    I wrote a sketch that outputs at 57600. Read the Wire lib info for what the calls do.
    It uses the "pull to ground" address of 0x1d. I.e. CS and AD are grounded, SCK goes to A5, SDA to A4, with 3.3 and ground to the arduino pins.
    (I originally missed a few things including apparently you need to turn on pullups on the AVR - A checklist would help)
    This board limits comment length so I can't upload it here.

  • tz / about 15 years ago / 1

    To clarify, this is with both an Arduino Pro and Lily Pad (at 3.3v), the right pins (4 wires, +.-,sda,scl - cs and adsel high) with pull-ups (Tried 330, 2k, and a few others). - I get an ACK from the address (0x3a as selected).
    Since I don't have an example of known good code (for clock rate) I can't really tell if the part is broken or if I'm just doing something wrong which is specific to this part or something subtle. I can't find any code examples specific to this part. Does anyone have this working (using the I2C, but I'll probably try the SPI just to verify it works if I must)

    • I haven't used this part with I2C, but the posted sample code should get you started with SPI. It's written in C but it should point you in the right direction for how to write your arduino sketch.

  • tz / about 15 years ago / 1

    I just got one and can't seem to make it work, at least in I2C mode, with an Arduino - either with the Wire library or using a separate short program. I can't even read the ID register - it gets hung up after sending the address.
    I've verified the timing (as far as I can without a scope - all the registers are working and the code is derived from some 2 wire eeprom code known to work).

    • EyeTic / about 15 years ago / 1

      I've plugged it in according to the schematic and the datasheet like this: scheme01 but it shorted. I've narrowed down the shorting wires to these: scheme02
      Any idea if the chip is defective or is it my wiring that is wrong?

Customer Reviews

No reviews yet.