LIS3DH acceleration measurement

Hi, I want to use the LIS3DH acceleration sensor (on the RAK5010) for some motion analysis.


I tried to use both libaries ( and to get the acceleration values.
But when I calculate the total sum acceleration vector:

(where x, y, z are the acceleration values on the 3-axis in m/s²)

I get values up to 0.5 m/s² when the board is lying and not moving at all.
My expectation is, that the total sum acceleration vector should be 0 when there is no movement (–> no acceleration).


  • Board: RAK5010
  • Dev-Setup: Visual-Studio-Code + Arduino


For SENSORS_GRAVITY_EARTH I use the value from Adafruit (
Also 0.5 is so much, that it cannot be just a rounding-error.

For the acceleration-data (x, y, z) I tried all ways of retrieving the data. Eg with adafruit libary:

acc_vector = sqrt(sq(lis3dh_event.acceleration.x) + sq(lis3dh_event.acceleration.y) + sq(lis3dh_event.acceleration.z)) - SENSORS_GRAVITY_EARTH;

does anyone has any ideas on this issue ? Would be amazing to get some hints :wink:

I put some more energy in getting the LIS3DH work.
I hoped that the error is constant, so I developed some kind of calibration for the LIS3DH.
But the values I get from the sensor are a kind of radom. After moving/accellerating the sensor, it often stays at this values…
I also tried now (instead of using the upper mentioned libaries) to use the code of
But also thsi does not give me values which I could work with.

@RAK-wireless-Staff, @nero is there maybe some issue about the voltage ? Is it ensured, that the sensor gets it 3.3V ? Is there a level-shift, if the board-voltage is eg 3.7V ?
What is the correct way of using the sensor ? Sparkfun libary, Adafruit, … ?

Any other ideas ? I spent a lot of time trying to get acceptable values from the sensor, but did not find a way yet :confused:


Because the library on Arduino is not from us. We are not clear the arithmetic. But if you want to just check it moves or not, what about using the interrupt of lis3dh with a appropriate threshold value? It means you write own arithmetic.