The comments don’t seem to match the code. Can anyone please clarify what the parameters of this method mean? I’m unable to find an explanation anywhere.
The reason I ask is because I think the WKP pin is being reset too quickly after a bump and I want to increase the amount of time it remains HIGH.
I believe the click feature of the LIS3DH is something completely different. What you probably want to do is enable latching on INT1 in register 5, and then clear the INT1 interrupt manually by reading register REG_INT1_SRC.
This is a really useful technique for wake on move when used with stop mode sleep (sleep with pin and time) because it allows you to figure out why you were woken, either by movement or by time.
Yeah, that sounds like what I’m looking for! Do you happen to have any sample code that demonstrates the use of this library? (just reading and clearing the interrupt)
I tried your sample today and it works well, but I would like the sensitivity of motion detection to be a bit more fine-tuned. If I use a value of 4 for movement threshold, i.e…
config.setLowPowerWakeMode(4);
It requires a bit too much of a tilt of the device until it detects movement (I have to lift one side of the Asset Tracker up off the table around 1/2 inch before it detects it and it doesn’t seem to matter how fast I lift it).
If I set the value to 3, then it detects movement even when the device is sitting still.
Do you have any ideas on how I can fine-tune the movement detection further? I don’t understand well enough how the LIS3DH library works to figure that out. I would like it to detect movement, for example, if I lift one side of the Asset Tracker up about 1/8 inch off the table.
Just wanted to jump in because I’ve been exploring the demos as well - Using dmiddlecamp’s fancy motion tracker, I set the Range to 2G and Click Threshold to 70 in main.ino and I believe I’m getting the behavior you are looking for. I wanted to understand why this code example was able to wake on motion the electron when I’ve had such poor luck with all the other code examples.
For background and as I understand it, the RANGE defines the max G is associated with the max value, so that 32767 is +2g of force, and -32768 is -2g when 2_G is selected.
CLICKTHRESHHOLD, on the otherhand, sets the sensitivity of the Click Detection, thru the setClick call. When a click is detected, the INT pin is pulsed high, according to how that was configured in the registered.
I found all this on:
They do a much better job in explaining in full detail how it all works and after reading their explaination, I was better able to digest the datasheet/appnote on the chip found:
I’m not on the level of rickkas7 or dmiddlecamp - but this is my current understanding. I got interested in the particle.io electron when they came out with the asset tracker kit (around the time when v0.4.x of the firmware was out was when I learned about it) but have been unable to wake up the Electron after putting it down for a power saving nap (using the official asset tracker library). Using dmiddlecamp’s example code, I now have 4 that are behaving identically, just the way I had hoped.
So what’s the difference between the two? I’m going to guess - and believe me, it is a wild guess - that the differences between the official asset tracker library and dmiddlecamp’s work is that the latter surfaces both RANGE and setClick to adjust the sensitivity where the official library does not (as far as I can tell). I am beginning to think that you need to be able to set both to fine tune the sensitivity. My second theory is that I think I read there are some controls on how the INT pin is pulled high (and for how long) and that could also be part of the problem with the official library. Those are my two guesses which I intend on exploring both libraries to see if either theory is correct. Like I said, this is all pure speculation on my part and there are many in the community that are much more knowledgeable than I am on this topic.
The info and links you provided are eye-opening and helped me to understand the accelerometer a lot better. Thanks!
I’ve been using 4G and a threshold of 25 the past few days and have been getting good results, but didn’t understand why until now. I guess my values are pretty similar to yours when they are scaled to 2G.