LIS3DH acceleration measurement

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

Issue:

I tried to use both libaries (https://github.com/adafruit/Adafruit_LIS3DH and https://github.com/sparkfun/SparkFun_LIS3DH_Arduino_Library) to get the acceleration values.
But when I calculate the total sum acceleration vector:

Acc
(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).

Setup:

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

Details:

For SENSORS_GRAVITY_EARTH I use the value from Adafruit (https://github.com/adafruit/Adafruit_Sensor/blob/master/Adafruit_Sensor.h).
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:

lis3dh_sensor.getEvent(&lis3dh_event); 
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 https://github.com/RAKWireless/Arduino-on-Rak5010-/blob/master/Rak5010.ino#L99-L165.
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:

Hi,

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.