ADXL345 datasheet G values

Hi everyone, I want to make step counter with ADXL345. I got the algorithm but I have a problem with the data sheet and the codes.

First of all, I tried the all resolutions. For example if I use 2g my z axes's output is 283 and this is equal with the data sheet. If I use 256 for divide the values, I got 1.10 for 283 for example.
For 4g again I got 141 and I divide the value with 128 I got 1,10 again.

When I use the 8g and 16g resolution, again I max output value equal 141 . According the data sheet, max value should be 71 for 8g and 35 for the 16g and I should divide 8g value to 64, 16g value to 32. Am I correct ?

So I decided the look others code, adafruit use

#define ADXL345_MG2G_MULTIPLIER (0.004) ///< 4mg per lsb

this line for every resolution but data sheet says you should use 0.04 for 16g .

I really don't understand these.

I have one more problem in my mind. 10 bit resolution mean 2^10 = 1024 max value I guess. If I use 13 bit resolution, max value will be 2^13 = 8192. Are these true ?

adxl345datasheet

Adafruit uses a multiplying scale factor, not a dividing scale factor, and according to the table you posted, that is correct for "All g-ranges, full resolution".

Yes they are using multipling scale factor but they are using constant value which is equal 0.004 but if I want to use 16 g 10-bit resolution it needs

1/32 = 0.03125

but they are using

#define ADXL345_MG2G_MULTIPLIER (0.004) ///< 4mg per lsb

ofc. adafruit has better knowledge than my, I want to understand why are they use it.

1/256 = 0.003906, which is correct according to the data sheet, and very close to the number 0.004 used by Adafruit. Do not confuse "full resolution" with 10 bit resolution.

From the first page of the data sheet:

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)

To check whether g-scaling is correct, make sure that when held still, the accelerometer indicates approximately +/- 1g along any vertical axis.

For more accurate results, calibrate the accelerometer to remove offsets and correct for minor errors in the scale factors.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.