How work tap detection on ADXL345?
Is it detect difference between last value and new or it detect excidion of value from zero?
| SLA Status | Assignee | Support Status |
|---|---|---|
| SLA Closed. | Open | |
ADXL345
Production
The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16g. Digital output data is formatted...
Datasheet
ADXL345 on Analog.com
How work tap detection on ADXL345?
Is it detect difference between last value and new or it detect excidion of value from zero?
The ADXL345 has internal circuitry that monitors the magnitude and duration of acceleration events. Based on user configuration, the tap event is set when thresholds are achieved. There is more details in the datasheet also.
Thanx Anthony,
I was read datasheet before.
But I don't understand how it work.
Example:
axis have x=0.2g y=0.2g z=0.8g
I set sensitivity to 16 (1g)
**********************
accel.writeRegister(ADXL345_REG_THRESH_ACT, 16);
accel.writeRegister(ADXL345_REG_THRESH_TAP, 16);
accel.writeRegister(ADXL345_REG_LATENT, 0);
accel.writeRegister(ADXL345_REG_WINDOW, 255);
accel.writeRegister(ADXL345_REG_DUR, 16);
accel.writeRegister(ADXL345_REG_TAP_AXES, 7);
accel.writeRegister(ADXL345_REG_ACT_INACT_CTL, 240);
accel.writeRegister(ADXL345_REG_INT_ENABLE, 80);
accel.writeRegister(ADXL345_REG_POWER_CTL, 8);
*****************
when threshold will be achived?
when z>1g (exceeded 16)
or
when z>1.8g (exceeded {last value} + {treshold} )
why, when I set treshold to 16 it achive theshold every second?
The threshold value you programmed in the THRESH_TAP register is not a reference value so your first assumption is correct. The tap interrupt can be detected based on the 1g threshold and those values you set for the duration, latency time and window registers.
Good answer!
Can you say more?
It have registers OFSX,OFSY and OFSZ
If I set in values OFSx to have zero on X,Y,Z axis in latency, can I detect threshold 0.1g in any axis?
or OFSx not used in threshold detection?
Offest registers are used for the offset adjustment. The value in the offset register is automatically added to the acceleration data. Please refer to the offset calibration section on the datasheet.
If you set 0 to the THRESH_TAP register, this may result in undesirable behavior if single/double tap interrupts are enabled. You may try setting it to 1 which represents 62.5mg(<0.1g). Or use THRESH_ACT register to set the threshold for any activity event.
Thanx for your answer!
But when I set THRESH_ACT=16 (not in 1) it detect any small activity and set interrupt every second
I understand for offset registers, but datasheet doesn't contain information about corellation between offset registers and treshold.
Thanks for your information. I checked your interrupt set up and I only see you configured the INT_ENABLE register(with 80, which is 0x50), it seems you are getting the DATA_READY interrupt every second. By the way, I haven't seen your set up for the INT_MAP register.