2017-05-15 06:36 AM
Hi,
I am working on a project that is using LIS2DH sensor for measuring the acceleration along the X,Y and Z-axis. I have configured the IC as per the following configurations:-
1>Using the 8-bit resolution to capture the data of X,Y and Z-axis.
2>we have enabled the low power mode of this sensor.
3>We have set the ODR as 50 Hz.
when we set the full scale value as +/-4g, then we get the default value for OUT_X register as 0, OUT_Y register as 0 and OUT_Z register as 30 since there is a constant acceleration along Z direction with magnitude of 1g due to gravity when the device is static. Since we are using 8-bit register the range can be vary from -128 to +127, so the default magnitude that can be achieved is 32*30 (1LSb = 32mg as per data sheet) i.e. 0.96g which is approximately equals to 1g.
When we set the full value to +/-8g then the default value when the device is static along the Z-axis is 15 so 15*64 (1LSb = 64mg as per datasheet ) i.e. 0.96g which is approx equals to 1g.
And when we set the full scale value to +/-16g then the default value when the device is static along the Z-axis is 5 so 5*192 (1LSb = 192mg as per data sheet) i.e. 0.96g which is approx 1g too but here when we calculate the full scale value by multiplying 192*127(because maximum value that can be set in 8-bit signed register is +127) i.e. 24.34g which is much far greater than the set full scale value i.e. +/-16g but in the above two cases i got the correct full scale values FS=+/-4g (127*32) i.e 4.064g and when FS=+/-8g (127*64) i.e 8.1g, so why i got the calculated full scale value much above the set full scale value i.e +/-16g ?
The datasheet and the section that is refer here is 'LIS2DH MEMS digital output motion sensor:ultra low-power high performance 3-axis “femto� accelerometer' and section 2.1 'Mechanical characteristics' respectively.
2017-05-17 07:22 AM
Hello,
I believe the answer is the same as to my similar question to a magnetometer scale asked here:
https://community.st.com/0D50X00009XkXwiSAF
(check the answer below).Long story short, according to the Mechanical characteristics section you mentioned is the provided range typical(and also the sensitivity is stated as typical), so the sensor is not guaranteed to give you the full proportional output.
2017-05-18 04:26 AM
Hi,
Thanks for your valuable reply. It's okay that the out of range values are not guaranteed but when i put my device into the static position(i.e. there is no motion in the picture), then the values shown in the OUT_X register is 0, OUT_Y register is 0 and OUT_Z register is 5.
1) So are these default values correct or not, because FS=+/-16g and 1LSb = 192mg as per datasheet so 5*192 = 960mg( 0.96g)..
2) when i shake the device along Z-axis by smooth hands it is giving the value of 109 along Z-axis which equals to 109*192 = 20g(as per the calculation) but i don't think acceleration is not that much (roughly it's around 2g to 3g). What is the exact reason for such variation?
2017-05-18 10:56 AM
Hello,
1) Yes, these values are reasonable for a still device. X and Y are zero, because the earth acceleration in these ways is practically zero. Z should give an output of 1 g (= 9,806 m/s^2, depending on your location, but the difference will be approximately the same as the sensor scale and noise) because of a Earth's gravitational acceleration.
I recommend rotating the device around all axles for a simple evaluation.
2) 20 g is too much, as you say, 2 - 3 g could be OK. I tried shaking heavily with a board with an
http://www.st.com/en/mems-and-sensors/lis3mdl.html
mounted and here is the result:You can paste your sensor setup and output values to be checked by someone from ST. (Or if you can create a graph similar to mine from your output values during some operations, rotating etc.)
2017-05-19 06:27 AM
Hi David,
I am really grateful that you've replied, Would you please share the source code with me so that i can know whether you have used FIFO or read the values direct from the registers. If the FIFO has been used then what are the configurations of the other registers that you've done?
2017-05-19 07:19 AM
Hello Mohit,
The screenshot attached above is from a
http://www.st.com/en/embedded-software/bluems.html
, connected to a expansion software. The software with source code can be downloaded freely at the bottom of the page (I haven't studied this code part yet, so I am afraid you will need to dive into that yourself.)I use this HW for basic testing of a few sensors (also a few other Nucleo and expansion boards can be used):