0

I am not able to read bme280 sensor values and have tried many codes online. Please have a look below-

code:-

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;


void setup() {
  Serial.begin(9600);
delay(1000);
  if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
}

void loop() {
  Serial.print("Temperature = ");
  Serial.print(bme.readTemperature());
  Serial.println("*C");

  Serial.print("Pressure = ");
  Serial.print(bme.readPressure() / 100.0F);
  Serial.println("hPa");

  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println("m");

  Serial.print("Humidity = ");
  Serial.print(bme.readHumidity());
  Serial.println("%");

  Serial.println();
  delay(1000);
}

Error:- error

Electric Wiring:-

D1 - SCL D2 - SDK VCC - 3V GND - GND

used i2c address scanner to find the address so 0x76 is correct address

what can be wrong here?

  • So the scanner finds the BME with your current wiring? – Majenko Oct 21 at 11:06
  • yes, I found 0x76 with that. when I reversed connection then it didn't detect any device. – Sultan Morbiwala Oct 21 at 11:14
  • Are you sure the I²C address for your sensor is 0x76 and not 0x77? – Dougie Oct 21 at 11:14
  • yes, I am sure that its 0x76 since that is what the scanner showed. I tried both of them anyway but both didn't work in interfacing so the problem could be something else. – Sultan Morbiwala Oct 21 at 11:17
  • erase all flash contents in the tools menu. this error seems to have nothing to do with bme. it's one of the many startup errors in esp8266. if that worked, let me know. – Tirdad Sadri Nejad Oct 21 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.