arduino / nicla-sense-me-fw

Arduino Nicla Sense ME resources (libraries, bootloader, host pc utilities)

Repository from Github https://github.comarduino/nicla-sense-me-fwRepository from Github https://github.comarduino/nicla-sense-me-fw

Acceleration data never gets to 0 in steady state

droneconnect opened this issue · comments

we started testing the nicla board, loaded and executed the following sketch :

nicla-sense-me-fw/Arduino_BHY2/examples/Standalone/Standalone.ino

the acceleration parameters don't seam to be accurate. When the board is on a table steady for seconds, the values reported don't go to 0, when they actually should given no movement occurs...

some example of data being returned over serial port:

temperature: 33.940
gas: 11973.000
rotation: Quaternion values - X: -0.553   Y: -0.583   Z: 0.460   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -298   Y: -3906   Z: -1219

gyroscope: XYZ values - X: 1   Y: -1   Z: 0

temperature: 33.940
gas: 12052.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -287   Y: -3914   Z: -1189

gyroscope: XYZ values - X: 1   Y: 2   Z: 0

temperature: 33.940
gas: 11960.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -296   Y: -3907   Z: -1204

gyroscope: XYZ values - X: 2   Y: -1   Z: 0

temperature: 33.950
gas: 12045.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -304   Y: -3915   Z: -1204

gyroscope: XYZ values - X: 0   Y: 0   Z: 2

temperature: 33.940
gas: 12145.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -290   Y: -3922   Z: -1196

gyroscope: XYZ values - X: 0   Y: -1   Z: 0

temperature: 33.950
gas: 12178.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.376   Accuracy: 3.142

acceleration: XYZ values - X: -292   Y: -3912   Z: -1204

gyroscope: XYZ values - X: 1   Y: -1   Z: 0

temperature: 33.950
gas: 12219.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.375   Accuracy: 3.142

acceleration: XYZ values - X: -297   Y: -3927   Z: -1202

gyroscope: XYZ values - X: 0   Y: -2   Z: 0

temperature: 33.950
gas: 12192.000
rotation: Quaternion values - X: -0.553   Y: -0.584   Z: 0.461   W: 0.375   Accuracy: 3.142

Hi @droneconnect, the unit of measure of the acceleration data is 1g = 9.80665 m/s^2.
With the current sensor configuration settings, the sensor has a range of +/-8G within 16bits of data. Then 1g = 4096.
You should then scale down the output data by 4096.

Looking at your first collected data:
acceleration: XYZ values - X: -298 Y: -3906 Z: -1219
the Y component is very close to 4096, but you are getting values higher than 0 on X and Z, which should indicate that your device is tilted.

When the device is laid flat and still on a surface, we should expect the unscaled XYZ value close to [0, 0, 4096]. Practically there is always a small offset.

When the device is still but not flat (this should be your situation) the g vector modulus should still be close to 4096 (unscaled).
g vector modulus = sqrt (x^2 + y^2 + z^2) = sqrt (16831601) = 4102.6 = 1.002g
There is an offset of 2mg which is pretty small, which means that the device is working properly.

I hope that this clarified you how to interpret the acceleration data.

The reason why the output that you see is unscaled is that the scale factor is not fixed, but depends on the sensor configuration range. We are discussing about adding some APIs that allow to retrieve the configured sensor range.