Tags:
create new tag
view all tags

Understanding the LSM6DS3 measurement data

Static measurements

Before trying to understand movement we simply read out accelerometer and gyroscope data over a certain period of time. I used 1s for the measurements.

First we simply lay down the magic wand flat onto the table and measure. Here are the results:

gyroscope gyroscope corrected
horizontal_gyro.png hor_gyro_corr.png
Since there is no movement, we expect the gyroscope values to be all zero. It can be seen, that there is a small offset error in the measurements. I take the average of all gyroscope values and subtract the offset from the measured values, which gives us the plot on the right.

Now the accelerometer measurements:

Accelerometer horizontal Accelerometer vertical
acc_horizontal.png acc_vertical.png
Even though the lsm6ds3 does not move, we nevertheless see an acceleration on the z-axis. This is due to the earth gravity and corresponds to 1g

When putting the magic wand vertically, which is its default orientation, then it is the (negative) y-axis, which sees gravity. We can also see that this position is slightly less stable and there are more variations in the x and z values.

The measurements tell us the lsm6ds3 orientation in space, shown below:

orient_lsm6ds3.png

When moving down, we move in negative y direction, moving from left to right means moving in negative x direction and moving back means moving in negative z direction.

Linear movements

When moving linearily, the gyroscope should always measure the same values. Gravity will also constantly affect the different axis in the same way (no transfer from one axis to another) which simplifies interpretation of the data substantially.

In order to keep things simple, we first make measurements where we move the wand along the y-axis (up-down), then along the x-axis (left-right) and finally along the z-axis (back and forth). First up-down:

Accelerometer up-down movement Up-down movement with gravity correction
acc_up-down.png acc_up-down_corr.png
As expected, we see up-down acceleration. In the left plot we have unfiltered data from the accelerometer, while on the second one I try to compensate for gravity. We see that in this case the oscillation happens around zero.

Left right (movement along the x-axis) and back-forth (movement along the z-axis) is even simpler because the corresponding axis is not affected by gravity.

Left right movement Left right movement gravity compensated
acc_left-right.png acc_left-right_corr.png

Back-forth movement Back-forth movement gravity compensated
acc_back-forth.png acc_back-forth_corr.png
Last not least, we can try to calculate the velocity at which the lsm6ds3 is moving in space. I do this for the back and forth movement.

velocity_back_forth.png

We observe that the oscillation amplitude of the velocity curve on the z-axis increases slowly, and that the velocities for the x and y axis slightly increase. Since the velocity is calculated by integration of the acceleration values, any small error is added at each summation step, resulting in the observed effect.

Rotation

Rotation is measured by the gyroscope, which measures the speed of rotation around any of the new axis. Here is a gyroscope measurement when rotating arounc the x-axis:

rotation_x.png

To calculate an angle we must therefore integrate the gyroscope values. The gyroscope output data rate is programmed to 104 Hz, which means the the time between measurements is ~ 10 ms. dt in the integration is therefore 1/104 s. The orientation of the IMU during the roation is shown here:

orient_rotate_x.png

When looking at the accelerometer data during rotation we see changes in y and z, while the acceleration in x direction is virtually zero.

accel_rotate_x.png

-- Uli Raich - 2026-01-03

Comments


Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng acc_back-forth.png r1 manage 70.2 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_back-forth_corr.png r1 manage 69.1 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_horizontal.png r1 manage 20.7 K 2026-01-03 - 20:11 UliRaich  
PNGpng acc_left-right.png r1 manage 64.8 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_left-right_corr.png r1 manage 65.6 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_up-down.png r1 manage 59.4 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_up-down_corr.png r1 manage 63.6 K 2026-01-03 - 19:50 UliRaich  
PNGpng acc_vertical.png r1 manage 24.3 K 2026-01-03 - 20:11 UliRaich  
PNGpng accel_rotate_x.png r1 manage 41.6 K 2026-03-03 - 11:24 UliRaich  
PNGpng hor_gyro_corr.png r1 manage 43.1 K 2026-01-03 - 19:58 UliRaich  
PNGpng horizontal_gyro.png r1 manage 27.2 K 2026-01-03 - 19:58 UliRaich  
PNGpng lsm6ds3_orient.png r1 manage 5.7 K 2026-01-04 - 16:10 UliRaich  
PNGpng orient_lsm6ds3.png r1 manage 14.1 K 2026-01-04 - 16:23 UliRaich  
PNGpng orient_rotate_x.png r1 manage 25.3 K 2026-03-03 - 11:19 UliRaich  
PNGpng rotation_x.png r1 manage 38.5 K 2026-03-03 - 11:19 UliRaich  
PNGpng velocity_back_forth.png r1 manage 49.4 K 2026-01-03 - 19:50 UliRaich  
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2026-03-03 - UliRaich
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback