Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By pmulvey
#79685 I have an Aliexpress module labelled BMP/BME280 on one side and GYBMEP on the other side. The hole on the sensor is along one side rather than the corner. The Chip ID is reporting 0x60 (I put some Serial.prints in the Adafruit_BME280.cpp file). I had to change the I2C address in the Adafruit_BME280.h file to 0x76 from 0x77.

My Code:
Code: Select all#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme;
float Pressure;
float BMETemp, BMEAltitude;

void setup() {
  Serial.begin(115200);
  boolean status = bme.begin(0x76);
}

void loop() {
  printValues();
}

void printValues() {
  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();
}



The printValues() routine produces this:

Temperature = nan *C
Pressure = nan hPa
Approx. Altitude = nan m
Humidity = nan %

When I run the bme280test example I get this:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v60000318
~ld

Also when I insert the Serial.prints in the Adafruit_BME280.cpp file in the begin routine I get ChipID = 0xFF. If I place them before the delay(100) I get ChipID = 0x60 (Correct!).
readCoefficients(); // read trimming parameters, see DS 4.2.2

setSampling(); // use defaults

delay(100);
Serial.print ("ChipID=");
Serial.println (read8(BME280_REGISTER_CHIPID));
return true;
User avatar
By GHBLoos
#91019 Hi,

I have three purple BME280's (two I bought via Aliexpress, and the other one is bought localy, but probably also Aliexpress).

They all worked well, but at some point they stop working. i2c scanners can't find them anymore. I get a response from the code: 'sensorID is 0x255 (probably 0xFF is ment).

Did you have a comparable problem, and if so, how did you solve it?
User avatar
By eriksl
#91022 No my problem is different. The temperature reading remains working.

If you get 0xff (indeed) on an I2C bus, it means no data is sent by the slave (the bus is pulled up, so by default the data is '1'). It looks like your sensors are defective, or even your master (I/O pins).

I am not sure if all "aliexpress" or "ebay" sensors can handle 5V, I am only using them with 3.3V. Some of them have a voltage regulator and level shifters, but not nearly all of them.

Otherwise I'd suspect static electricity, MOS devices don't handle that very well. Although I haven't seen such a case yet.
User avatar
By esp_user
#92921 I also had problems detecting the sensor myself. The code usually stopped when checking ID "0X60". I used the "BlueDot BME280 Library" version 1.0.9, which can be downloaded in Library Manager.
BME280 -> ID 0x60
BMP280 -> ID 0x58 (!!!! without humidity sensor !!!!)

I used the following code for easier detection:

///////////////////// - START - /////////////////////
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "BlueDot_BME280.h"

BlueDot_BME280 bme = BlueDot_BME280();

float temperature, humidity, pressure, altitude;

void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // sda= GPIO_21 /scl= GPIO_22
delay(100);

// i2c address scanner code

byte error, address;
int nDevices;
Serial.print("=============================================\n");
nDevices = 0;
for(address = 1; address < 127; address++ ) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
nDevices++;
}
else if (error==4) {
Serial.print("Unknow error at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
}
else {
Serial.println("---------------------------------------------\n");
}

// BMP280/BME280 settings and calibration

bme.parameter.communication = 0; //Choose communication protocol
bme.parameter.I2CAddress = 0x76; //Choose I2C Address
bme.parameter.sensorMode = 0b11; //Choose sensor mode
bme.parameter.IIRfilter = 0b100; //Setup for IIR Filter
bme.parameter.tempOversampling = 0b101; //Setup Temperature Ovesampling
bme.parameter.tempOutsideCelsius = 15; //default value of 15°C
bme.parameter.humidOversampling = 0b101;
bme.parameter.pressOversampling = 0b101;
bme.parameter.pressureSeaLevel = 1013.25; //default value of 1013.25 hPa
bme.init();

// Detecting sensor ID

Serial.println("=============================================");
Serial.print("------------ ID senzorja: 0x"); Serial.print(bme.checkID(),16); Serial.print(" ------------\n");
Serial.println("---------------------------------------------");
Serial.println("ID of 0xFF probably means a bad address, a BMP 180 or BMP 085");
Serial.println("ID of 0x56-0x58 represents a BMP 280");
Serial.println("ID of 0x60 represents a BME 280");
Serial.println("ID of 0x61 represents a BME 680\n");

}
void loop() {

// Printing sensors values

Serial.print("- Temperature :"); Serial.print(bme.readTempC()); Serial.println(" °C");
Serial.print("- Humidity :"); Serial.print(bme.readHumidity()); Serial.println(" [%]");
Serial.print("- Pressure :"); Serial.print(bme.readPressure()); Serial.println(" hPa");
Serial.print("- Altitude :"); Serial.print(bme.readAltitudeMeter()); Serial.println(" m");
delay(30000);
}
///////////////////// - END - /////////////////////


Serial monitor:

=============================================
I2C device found at address 0x68
I2C device found at address 0x76
---------------------------------------------

=============================================
------------ ID senzorja: 0x58 ------------
---------------------------------------------
ID of 0xFF probably means a bad address, a BMP 180 or BMP 085
ID of 0x56-0x58 represents a BMP 280
ID of 0x60 represents a BME 280
ID of 0x61 represents a BME 680

- Temperature :28.69 °C
- Humidity :0.00 [%]
- Pressure :946.81 hPa
- Altitude :566.36 m

;)