Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Sense Hat IMU Sample Rate - Python

Mon Jul 19, 2021 11:27 am

I posted a similar question towards the end of last week but I think I included too much information and the post became confusing, so here's a very straight forward question:

Can the sample rate of the Inertial Measurement Unit (or other sensors) of the Raspberry Pi Sense Hat be changed?

I have written a basic program in Python to poll the accelerometer / gyroscope / magnetic field sensor and I find that the maximum rate which I can sample just one of the sensors is about 40 - 60 Hz.

This value is so low that it strongly suggests to me that this is a configurable parameter of the device.

I am aware of this file: `/etc/environment/RTIMULib.ini`.

However, changing values in this file appears to have no effect.

I believe the Sense Hat Version 1.0 board uses the ST device LSM9DS1. This is option "6" in the RTIMULib.ini file.

Changing the sample rate parameter for this device later in the file does not appear to change anything when obtaining values with the Python program I have written.

- Can the sample rate be changed when using Python to read values from the Sense Hat?

- If so, how should this be done?

Several possible thoughts. Python lib for sense hat does not read `/etc/environment/RTIMULib.ini`. I have the wrong IMU device number. I made some other error which means the values in the file were not applied during configuration of the sense hat.

Posts: 92
Joined: Wed Jun 25, 2014 1:11 pm

Re: Sense Hat IMU Sample Rate - Python

Tue Aug 03, 2021 11:23 am

I wanted to bump this post as it has been a few weeks and I haven't made any progress.

The language might not be that important anymore. If this can be done with Python, C, javascript, whatever, then that is progress.

According to the 9 axis IMU datasheet (STM LSM9DS1) it should be possible to get a maximum of 1000 Hz sample rate from the 9 axis imu. I don't know whether this is supported in firmware.

If anyone knows how this can be done regardless of language please let me know.

Return to “Astro Pi”