Cannot comunicate with GY91 (BME280 sensor)

Hello there, hope someone could help me

I am using NodeMCU ESP32 WROOM-32 board

and I have one of this GY-91 sensors that has Bosch BME280 (not BMP280) sensor modules as well as MPU9250 on it

This is how I have it all connected: Imgur: The magic of the Internet

SCL on module -> GPIO22 (SCL)
SDA on module -> GPIO21 (SDA)
VIN on module -> 3.3V on NodeMCU
GND on module -> GND on NodeMCU
SDO on module -> NC (Not connected)
CS on module -> NC (Not connected)

I used this pinout: https://content.instructables.com/FOL/YWLI/JEOILQ5U/FOLYWLIJEOILQ5U.png

I used I2C scanner program from here: arduinoslovakia/i2c/i2c_tester_raspberry/i2c_tester_raspberry.ino at master · RoboUlbricht/arduinoslovakia · GitHub
and what is imidiatly wierd is that the program only finds 1 device (on address 0x77 which coresponds to BME280), while there should be another device (InvenSense MPU9255) on 0x68

but I said, ok, not a problem, since I need humidity and temperature from BME280 sensor only and nothing else

So I tried to use this library: GitHub - Erriez/ErriezBMX280: BMP280 / BME280 temperature/pressure/humidity sensor library for Arduino
like this

#include <Wire.h>
#include <ErriezBMX280.h>

#define SEA_LEVEL_PRESSURE_HPA      1026.25
ErriezBMX280 bmx280 = ErriezBMX280(0x77);

void setup()
{
    delay(500);
    Serial.begin(9600);
    while (!Serial) {
        ;
    }
    Serial.println(F("\nErriez BMP280/BMX280 example"));
    Wire.begin();
    Wire.setClock(400000);

    // Initialize sensor
    while (!bmx280.begin()) {
        Serial.println(F("Error: Could not detect sensor"));
        delay(3000);
    }
    
    Serial.print(F("\nSensor type: "));
    switch (bmx280.getChipID()) {
        case CHIP_ID_BMP280:
            Serial.println(F("BMP280\n"));
            break;
        case CHIP_ID_BME280:
            Serial.println(F("BME280\n"));
            break;
        default:
            Serial.println(F("Unknown\n"));
            break;
    }
    bmx280.setSampling(BMX280_MODE_NORMAL,    // SLEEP, FORCED, NORMAL
                       BMX280_SAMPLING_X16,   // Temp:  NONE, X1, X2, X4, X8, X16
                       BMX280_SAMPLING_X16,   // Press: NONE, X1, X2, X4, X8, X16
                       BMX280_SAMPLING_X16,   // Hum:   NONE, X1, X2, X4, X8, X16 (BME280)
                       BMX280_FILTER_X16,     // OFF, X2, X4, X8, X16
                       BMX280_STANDBY_MS_500);// 0_5, 10, 20, 62_5, 125, 250, 500, 1000
}

void loop()
{
    Serial.print(F("Temperature: "));
    Serial.print(bmx280.readTemperature());
    Serial.println(" C");

    if (bmx280.getChipID() == CHIP_ID_BME280) {
        Serial.print(F("Humidity:    "));
        Serial.print(bmx280.readHumidity());
        Serial.println(" %");
    }

    Serial.print(F("Pressure:    "));
    Serial.print(bmx280.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print(F("Altitude:    "));
    Serial.print(bmx280.readAltitude(SEA_LEVEL_PRESSURE_HPA));
    Serial.println(" m");

    Serial.println();

    delay(1000);
}

but this library cannot comunicate with my BME280 sensor, I also tried Adafruit_BME280_Library (its default and bme280test example scetch) even Adafruit_BMP280_Library (thinking that maybe someone put the BMP280 to my board instead of BME280) but nothing (of course I change the default i2c address all libaries come with from 0x76 to 0x77
no matter what I do no library can comunicate with my BME280 sensor and I cannot understand why InvenSense MPU9255 is nowhere to be seen even if the chip is present on the board

also a bit wierd is why my i2c address for BME280 is 0x77 not default 0x76 since I didn't connect any CS pin to 3.3V (which is how you change address to 0x77 if I read somewhere)

Not sure whats going on
I did accidently connect my GY-71 board using wrong pinout at first: (uploaded picture)

but I knew something was not right, when my ESP32 could not program itself properly (sketch failed to upload to ESP32) but not sure how I could possibly damanged something with this if sketch didn't even upload to ESP32 and SDA and SCL pins are the same between theese 2 pinouts

so not sure what to do, hopefully someone can help me, the wierd thing is that I can detect the board with i2c scanner but cannot comunicate with it over that address

Thanks for Anwsering and Best Regards

connecting a GY-91 to a ESP32 NodeMCU (pinout looks identical you photo in post 1) and ran I2C_detect

#include <Wire.h>
#include <i2cdetect.h>

#define I2C_SDA 21
#define I2C_SCL 22

void setup() {
  Wire.begin(I2C_SDA, I2C_SCL);
  //Wire.begin();
  Serial.begin(115200);
  Serial.println("i2cdetect example\n");
  Serial.print("Scanning address range 0x03-0x77\n\n");
  
}

void loop() {
  i2cdetect();
  delay(2000);
}

gives

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --

running the following program

 // ESP32 to GY-91 MPU9250+BMP280 10DOF

 // ESP32 3.3V to GY-91 VIN
 // ESP32 GND  to GY-91 GND
 // ESP32 GPIO22 to GY-91 SCL
 // ESP32 GPIO21 to GY-91 SDA
 
/*
  original code by MohammedDamirchi
*/

#include <MPU9250_asukiaaa.h>
#include <Adafruit_BMP280.h>

Adafruit_BMP280 bme; // I2C
MPU9250_asukiaaa mySensor;
float aX, aY, aZ, aSqrt, gX, gY, gZ, mDirection, mX, mY, mZ;

void setup() {
  Serial.begin(115200);
  while (!Serial);

#ifdef _ESP32_HAL_I2C_H_ // For ESP32
  Wire.begin();//(SDA_PIN, SCL_PIN);
  mySensor.setWire(&Wire);
#else
  Wire.begin();
  mySensor.setWire(&Wire);
#endif

  bme.begin(0x76);
  mySensor.beginAccel();
  mySensor.beginGyro();
  mySensor.beginMag();

  // You can set your own offset for mag values
  // mySensor.magXOffset = -50;
  // mySensor.magYOffset = -55;
  // mySensor.magZOffset = -10;
}

void loop() {

  if (mySensor.accelUpdate() == 0) {
    aX = mySensor.accelX();
    aY = mySensor.accelY();
    aZ = mySensor.accelZ();
    aSqrt = mySensor.accelSqrt();
    Serial.print("accelX: " + String(aX));
    Serial.print("\taccelY: " + String(aY));
    Serial.print("\taccelZ: " + String(aZ));
    Serial.print("\taccelSqrt: " + String(aSqrt));
  }

  if (mySensor.gyroUpdate() == 0) {
    gX = mySensor.gyroX();
    gY = mySensor.gyroY();
    gZ = mySensor.gyroZ();
    Serial.print("\tgyroX: " + String(gX));
    Serial.print("\tgyroY: " + String(gY));
    Serial.print("\tgyroZ: " + String(gZ));
  }

  if (mySensor.magUpdate() == 0) {
    mX = mySensor.magX();
    mY = mySensor.magY();
    mZ = mySensor.magZ();
    mDirection = mySensor.magHorizDirection();
    Serial.print("\tmagX: " + String(mX));
    Serial.print("\tmaxY: " + String(mY));
    Serial.print("\tmagZ: " + String(mZ));
    Serial.print("\thorizontalDirection: " + String(mDirection));
  }

  Serial.print("\tTemperature(*C): ");
  Serial.print(bme.readTemperature());

  Serial.print("\tPressure(Inches(Hg)): ");
  Serial.print(bme.readPressure()/3377);


  Serial.print("\tApproxAltitude(m): ");
  Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase

  Serial.println(""); // Add an empty line
  delay(1000);
  }

as I move the board around gives

accelX: -0.13	accelY: 0.01	accelZ: -1.00	accelSqrt: 1.01	gyroX: -2.20	gyroY: -11.17	gyroZ: -0.37	Temperature(*C): 23.62	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.81
accelX: -0.13	accelY: 0.02	accelZ: -0.99	accelSqrt: 1.00	gyroX: -2.14	gyroY: -11.05	gyroZ: -0.31	Temperature(*C): 23.63	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.67
accelX: -0.11	accelY: 0.07	accelZ: -1.13	accelSqrt: 1.13	gyroX: -10.62	gyroY: -50.78	gyroZ: 5.92	Temperature(*C): 23.64	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.82
accelX: -0.43	accelY: 0.78	accelZ: -0.60	accelSqrt: 1.07	gyroX: 73.00	gyroY: 32.59	gyroZ: -10.31	Temperature(*C): 23.64	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.97
accelX: -0.92	accelY: 0.36	accelZ: -0.25	accelSqrt: 1.02	gyroX: -60.36	gyroY: 30.21	gyroZ: 75.87	Temperature(*C): 23.66	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.85
accelX: -0.61	accelY: 0.38	accelZ: 0.82	accelSqrt: 1.09	gyroX: -17.27	gyroY: 81.79	gyroZ: -51.88	Temperature(*C): 23.67	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.98
accelX: 0.06	accelY: 1.04	accelZ: 0.19	accelSqrt: 1.06	gyroX: -27.04	gyroY: -113.77	gyroZ: -78.25	Temperature(*C): 23.68	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.04
accelX: -0.16	accelY: 0.86	accelZ: 0.92	accelSqrt: 1.27	gyroX: 52.86	gyroY: -34.06	gyroZ: 12.39	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.12
accelX: -0.46	accelY: 0.78	accelZ: 0.19	accelSqrt: 0.92	gyroX: -113.46	gyroY: -74.10	gyroZ: -20.75	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.12
accelX: 0.05	accelY: -0.41	accelZ: -0.96	accelSqrt: 1.05	gyroX: -86.73	gyroY: -8.79	gyroZ: 3.48	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.04
accelX: 0.28	accelY: -0.55	accelZ: -0.77	accelSqrt: 0.99	gyroX: 68.97	gyroY: -17.52	gyroZ: 18.55	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.07
accelX: 0.50	accelY: 0.34	accelZ: -0.65	accelSqrt: 0.89	gyroX: -18.01	gyroY: 42.36	gyroZ: 42.66	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.80
accelX: 0.04	accelY: 0.09	accelZ: -0.39	accelSqrt: 0.40	gyroX: -1.53	gyroY: -58.90	gyroZ: 35.03	Temperature(*C): 23.71	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.96
accelX: -0.15	accelY: 0.06	accelZ: -0.99	accelSqrt: 1.00	gyroX: -2.14	gyroY: -10.86	gyroZ: -0.31	Temperature(*C): 23.70	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.59
accelX: -0.15	accelY: 0.05	accelZ: -1.00	accelSqrt: 1.01	gyroX: -1.83	gyroY: -11.23	gyroZ: -0.37	Temperature(*C): 23.72	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.54
accelX: -0.16	accelY: 0.06	accelZ: -0.99	accelSqrt: 1.00	gyroX: -2.26	gyroY: -11.05	gyroZ: -0.18	Temperature(*C): 23.72	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.80
accelX: 0.05	accelY: 0.08	accelZ: -0.91	accelSqrt: 0.92	gyroX: -3.54	gyroY: -53.77	gyroZ: -3.36	Temperature(*C): 23.73	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.96
accelX: -0.21	accelY: 0.77	accelZ: -0.52	accelSqrt: 0.95	gyroX: 80.38	gyroY: 107.54	gyroZ: -15.14	Temperature(*C): 23.73	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.73
accelX: 0.55	accelY: 1.00	accelZ: -0.05	accelSqrt: 1.14	gyroX: 17.33	gyroY: 59.39	gyroZ: -96.68	Temperature(*C): 23.72	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.99
accelX: 0.99	accelY: 0.24	accelZ: -0.05	accelSqrt: 1.02	gyroX: 31.25	gyroY: -37.90	gyroZ: 13.55	Temperature(*C): 23.73	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.79
accelX: 0.75	accelY: 0.18	accelZ: 1.11	accelSqrt: 1.35	gyroX: 70.43	gyroY: -107.12	gyroZ: 11.29	Temperature(*C): 23.73	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.05
accelX: -0.23	accelY: -0.64	accelZ: 0.81	accelSqrt: 1.06	gyroX: -33.45	gyroY: -89.54	gyroZ: 1.10	Temperature(*C): 23.74	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.25
accelX: -1.00	accelY: -0.07	accelZ: 0.44	accelSqrt: 1.09	gyroX: 3.23	gyroY: -72.51	gyroZ: 4.94	Temperature(*C): 23.74	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 58.22
accelX: -0.02	accelY: 0.11	accelZ: -0.59	accelSqrt: 0.60	gyroX: 6.47	gyroY: 9.64	gyroZ: -0.49	Temperature(*C): 23.72	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.89
accelX: -0.33	accelY: -0.05	accelZ: -0.21	accelSqrt: 0.40	gyroX: 1.34	gyroY: -24.23	gyroZ: -0.92	Temperature(*C): 23.72	Pressure(Inches(Hg)): 29.80	ApproxAltitude(m): 57.96

I am an idiot

this is the board I have: https://www.amazon.de/-/en/CJMCU-680-Pressure-Temperature-Connection-Extremely/dp/B095HBGBWM

No wonder nothing I tried worked :smile:

After installing Adafruit bme680 library everything started to work

why do all this boards have to look so similar

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.