Sensitivity of accelerometer LIS2DH12

Hi guys, I’m working on project where I need to detect even the smallest movements of the device to any direction by built-in accelerometer (LIS2DH12) while keeping everything ultra-low-power.

I’m struggling to find out the best configuration for LIS2DH12 and even the datasheet is not very helpful on some values (especially the meaning of threshold and duration parameters of alarms).

I’m attaching configuration where the accelerometer alarm works, but at some angles the alarm is very insensitive - I can move the box by hand over the room easily and the alarm is not triggered.

I’m moving with my project to Hardwario from another platform and I had excellent results with ADXL362 accelerometer; while both datasheets claim very similar sensitivity, I was able to trigger alarm from ADXL362 even with indirect shake, like touching the table on which the device is lying on.

At this point, I don’t know if I’m doing something wrong with LIS2DH12 configuration or it is just the hardware limitation and I’ll need to use another accelerometer like ADXL362. Any thoughts?

Best configuration for alarm I’ve found so far:

Addr 0x30, writing: 0 # disable_irq
Addr 0x32, writing: 10 # set_threshold
Addr 0x33, writing: 0 # set_duration
Addr 0x22, writing: 40 # set_reg3
Addr 0x25, writing: 2 # set_reg6
Addr 0x24, writing: 0 # set_latch
Addr 0x30, writing: 7f # set_cfg1
Addr 0x20, writing: 2f # continuous_conversion
Addr 0x0f, reading: 51 # who_am_i
Addr 0x23, writing: 80 # set_reg4

Thank you in advance for any help!

Hello,
we did many projects with this accelerometer and it is really sensitive. So my guess is the configuration could be the issue.
Please see this project


It would be great if you share information how the device will be placed (orientation) and on which axes it will react.

Also take a look at the high-pass filter which filters “DC” value in the X,Y,Z axes. This way by enabling this filter you can rotate your device in any orientation and it only reacts to “difference”.

Thank you for providing me these examples; I was already aware of them as I mostly copy&pasted the code from there, but I decided to give it a try and I ran “Wireless Shock Sensor” unchanged; the accelerometer has the same manners like in my code though. Sometimes it just ignores movements and starts triggering the alarm only at very specific angle of the device.

I’m starting to think that my unit is somehow faulty, because I cannot get the sensitivity even at similar levels like I see in your videos. Thankfully I have another Core module on my way so I’ll check it later again. Eventually I can share short video showing the behaviour of my unit to let you see if this is expected.

Sometimes it just ignores movements and starts triggering the alarm only at very specific angle of the device.

The shock sensor does not use high-pass filter and must be mounted exactly vertically. The behaviour when you tilt the node and it triggers alarm is correct.

In that video with a coin I’m quite sure that I set the sensitivity much lower in the code.You have to tune the values.

Initially I set the sensitivity to the level, that the change of the pressure in the house caused tiny movement of the closed door and triggered the detection.

Is there any more information about that high-pass filter capability? The mention in datasheet is not verbose at all. I’m very thankful for your insights, but I would love to read more documentation instead of bother you with my questions here.

I don’t understand that witchery, but enabling High-pass filter solved my issues. For the record, I set FDS and HP_IA1 bits on address 0x21 and the accelerometer started to register even a tiny movements.

Thank you for your help!

2 Likes

awesome!
High pass filter witchery is basically averaging many values over few seconds and this average value is subtracted every time from the real value. This way you only get the difference, not the “DC” static value the accelerometer axis see.
The datasheet for LIS2DH12 is not the best. Sometimes I looked at LIS3D accelerometer which is quite similar and many functions are explained in more detail.


The best thing is that LIS3D has application note and you can find more details including nice graphs which explain the high-pass. First I was also lost when I didn’t see that app note.

1 Like

So far I’m satisfied by my current results of trial and error, but having reference to LIS3D will be great for future optimizations. Thanks!

1 Like

Hi, I have written this minimalistic driver for LIS2DH12 - you may find it better for quick parameter tuning:

These 2 values are the first thing to focus on:

Cheers! P.