So I got the BNO08X Sensor for a vr project, and did I2C connections on this sensor to run a QuaternionYawPitchRoll example provided by Adafruit. However, I am not able to retrieve data as it says "I2C address not found" along with "Failed to find BNO08X chip".
Clearly, I know I am doing something wrong, but I am not able to figure it out. Can someone help me?
Here are some details:
I am using an ESP-32-s3 wroom 1
I've used the connected like this
VIN>>3.3V
GND>>GND
SDA>>GPIO8
SCL>>GPIO9
PS0>>GND
PS1>>GND
I am using Adafruit_BNO08x Library
Here is the code that I am using:
// Basic demo for readings from Adafruit BNO08x
#include <Wire.h>
#include <Adafruit_BNO08x.h>
// Define I2C pins for ESP32-S3
#define SDA_PIN 8
#define SCL_PIN 9
// Create BNO08x instance
Adafruit_BNO08x bno08x;
sh2_SensorValue_t sensorValue;
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("Adafruit BNO08x test!");
// Initialize I2C with specified SDA and SCL pins
Wire.begin(SDA_PIN, SCL_PIN);
// Try to initialize the BNO08x sensor
if (!bno08x.begin_I2C(0x4A, &Wire)) { // Try 0x4B if 0x4A doesn't work
Serial.println("Failed to find BNO08x chip");
while (1) {
delay(10);
}
}
Serial.println("BNO08x Found!");
for (int n = 0; n < bno08x.prodIds.numEntries; n++) {
Serial.print("Part ");
Serial.print(bno08x.prodIds.entry[n].swPartNumber);
Serial.print(": Version ");
Serial.print(bno08x.prodIds.entry[n].swVersionMajor);
Serial.print(".");
Serial.print(bno08x.prodIds.entry[n].swVersionMinor);
Serial.print(".");
Serial.print(bno08x.prodIds.entry[n].swVersionPatch);
Serial.print(" Build ");
Serial.println(bno08x.prodIds.entry[n].swBuildNumber);
}
setReports();
Serial.println("Reading events");
delay(100);
}
// Define sensor outputs to receive
void setReports() {
Serial.println("Setting desired reports");
if (!bno08x.enableReport(SH2_GAME_ROTATION_VECTOR)) {
Serial.println("Could not enable game rotation vector");
}
}
void loop() {
delay(10);
if (bno08x.wasReset()) {
Serial.print("Sensor was reset ");
setReports();
}
if (!bno08x.getSensorEvent(&sensorValue)) {
return;
}
switch (sensorValue.sensorId) {
case SH2_GAME_ROTATION_VECTOR:
Serial.print("Game Rotation Vector - r: ");
Serial.print(sensorValue.un.gameRotationVector.real);
Serial.print(" i: ");
Serial.print(sensorValue.un.gameRotationVector.i);
Serial.print(" j: ");
Serial.print(sensorValue.un.gameRotationVector.j);
Serial.print(" k: ");
Serial.println(sensorValue.un.gameRotationVector.k);
break;
}
}
No, I'm asking about what addresses the I2C Scanner sketch (one of the basic debugging example sketches that is included with the Wire library) produced when you ran it.
Testing your setup with a known good sketch is debugging 101.
Hi. I have a question regarding your issue. Are you using the purple BNO08X module that I was using in my post. I think I can recall that I had to buy the black adafruit module and I somehow got it to work, but I'll keep you posted if I remember anything. All I know is I modified the .h file and changed the address and it solved my issue.
so i connected SDA and SCL to pin 17 and 18. since i needed to connect them to GPIO8 and GPIO9 respectively , but it turns out i should have just simply connect them to pin 8 and 9. its so stupid and it still cost me a whole month.