adafruit / Adafruit_CircuitPython_ADXL34x

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

Range/Scale and TapDetection #16

Closed benlemond closed 4 years ago

benlemond commented 4 years ago

In your documentation and in your library code you make a statement that the "Scale factor" for the threshold (THRESH_TAP) for tap detection changes based on the "Range" of the accelerometer. Can you explain how that works?

Our current impression is that the datasheet doesn't say that. It comments that the scale is a constant 62.5mG/LSB. We are interpreting "LSB" as the value set for the threshold. (i.e. if the threshold is 0xFF, then that would be equal to 16G. -- 62.5 * 255 / 1000 = 16)

ladyada commented 4 years ago

checked DS - ben is correct it does not change with range (unlike other accels) so @siddacious we just need to change the comment?

benlemond commented 4 years ago

@ladyada Is that true, though? Maybe I have a skewed view of the functionality.

For instance: I was testing the adxl43 on my desk using your library. I configured the scale to be 16G, the Datarate to be 100, and the Threshold to be 255. I understood this to be 16g. I wacked the table and the Threshold was reached. I then switched it to a 2G scale. I assumed that since the max range of the scale was 2G and the Threshold was at 16g that it should be impossible to reach the threshold. I wacked the table again and the event was set again. This tells me that either I have misinterpreted the functionality or the datasheet is wrong.

benlemond commented 4 years ago

IMO I would assume that the equation would HAVE to change based on scale like your lib indicated, but obviously the DS disagrees or is wrong.

ladyada commented 4 years ago

🤷‍♀ you could open a ticket with ADI - they'd know for sure :)

benlemond commented 4 years ago

That is my next step. I wanted to check with you all first though. I thought, due to the comment in your library that you knew something we didn't :).