Accelerometer - update sample rate

Hello,

is it possible to set a highter sample rate (accelerometer) then 62,5Hz (16ms), so i can detect higher frequencies then 31Hz?
Iam trying to monitor fan speed.

Greats.

Hi, on which target? Easiest might be to use https://docs.edgeimpulse.com/docs/cli-data-forwarder and just write data over serial in the desired frequency.

Otherwise you can edit the firmware for the target you’re looking at with the right frequencies (and update the driver for the accelerometer to reflect this), they are open source and linked on the platform pages.

1 Like

Hey @janjongboom,

after I could compile the project in mbed Studio i tried to update the samplerate for the accelerometer.
For this I added one line in the main.cpp (get_sensor_list(…)).

sensor_list[ix].frequencies[2] = 200.0f;

After flashing the board and starting the Edge Impulse Serial Daemon, Edge Impulse Studio showes the 200Hz in the Interface. When i start sampling the Serial Daemon is showing also a final interval of 5ms.

Is this the only thing i have to change in the firmware to update the samplerate correctly?
It seems a little bit to easy :smiley:.

Greats

Unbenannt

I tried to check the samplerate by downloading a recorded JSON data file but i thing you changed the filetype to “cbor” right? I thing the samplerate was stored in the JSON file.

@AssKicker you also need to update firmware-st-b-l475e-iot01a/BSP_B-L475E-IOT01/Drivers/BSP/B-L475E-IOT01/stm32l475e_iot01_gyro.c and set the Output_Datarate to either of these:

#define LSM6DSL_ODR_13Hz             ((uint8_t)0x10) /* Low Power mode        */
#define LSM6DSL_ODR_26Hz             ((uint8_t)0x20) /* Low Power mode        */ 
#define LSM6DSL_ODR_52Hz             ((uint8_t)0x30) /* Low Power mode        */
#define LSM6DSL_ODR_104Hz            ((uint8_t)0x40) /* Normal mode           */
#define LSM6DSL_ODR_208Hz            ((uint8_t)0x50) /* Normal mode           */
#define LSM6DSL_ODR_416Hz            ((uint8_t)0x60) /* High Performance mode */
#define LSM6DSL_ODR_833Hz            ((uint8_t)0x70) /* High Performance mode */
#define LSM6DSL_ODR_1660Hz           ((uint8_t)0x80) /* High Performance mode */
#define LSM6DSL_ODR_3330Hz           ((uint8_t)0x90) /* High Performance mode */
#define LSM6DSL_ODR_6660Hz           ((uint8_t)0xA0) /* High Performance mode */ 

image

Note that we’re polling the accelerometer, so you probably can only go to ~1000Hz with this approach.

@janjongboom i changed the Output_DataRate in the BSP_ACCELERO_Init() function (stm32l475e_iot01_accelero.c). I forgot to say that.

Am I confusing something? Aren’t we using the accelerometer sensor in the LSM6DSL chip?
Why do i have to make changes in the stm32l475e_iot01_gyro.c?

Sorry copy-paste error on my side! Yes, the accelerometer change is enough.

1 Like