You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to integrate an Arduino Nano 33 sense REV2 into my first project that requires readouts from the accelerometer and gyroscope. But every time I looked at the data, it seemed like the x- and y-axis seem to be swapped in respect to the illustration on the board (above the BMM150 chip in this picture). In order to investigate I read through the Bosch BMI270 datasheet (sec. 8.2) and checked the orientation of the chip in regards to the illustration and it seems fine. Therefore I am pretty sure it's not a hardware fault with my board.
Next, I started up Arduino IDE 2.3.2 with Arduino_BMI270_BMM150 1.2.0 and wrote this little script to get the raw readout of the sensor on the serial monitor:
//test script. prints raw readout of BMI270 accelerometer to serial interface
#include "Arduino_BMI270_BMM150.h"
float x, y, z;
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");
}
void loop() {
float x, y, z;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
Serial.print("x: ");
Serial.print(x);
Serial.print(", y: ");
Serial.print(y);
Serial.print(", z: ");
Serial.println(z);
}
}
This is where things get strange: I wanted to check for earth's gravitational field with the Arduino not in motion by physically orienting it along each axis and checking for the corresponding variable in the Serial Monitor. When i orient the Arduino along the z-axis, everything is fine with x near 0.0, y near 0.0 and z near 1.0 in the serial monitor. But when orienting it along the x-axis, I get a readout of x near 1.0, y near 0.0 and z near 0.0, and when orienting it along the y-axis i get x near 1.0, y near 0.0 and z near 0.0. So it seems like x- and y-axis are swapped.
I then tried older versions of the Arduino_BMI270_BMM150 library. The problem also exists in versions 1.1.1 and 1.1.0.
When I go even further back to version 1.0.0, the units change. It doesn't give a readout in multiples of g anymore, so having it measuring gravity while not in motion along the z-axis returns around 8250 (seems like there was some very useful scaling introduced with version 1.1.0). But to my surprise it looks like the unscaled values adhere to the orientation of the illustration on the Arduino correctly! When I repeat the test described above, all three axes respond as desired.
I then went on to check the gyroscope the same way as above and got the same behaviour. I could unfortunately not check the magnetometer for now.
Digging a bit deeper I found this commit from @facchinm, which looks like it adds a distinction between TARGET_ARDUINO_NANO33BLE and other targets. Maybe this was necessary for the original Nano 33 sense, but is not necessary for the Nano 33 sense REV2? This would fit into my observation of version 1.0.0 not swapping the axes, since it got introduced in version 1.1.0.
The text was updated successfully, but these errors were encountered:
I wanted to integrate an Arduino Nano 33 sense REV2 into my first project that requires readouts from the accelerometer and gyroscope. But every time I looked at the data, it seemed like the x- and y-axis seem to be swapped in respect to the illustration on the board (above the BMM150 chip in this picture). In order to investigate I read through the Bosch BMI270 datasheet (sec. 8.2) and checked the orientation of the chip in regards to the illustration and it seems fine. Therefore I am pretty sure it's not a hardware fault with my board.
Next, I started up Arduino IDE 2.3.2 with Arduino_BMI270_BMM150 1.2.0 and wrote this little script to get the raw readout of the sensor on the serial monitor:
This is where things get strange: I wanted to check for earth's gravitational field with the Arduino not in motion by physically orienting it along each axis and checking for the corresponding variable in the Serial Monitor. When i orient the Arduino along the z-axis, everything is fine with x near 0.0, y near 0.0 and z near 1.0 in the serial monitor. But when orienting it along the x-axis, I get a readout of x near 1.0, y near 0.0 and z near 0.0, and when orienting it along the y-axis i get x near 1.0, y near 0.0 and z near 0.0. So it seems like x- and y-axis are swapped.
I then tried older versions of the Arduino_BMI270_BMM150 library. The problem also exists in versions 1.1.1 and 1.1.0.
When I go even further back to version 1.0.0, the units change. It doesn't give a readout in multiples of g anymore, so having it measuring gravity while not in motion along the z-axis returns around 8250 (seems like there was some very useful scaling introduced with version 1.1.0). But to my surprise it looks like the unscaled values adhere to the orientation of the illustration on the Arduino correctly! When I repeat the test described above, all three axes respond as desired.
I then went on to check the gyroscope the same way as above and got the same behaviour. I could unfortunately not check the magnetometer for now.
Digging a bit deeper I found this commit from @facchinm, which looks like it adds a distinction between TARGET_ARDUINO_NANO33BLE and other targets. Maybe this was necessary for the original Nano 33 sense, but is not necessary for the Nano 33 sense REV2? This would fit into my observation of version 1.0.0 not swapping the axes, since it got introduced in version 1.1.0.
The text was updated successfully, but these errors were encountered: