cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a six axis MEMS device and build applications while processing in-the-edge

Luca SEGHIZZI
Senior
In this knowledge article we will show how you can use the in the edge functionalities of the LSM6DSV16X leveraging our Unico-GUI software tool to obtain a sequence of smart wakeup, device reconfiguration and finally spatial motion tracking.

Before starting, what do you need?

Software

The software tool that we will use in this knowledge article is Unico-GUI , a graphical user interface (available for Linux, MacOS and Windows) that supports a wide range of sensors and allows the evaluation of the in the edge features of the LSM6DSV16X .

Hardware

The STEVAL-MKI109V3 will be used in this tutorial to configure MEMS sensors and evaluate sensor outputs. Moreover, it has some advanced features for instance:
  • programmable voltage power supply 
  • current consumption measurement
  • and communication protocol which can be changed between SPI and I2C
The STEVAL-MKI109V3 can be used with different DIL24 adapter boards. In this tutorial we are going to use the STEVAL-MKI227KA, which is the DIL24 adapter board for LSM6DSV16X, the IMU to make any device smarter for any application.
For more hardware details, visit:
  • ST resource page on MEMS sensor
  •  AN5882 for more details on the Finite State Machine 

Final goal

The aim of this knowledge article is to realize the below sequence of steps with Unico-GUI and the in the edge features of the LSM6DSV16X: smart wakeup, reconfigure the device to run in a high-performance mode and finally track spatial movements.
                                                                
1167.png
 

Hands-On

Device configuration

The first step is to set the device configuration enabling the sensor fusion.
1169.png

After opening Unico-GUI it is needed to select the device LSM6DSV16X with its adapter board, the STEVAL-MKI227KA.
 
1171.jpg

Once pressed on “Select Device” button, it is possible to see on the left hand side all the in the edge functionalities of the device: FSM, MLC, Pedometer, Sensor Fusion, Qvar.
1173.png
Clicking on the Start button on the top bar we are enabling the communication between the STEVAL-MKI109V3 with the STEVAL-MKI227KA and our PC.
 
1175.jpg
It is now needed to click on the fusion tool and then on “Enable sensor fusion” button.
 
 
1177.jpg
Data coming from the sensor in real time are now streaming and it is possible to see many graphs
On top we can see the accelerometer and gyroscope raw data plots in the top.
1179.jpg
 
The gravity vector and the gyroscope bias plots in the middle. The first represents the gravity projection along the 3-axes of the device: it is computed by fusing the accelerometer and gyroscope data to generate a sort of acceleration signal that is not affected by linear accelerations, which is a mandatory requirement in tracking applications.
1181.jpg

The second plot shows the computed gyroscope offsets which are subtracted by the gyroscope signal to avoid gyroscope drift in time.
1183.jpg

Finally, the quaternion data is displayed at the bottom. Data can be converted in the roll, pitch and yaw angles representing the absolute orientation of the device in space.
1184.jpg

Finally, by clicking on the 3D mode button it is possible to see real time a teapot moving in space.
1186.jpg
 
Going back to the Unico-GUI main page and selecting on options, it is possible to see the data rate and scale of both Accelerometer and Gyroscope, in this case it is set as:
  • Accelerometer:
    • 8g full scale
    • 120Hz ODR
  • Gyroscope:
    • 2000 dps full scale
    • 120Hz ODR
From the same page and by clicking on advanced features it is possible to check the power consumption while moving the board, it includes the sensor fusion, the accelerometer and gyroscope power consumption.
 

Final flow 

Second step once the configuration of the device has been done, it is needed to implement the flow as below leveraging the FSM tool.

1190.png

 

After clicking on the FSM button, the FSM screen will open

1193.png

The first step is to align the FSM ODR to the sensors ODR, which is 120 Hz.

1196.png

Now we can start building the program. Since the device starts in a wake state, where accelerometer and gyroscope sensors are in high-performance mode, we need the device to enter in a sleep state, meaning that only the accelerometer is kept on in low-power mode. The sleep state will be enabled when the device is kept stationary for a while, for example 5 seconds.
To enter the sleep state, the first instruction of the FSM will be a GNTH1 | TI1 condition. The configured threshold is 1.1 g applied on the accelerometer norm signal, and the timer is 600 samples (which means 5 seconds at 120 Hz). Anyway, you can refer to the AN5882 for getting more details about the FSM conditions.

1199.png

1203.png

 

The next instruction will be reached when the device is stationary for 5 seconds. When it happens, we want to turn off the gyroscope and to set the accelerometer in low-power mode. For this purpose, two consecutives SETR commands are issued, one for changing the accelerometer power mode, and one for turning off the gyroscope.

1206.png

Then, we need to configure a wake-up able to set the accelerometer and gyroscope sensors back to 120 Hz in high-performance mode. In this case, the wake-up condition will be a NOP | GNTH1, using the same threshold used before. Once the wakeup signal is detected, we need to configure other two consecutives SETR commands to change again the sensors configuration.

1209.png

Finally, we need to reset the program by using the CONTREL command. To avoid generating an interrupt, the MSKIT command is issued before the CONTREL command.

1212.png

 

To allow the FSM writing the device registers using SETR commands (which means enabling the ASC feature), we need also the set the FSM_WR_CTRL_EN bit available in the FUNC_CFG_ACCESS register. Let's go to the Registers tab to set manually this bit to 1.

 

1214.jpg

Let's open again the Fusion view and the Advanced Features view. During movements, we can see that the current consumption of the device is the same as before. But, when the board is stationary for more than 5 seconds, the current consumption drops significantly. An important thing to highlight is that when the board starts moving, the orientation of the teapot is not affected by the gyroscope turning-on and accelerometer power-mode change.

Conclusion

We have seen how it is possible to use the in the edge features of the LSM6DSV16X to quickly develop your application flow consisting in smart wakeup, device reconfiguration and finally spatial tracking. You can find a dedicated webinar on the topic at this link:

https://content.st.com/smart-energy-efficient-applications-with-st-intelligent-imu-webinar.html

 

Version history
Last update:
‎2023-02-15 01:05 PM
Updated by: