0

I am interfacing ADXL345 sensor by using the datasheet as well as other libraries I am able to under stand the setup of TAP threshold.

I need to confirm that in example code :

// Set values for what is considered a TAP and what is a DOUBLE TAP (0-
 255)
adxl.setTapThreshold(50);           // 62.5 mg per increment
adxl.setTapDuration(15);            // 625 μs per increment
adxl.setDoubleTapLatency(80);       // 1.25 ms per increment
adxl.setDoubleTapWindow(200);       // 1.25 ms per increment

in which user setup values which is mentioned according to scale factor as per mentioned in datasheet, I am facing doubt here and need to clear this

  1. the values mentioned for Tap solution is decimal or hexadecimal values ?

  2. Need to know the conversion formulae which is used to create for setup the threshold.

As ADXL345 sensor which, I am using has maximum resolution of 13 bits so I want to set the value as per 13 bits

Any suggestion advice regarding this will be very helpful for me to work on ADXL345 sensor interfacing with an Arduino

1 Answers1

0

The values are decimal values - you can see in the comments how they relate to actual physical values:

adxl.setTapThreshold(50);           // 62.5 mg per increment -> 62.5mg * 50 = 3.125g
adxl.setTapDuration(15);            // 625 μs per increment -> 625us * 15 = 9.375ms
adxl.setDoubleTapLatency(80);       // 1.25 ms per increment -> 1.25ms * 80 = 100ms
adxl.setDoubleTapWindow(200);       // 1.25 ms per increment -> 1.25ms * 200 = 250ms

So to work out the value you need for a threshold of Xg, use the formula

v = X / 62.5mg = X / 0.0625

For example, for a threshold of 5g:

adxl.setTapThreshold(80); // Because 5 / 0.0625 = 80
jfowkes
  • 1,495
  • 9
  • 17
  • hey, thanks a lot for the reply I have coded as per the way you suggested, but to get the output I have to compare these parameters with normal axis(x,y,z) values? – minato hentai Sep 28 '18 at 06:01
  • I am using this conversion to check the values of X Y Z axis https://github.com/ControlEverythingCommunity/ADXL345/blob/master/Arduino/ADXL345.ino – minato hentai Sep 28 '18 at 06:10