GY-BME280 breakout with ESP32
Supply 3.3 V
Bus I2C
I2C address
0x76 / 0x77
Measures temperature, humidity, pressure
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| VIN | Power | 3V3 | |
| GND | Ground | GND | |
| SCL | I2C clock (SCL) | D22 | |
| SDA | I2C data (SDA) | D21 |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
Good to know
- Many boards sold as BME280 carry a BMP280, which has no humidity sensor. The chip ID register 0xD0 tells them apart: 0x60 is a BME280, 0x58 a BMP280. (Bosch BME280 and BMP280 datasheets, Register 0xD0 “id”)
- Read in normal mode at a high rate, the sensor warms itself and reads high. For weather readings use forced mode, about one reading per minute. (Bosch BME280 datasheet, Recommended modes of operation: weather monitoring)
Check it is the real chip
Read register 0xD0: a genuine part answers 0x60. BoardPilot does this automatically in “Debug a problem”.
Starter code (Arduino)
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // SDA = GPIO 21, SCL = GPIO 22
Wire.beginTransmission(0x76);
bool found = Wire.endTransmission() == 0;
Serial.println(found ? "GY-BME280 breakout found at 0x76" : "Not found: check power, GND and SDA/SCL");
}
void loop() {}
Sources
- Bosch BME280 datasheet, 5.4.1 Register 0xD0 id
- Bosch BME280 datasheet, 6.2 I2C interface (address 0x76 when SDO = GND, 0x77 when SDO = VDDIO)
- Bosch BMP280 datasheet, 4.3.1 Register 0xD0 id (0x58)
Try it in 3D in BoardPilot
GY-BME280 breakout on other boards: wiring and code
Arduino Mega 2560 R3 Arduino Nano Arduino Uno R3 WeAct Black Pill STM32F411CE ESP32-C3-DevKitM-1 ESP32-S3-DevKitC-1 Nordic nRF52840 DK NUCLEO-F401RE Raspberry Pi Pico 2 Raspberry Pi Pico W Raspberry Pi Pico Teensy 4.1
Learn the basics
Lesson: UART, I2C and SPI I2C I2C address SDA and SCL Pull-up resistor
Related parts
ADS1015 12-bit ADCADS1115 16-bit ADCADXL375 high-g accelerometer (±200 g)AHT10 temperature + humidityAHT20 + BMP280 combo moduleAHT20 temperature + humidity
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.