Changing the Nano 33 BLE acceleration sampling rate

Hello,

I am currently working on a project where I need to measure the mechanical vibrations from a weed whacker (up to ~1000 Hz). I am trying out the Nano 33 BLE to see if it would work. I have changed the sampling frequency (https://forum.arduino.cc/index.php?topic=648307.0) to 952 Hz but the serial monitor is only giving me 300 values per second. I am also using this sample code to test the accelerometer:

/*
Arduino LSM9DS1 - Simple Accelerometer
This example reads the acceleration values from the LSM9DS1
sensor and continuously prints them to the Serial Monitor
or Serial Plotter.
The circuit:

  • Arduino Nano 33 BLE Sense
    created 10 Jul 2019
    by Riccardo Rizzo
    This example code is in the public domain.
    */

#include <Arduino_LSM9DS1.h>

void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println(“Started”);

if (!IMU.begin()) {
Serial.println(“Failed to initialize IMU!”);
while (1);
}

Serial.print(“Accelerometer sample rate = “);
Serial.print(IMU.accelerationSampleRate());
Serial.println(” Hz”);
Serial.println();
Serial.println(“Acceleration in G’s”);
Serial.println(“X\tY\tZ”);
}

void loop() {
float x, y, z;

if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);

Serial.print(x);
Serial.print(’\t’);
Serial.print(y);
Serial.print(’\t’);
Serial.println(z);
}
}

Is there any way to change the settings in order to get ~952 values per second in the serial monitor?

Thank you in advance,
Will

Looking at the datasheet of the LSM9DS1 the maximum bandwidth of the accelerometer is just 408Hz. The sampling theorem say you need a sample rate larger than two times the maximum frequency. That is why the sensors maximum sampling frequency is 952Hz.

There are many other mems accelerometer on the market that have larger bandwidth. You should be able to find one the fits your application. Here is one that could fit.

There is a little evaluation board available in case you do not like soldering this small package.

ST LIS2DE12 adapter board for standard DIL24 socket

Both are avialable at DigiKey.

Even worse, the highest sample rate turns out not to be working

See LSM9DS1_RegisterTest

 setAccelODR result (shared ODR, i=0 switches off Gyro and Accel)
Settting 0 Oper.mode 0 ODR Gyro 0.000Hz Accel 0.000Hz
Settting 1 Oper.mode 2 ODR Gyro 14.525Hz Accel 14.525Hz
Settting 2 Oper.mode 2 ODR Gyro 58.161Hz Accel 58.161Hz
Settting 3 Oper.mode 2 ODR Gyro 116.291Hz Accel 116.291Hz
Settting 4 Oper.mode 2 ODR Gyro 232.622Hz Accel 232.622Hz
Settting 5 Oper.mode 2 ODR Gyro 464.895Hz Accel 464.895Hz
Settting 6 Oper.mode 2 ODR Gyro 478.740Hz Accel 478.740Hz
setAccelODR parameter out of range 7

 Switch off Gyro (Accelerometer only mode)
Settting 0 Oper.mode 0 ODR Gyro 0.000Hz Accel 0.000Hz
Settting 1 Oper.mode 1 ODR Gyro 0.000Hz Accel 10.027Hz
Settting 2 Oper.mode 1 ODR Gyro 0.000Hz Accel 49.951Hz
Settting 3 Oper.mode 1 ODR Gyro 0.000Hz Accel 118.078Hz
Settting 4 Oper.mode 1 ODR Gyro 0.000Hz Accel 236.479Hz
Settting 5 Oper.mode 1 ODR Gyro 0.000Hz Accel 473.040Hz
Settting 6 Oper.mode 1 ODR Gyro 0.000Hz Accel 478.240Hz
setAccelODR parameter out of range 7

So theoretically you can measure vibrations up to 239Hz. But I don't advice to use setting 6 since it showed a lot of spiking in the signal.

However, in this case I think the speed is also limited by the slow serial connection.
Use Serial.begin(115200);