cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure and synchronize LSM6DSO to Raspeberry Pi

GDa R.1
Associate II

Hi everyone!

I have a LSM6DSO iNEMO inertial module (purchased in 2015) and I have some problems. I hope someone can help me.

1) Configuration of LSM6DSO.

I have installed the Unico GUI program on my Windows PC, to configure my inertial module. When I open it and I choose my inertial module (LSM6DSO), then I press 'select device', the program closes.

Do you need to know the motherboard to which it is connected? Beacause I don't know which motherboard the inertial sensor is connected to. I was given the system already configured and I would need to view its configuration.

2) Synchronisation to Raspberry Pi.

I connect the LSM6DSO via USB on my Rspberry Pi. If I read the port with:

'cat /dev/ttyACM0'

Seven columns appear on the screen. Below I report the first lines as an example:

~8050;-0.620339;-0.535992;+9.421141;+013.7200;-000.2013;-006.9300

~8070;-0.597607;-0.601795;+9.010772;+012.5212;-000.7262;-007.1487

~8090;-0.684347;-0.433520;+9.486345;+015.0238;-001.2513;-007.2828

~8110;-0.670589;-0.577189;+8.971889;+012.4513;-000.4725;-006.4750

~8130;-0.646062;-0.486939;+9.464211;+015.1637;-000.9013;-007.5075

...

First column represents the time stamp. The second, third and fourth columns are the accelerations along x, y, z. The fifth, sixth and seventh columns are the angular velocities around x, y, z.

What is the meaning of the time stamp? Is there the possibility of viewing at what time the data was collected, in reference to the time of the Raspberry? I would need this information to synchronize the acquisitions of the LSM6DSO with those of the GNSS receiver (also connected to the Raspberry Pi).

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @GDa R.1​ ,

>> To describe the phenomenon (law of pendulum motion), I need to synchronize the data of LSM6DSO with those of GNSS receiver. For the GNSS receiver, I have no problems, I know the instant of time when the data is saved (h/min/sec/.../msec). For the LSM6DSO, is it possible to insert in the output data the timestamp that refers to the RPi time? Can I know the instant of time (in h/min/sec/.../msec) when the sensor data is saved?

This is a synchronization problem for the LSM6DSO, and I believe there is not a robust solution for this point, without a general purpose pin for external trigger, or without an external mechanical event generating a specific pattern from which you can synchronize the device acquisition... what you could do is using the same application processor AP for managing the GNSS receiver and the LSM6DSO device, and start the LSM6DSO acquisition when receiving a certain signal from the GNSS (through the AP), by lowering the SDA line in I2C communication or deasserting (pulling down) the CS in SPI communication: this will start the IMU data acquisition almost synchronously, and then you can reconstruct the time base from the device ODR and the number of samples (total time in sec = number of samples/ODR).

Don't know if it can be useful for your purposes...

-Eleon

View solution in original post

8 REPLIES 8
Eleon BORLINI
ST Employee

Hi @GDa R.1​ ,

>> 1) Configuration of LSM6DSO.

You may have purchased the device (LSM6DSO) soldered on the STEVAL-MKI196V1, am I right?

In this case, if you want to acquire data with Unico-GUI, you need a specific motherboard, the STEVAL-MKI109V3.

If you have this board, please check if your Unico and the firmware on the motherboard are update to the last release available online (the 9.8.9 version in the Win10 case).

>> 2) Synchronisation to Raspberry Pi.

>> What is the meaning of the time stamp?

The Timestamp embedded feature is related to the samples storage in the FIFO, and it is described in the application note AN5192, at p. 63. The time step count is given by the concatenation of the TIMESTAMP3 & TIMESTAMP2 & TIMESTAMP1 & TIMESTAMP0 registers and is represented as a 32-bit unsigned number. The nominal timestamp resolution is 25 us. It is a positive integer that starts from 0 when the device starts its operation, and is related to the ODR.

Which software/firmware are you using for the data acquisition?

-Eleon

GDa R.1
Associate II

Hi @Eleon BORLINI​! Thank you for your answer. I am sorry if I don't use technical terms, but I am at the first experience with this kind of devices and I still have to learn many things.

>> You may have purchased the device (LSM6DSO) soldered on the STEVAL-MKI196V1, am I right?

This is my first problem. I was given the device already configured and they told me that the device was an LSM6DSO, but I don't know which motherboard it's soldered to. I am getting the doubt that the motherboard is not a ST product, and this may explain why Unico GUI doesn't work. Could it be?

>> Which software/firmware are you using for the data acquisition?

I connect the IMU via USB on my RPi (with raspbian gnu/linux 9) and I save on a file the output that appears in the respective port (in my case ttyACM0). The command used is:

cat /dev/ttyACM0 > /home/pi/name_of_file.txt

I am not sure I answered your question. I would need to view the IMU configuration (in particular the frequency of data acquisition) and synchronize its output with the RPi time. Is it possible to insert a timestamp that refers to the RPi time?

Thanks again for the help.

P.S.

I managed to recover the type of devices. Motherboard is FLORA (Adafruit Industries), IMU is always from Adafruit with soldered a LSM6DSO sensor. Does Unico also work with motherboards other than ST?

Hi @GDa R.1​ ,

>> Could it be? / Does Unico also work with motherboards other than ST?

Unfortunately, the Unico interfaces only with the STEVAL-MKI109V3 motherboard, even if this tool can manage data coming from sensors and elaborate them, especially

I'm not an expert of Flora board and Arduino related project, but checking the schematic of the board itself I cannot see an LSM6DSO... Is this device connected through Vdd, GND, SDA, SCL etc pins? Are you using Arduino IDE to communicate with the FLORA board?

On the other hand, you wrote you are using a RPi for the communication with the IMU... for my better understanding, is the FLORA board connected to your Raspberry pi and to the IMU, so that you are configuring the Arduino uC as I2C master with the RPi and you communicate with the LSM6DSO via the FLORA Atmel uC?

-Eleon

GDa R.1
Associate II

Hi @Eleon BORLINI​ .

Sorry. I try to explain again.

I have this FLORA (https://www.adafruit.com/product/659 but 2015 version) and a IMU (similar to this https://www.adafruit.com/product/2020 but LSM6DSO. Purchase in 2015).

>> Is this device connected through Vdd, GND, SDA, SCL etc pins?

Yes! The LSM6DSO is connected to FLORA through GND, SCL, SDA, 3.3V pins.

>> Are you using Arduino IDE to communicate with the FLORA board?

No. I'm trying to figure out the device configuration (frequency of data acquisition) and I thought I could do it with Unico (installed on my Windows PC), simply by connecting FLORA to the Windows PC via USB. But UNICO doesn't work.

>> you wrote you are using a RPi for the communication with the IMU

Yes. My work consists of a series of experiments (for example the motion of a pendulum) where I have the aim of describing a phenomenon (for example the law of pendulum motion) starting from the outputs data of the LSM6DSO and GNSS receiver. I connect the devices (GNSS receiver via GPIO pins and FLORA (to which LSM6DSO is connected) via USB) to the RPi and mount everything on the pendulum. I record the output data of the two devices during the experiment (GNSS receiver data with RTKLIB software (I don't know if you've ever heard it) and LSM6DSO data with this command: 'cat /dev/ttyACM0 > /home/pi/name_of_file.txt'. ttyACM0 is the RPi port where I connected FLORA).

To describe the phenomenon (law of pendulum motion), I need to synchronize the data of LSM6DSO with those of GNSS receiver. For the GNSS receiver, I have no problems, I know the instant of time when the data is saved (h/min/sec/.../msec). For the LSM6DSO, is it possible to insert in the output data the timestamp that refers to the RPi time? Can I know the instant of time (in h/min/sec/.../msec) when the sensor data is saved?

I apologize for the long answer, I hope I've made my point.

Thank you for your patience and interest.

Hi @GDa R.1​ ,

>> To describe the phenomenon (law of pendulum motion), I need to synchronize the data of LSM6DSO with those of GNSS receiver. For the GNSS receiver, I have no problems, I know the instant of time when the data is saved (h/min/sec/.../msec). For the LSM6DSO, is it possible to insert in the output data the timestamp that refers to the RPi time? Can I know the instant of time (in h/min/sec/.../msec) when the sensor data is saved?

This is a synchronization problem for the LSM6DSO, and I believe there is not a robust solution for this point, without a general purpose pin for external trigger, or without an external mechanical event generating a specific pattern from which you can synchronize the device acquisition... what you could do is using the same application processor AP for managing the GNSS receiver and the LSM6DSO device, and start the LSM6DSO acquisition when receiving a certain signal from the GNSS (through the AP), by lowering the SDA line in I2C communication or deasserting (pulling down) the CS in SPI communication: this will start the IMU data acquisition almost synchronously, and then you can reconstruct the time base from the device ODR and the number of samples (total time in sec = number of samples/ODR).

Don't know if it can be useful for your purposes...

-Eleon

Hi @Eleon BORLINI​!

Thank you very much for your answers. I will try to find a solution so that the data acquisition of the two devices starts in an (almost) simultaneous way.

Thanks again!

Gianluca

Let me please know if you are eventually able to managed the synchronization!

-Eleon

Hi @Eleon BORLINI​ !

The solution found is simple but effective. It uses the Linux "GNU parallel" software, which allows you to execute commands in parallel.

The delta_t between the acquisitions of the two devices has an acceptable delay (about 0.02 sec) for the study carried out.

A greeting!

Gianluca