Go Down

Topic: are these ADXL345 accelerometers broken or they just suck? (Read 748 times) previous topic - next topic


Hi all,

i recently bought 6 of these:


because they where cheap. Now i'm thinking that broken because i have hooked them up in SPI mode and in the same config, the readings are completely different:

All in horizontal position. According to the data sheet this should result in X = 0G Y = 0G  Z = 1G

This is what i get:

accelerometer 1:

Code: [Select]

acc 1,   G value (xyz): -0.24 -0.35 -0.34
acc 1, raw value (xyz): -31 -45 -43

acc 2:
Code: [Select]

acc 1,   G value (xyz): -0.71 12.11 0.87
acc 1, raw value (xyz): -91 1552 112

acc 1,   G value (xyz): -0.73 -0.12 0.75
acc 1, raw value (xyz): -94 -16 96

acc 1,   G value (xyz): -0.73 -0.12 -1.00
acc 1, raw value (xyz): -94 -16 -128

acc 1,   G value (xyz): -0.71 4.12 0.75
acc 1, raw value (xyz): -91 528 96

acc 3:

Code: [Select]

acc 1,   G value (xyz): 0.56 -1.17 -0.03
acc 1, raw value (xyz): 72 -150 -4

acc 1,   G value (xyz): 0.56 -1.17 -0.02
acc 1, raw value (xyz): 72 -150 -3

acc 1,   G value (xyz): 0.57 -1.17 -0.02
acc 1, raw value (xyz): 73 -150 -2

acc 1,   G value (xyz): 0.57 -1.17 -0.02
acc 1, raw value (xyz): 73 -150 -2

and the fourth:

Code: [Select]

acc 1,   G value (xyz): 0.07 -0.01 0.89
acc 1, raw value (xyz): 9 -1 114

acc 1,   G value (xyz): 0.07 -0.01 0.89
acc 1, raw value (xyz): 9 -1 114

acc 1,   G value (xyz): 0.07 -0.01 0.89
acc 1, raw value (xyz): 9 -1 114

and acc 5:

Code: [Select]

acc 1,   G value (xyz): -0.09 0.06 -0.84
acc 1, raw value (xyz): -12 8 -108

and 6th:

Code: [Select]

acc 1,   G value (xyz): -0.26 -0.18 -0.30
acc 1, raw value (xyz): -33 -23 -38

So some are not conistent, it looks like they are moving while being in rest. Others just give too high values.

is it normal that you would need to compenstate or recalculate the correct values? In the tutorial on sparkfun they do not mention any calibration:


Do i need to calibrate?


Jun 08, 2012, 11:21 am Last Edit: Jun 08, 2012, 01:52 pm by Krodal Reason: 1
I had the same thing. It turned out it was the vibration of my computer on the same table.

Although only your fourth sensor has good readings, it is more likely that there is something with your code or connections.
Start with just one ADXL345 on the SPI bus, and try to get it right.

Is it connected to 3.3V ? Do you use 4-wire SPI mode ? How is the 'CS' connected ?

Do you use an example or library ? Which one ? Can you upload your code ? Are you sure the bytes are in the right order ?

Do you know there are links in the Accelerator section in the Playground : http://arduino.cc/playground/Main/InterfacingWithHardware#motion_accelerometer

I think you need to calibrate the offset anyway. As fas as I know all MEMS-based sensors need to be calibrated. Check the datasheet for "Offset Calibration".

In the end, they can get broken if they are hit too hard. But the ADXL345 can survive 10.000 g  shock ! That's more than many other sensors.


You have to be careful with most I2C/SPI dual interface accel's and gyros - most are NOT SPI-compatible (nothing else can use the SPI bus).  Although its rather slower try using the I2C interface.  To use SPI you need CPOL=1, CPHA=1 and you need to bring and hold SCLK high between SPI transactions - hence no other devices can be on the SPI bus.
[ I won't respond to messages, use the forum please ]

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview