I am using this accelerometer to count shots fired by a gel blaster. My self contained device is attached to the gun with no alteration to the gun. I want to detect the recoil from each shot and use the “single shot” interrupt to trigger the counter. It works but triggers with any small bump. I want to adjust the threshold for triggering single tap. I can see there is a register for this value in the ADXL343 datasheet but I cant work out how to change it. The Adafruit guide is a start but does not go into this detail. Sorry for the long winded explanation and possibly dumb question but I’m new to this.
Here is what I have found on the wiki:
There is also an interrupt function the turns the accelerometer off on request:
Hope this helps!
Thanks for the reply. I have already set the range to the maximum value of 16G but it still too sensitive.
The guide includes:
" Single Tap : The SINGLE_TAP bit is set when a single acceleration event that is greater than the value in the THRESH_TAP register (Address 0x1D) occurs for less time than is specified in the DUR register (Address 0x21)."
I want to know how to set the value in the threshold register. I can’t find that information.
You can use the readRegister and writeRegister functions for the registers.
Refer to the API:
Thanks for the advice. This looks very helpful.
I will give it a try. Thanks again.
How’d you get on with this? Let us know if you need any more assistance!
Support | Core Electronics
I have had a go and once I worked out the format for the functions I was able adjust several of the registers. This allowed me to fine tune the response and my project is now a success!