adafruit / Adafruit_CircuitPython_ADXL34x

A CircuitPython driver for the ADXL34x family of accelerometers
MIT License
37 stars 15 forks source link

Perhaps a problem with range settings #10

Closed hartzell closed 5 years ago

hartzell commented 5 years ago

The final bit of the range setter sets the FULL-RES bit (here), which puts the device in "full resolution mode".

On page 25 of the ADXL343 data sheet, in the FULL_RES Bit section, it says:

When this bit is set to a value of 1, the device is in full resolution mode, where the output resolution increases with the g range set by the range bits to maintain a 4 mg/LSB scale factor. When the FULL_RES bit is set to 0, the device is in 10-bit mode, and the range bits determine the maximum g range and scale factor.

My reading of that section is that the range bits are ignored when in full resolution mode (FULL-RES bit set).

I believe that by setting this bit at the end of the range setter, you are ignoring the range you just set.

I can't think of a way to test this, however.

siddacious commented 5 years ago

@hartzell Thanks for taking a look.

My reading of that section is that it's saying that in full resolution mode it automatically adjusts the scale factor to maintain 4mg/LSB. Particularly this part:

...in full resolution mode, where the output resolution increases with the g range set by the range bits...

If I recall correctly, I tested this by setting a range and whacking the sensor against a table and verifying that the maximum value changes but otherwise the readings were the same as long as the measured accelerations fell within the range that was set.

I could be wrong but that makes sense to me.