Nano 33 IOT IMU Gyroscope

Hi there. Relatively new to Arduino and all this, and I have a question that I can't seem to find a clear answer for. Hopefully this is a good place to ask.

I got the IMU working fine, and am able to read 3 axes of Acc and Gyro, so that's all good.

But it seems to me that there is no way to know whether the board is lying right way up, or upside-down. Is it correct that according to the IMU those 2 states are the same? Or am I using the wrong measurements? I've included my code below, but there doesn't seem to be a problem with the code.

// Include onboard Nano 33 IOT IMU
#include <Arduino_LSM6DS3.h>
 
void setup() {
  Serial.begin(9600);
  // start the IMU:
  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU");
    // stop here if you can't access the IMU:
    while (true);
  }
}
 
void loop() {
  // values for acceleration &amp; rotation:
  float xAcc, yAcc, zAcc;
  float xGyro, yGyro, zGyro;
 
  // if both accelerometer and gyrometer are ready to be read:
  if (IMU.accelerationAvailable() &&
      IMU.gyroscopeAvailable()) {      
    // read accelerometer and gyrometer:
    IMU.readAcceleration(xAcc, yAcc, zAcc);
    
    // print the results:
    IMU.readGyroscope(xGyro, yGyro, zGyro);
    Serial.print(xGyro);
    Serial.print(",");
    Serial.print(yGyro);
    Serial.print(",");
    Serial.print(zGyro);
    Serial.print(",");
    Serial.print(xAcc);
    Serial.print(",");
    Serial.print(yAcc);
    Serial.print(",");
    Serial.print(zAcc);
    Serial.print(",");
  }
}

The accelerometer will tell which direction earth is. When you place the Nano in a breadboard Z should be 1 which is 1g = 9.81m/s2. When you place the board upside down you should read Z = -1. Anywhere in between X and Y will experience part of the earth acceleration.

Thanks for the information Klaus. It took a while before I could try this again, and today I did. But I can't seem to find an axis where what I want to do will work. So I'm wondering whether I'll have to attach my board at a strange angle to make it work.

Using the physical setup in the attached image (for testing), I never get 8 different measurements for each orientation (Tried x, y and z Acc). This should work right?