Hi! I recently brought an Arduino Nano 33 BLE Sense and I’m trying to log the accelerometer data using the IMU feature. However, when I print the accelerations into the console, they are capped at an absolute value of 4.00 for each axis. Does anyone know how to fix this? I have put the code below:
//This is the test realm. New features and nonsense is tested here before integration into the main code.
#include <Arduino_LSM9DS1.h>
#include <Arduino_LPS22HB.h>
float xData[3000];
float yData[3000];
float zData[3000];
int timer = 0;
void setup()
{
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
exit(1);
}
if (!BARO.begin()) {
Serial.println("Failed to initialize BARO!");
exit(2);
}
}
void loop()
{
float x, y, z = 0.0;
if (IMU.accelerationAvailable())
{
IMU.readAcceleration(x, y, z);
xData[timer] = x;
yData[timer] = y;
zData[timer] = z;
Serial.print("Acceleration at time ");
Serial.print(millis());
Serial.print("ms: ");
Serial.print(x);
Serial.print(", ");
Serial.print(y);
Serial.print(", ");
Serial.println(z);
}
float pressure = BARO.readPressure();
Serial.print("Pressure at time ");
Serial.print(millis());
Serial.print("ms: ");
Serial.print(pressure);
Serial.println(" kPa");
Serial.println();
timer += 1;
delay(100);
}
Some of the output data is here:
11:02:49.843 -> Acceleration at time 60489ms: -0.41, -0.27, 0.13
11:02:49.843 -> Pressure at time 60496ms: 99.76 kPa
11:02:49.843 ->
11:02:49.943 -> Acceleration at time 60599ms: -4.00, 4.00, -4.00
11:02:49.943 -> Pressure at time 60606ms: 99.77 kPa
11:02:49.977 ->
11:02:50.080 -> Acceleration at time 60710ms: -0.32, 0.73, -0.37
11:02:50.080 -> Pressure at time 60717ms: 99.78 kPa
As you can see, at timestamp 11:02:49.943, all of the data is capped at an absolute value of 4.00. This experiment was repeated multiple times and the same result occurred. Is there a way to change/fix this? Thanks!
Thank you!