The BMP280 is the cheaper sibling of the BME280: temperature and pressure, no humidity. On a NodeMCU it uses the same two I2C pins, D1 and D2, and the same 3.3 V supply.
Most failures with this board are about the address, not the wiring — the library expects 0x77 and the board usually sits at 0x76. The sketch handles both and then shows the pressure trend, which is the most useful thing a barometer tells you.
Wiring
| NodeMCU ESP8266 | BMP280 breakout (GY-BMP280) | Wire | Notes |
|---|---|---|---|
| 3V3 | VCC | red | The GY-BMP280-3.3 board has no regulator: 3.3 V only, never VIN. |
| GND | GND | black | |
| D1 | SCL | yellow | D1 is GPIO5 (default SCL). |
| D2 | SDA | blue | D2 is GPIO4 (default SDA). CSB and SDO stay unconnected. |
3.3 V (boards with a regulator: 3.3–5 V) part, 3.3 V board. The common purple 6-pin GY-BMP280-3.3 board has no regulator and no level shifting: power it from 3.3 V only. On a 5 V Uno, use a board with a regulator or a level shifter on SDA/SCL.
Board quirks
- The Adafruit BMP280 library looks at address 0x77 by default, but most purple boards sold in India answer at 0x76. That mismatch is the usual reason
begin()fails; the sketch tries both. - The library also checks the chip id (0x58). A board that is really a BME280 (id 0x60) fails here — use the BME280 sketch for it and you get humidity too.
- Pressure falling by more than 1–2 hPa over a few hours usually means rain is coming — handy during the monsoon. The sketch prints the change since start-up; a real logger would compare against the reading three hours ago.
- Power it from 3V3 and keep it away from the warm ESP-12 module so the temperature reading isn’t skewed.
Code
// BMP280 (I2C, purple GY-BMP280 board) on a NodeMCU (ESP8266).
// VCC → 3V3, GND → GND, SCL → D1 (GPIO5), SDA → D2 (GPIO4).
// Prints pressure and how much it has changed since start-up — a falling trend means weather coming.
#include <Wire.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp;
float startHpa = 0;
void setup() {
Serial.begin(115200);
Serial.println();
Wire.begin(); // SDA = D2 (GPIO4), SCL = D1 (GPIO5)
// The library's default address is 0x77; most Indian purple boards answer at 0x76.
uint8_t addr = 0x76;
if (!bmp.begin(addr) && !bmp.begin(addr = 0x77)) {
Serial.println("No BMP280 at 0x76/0x77. A chip id of 0x60 means it is really a BME280.");
while (true) delay(100);
}
Serial.printf("BMP280 at 0x%02X\n", addr);
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, Adafruit_BMP280::SAMPLING_X2,
Adafruit_BMP280::SAMPLING_X16, Adafruit_BMP280::FILTER_X16,
Adafruit_BMP280::STANDBY_MS_500);
delay(100);
startHpa = bmp.readPressure() / 100.0F;
}
void loop() {
float hpa = bmp.readPressure() / 100.0F;
Serial.printf("Temp %.1f C Pressure %.2f hPa Change %+.2f hPa\n", bmp.readTemperature(), hpa, hpa - startHpa);
delay(5000);
}// BMP280 (I2C, purple GY-BMP280 board) on a NodeMCU (ESP8266).
// VCC → 3V3, GND → GND, SCL → D1 (GPIO5), SDA → D2 (GPIO4).
// Prints pressure and how much it has changed since start-up — a falling trend means weather coming.
#include <Wire.h>
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp;
float startHpa = 0;
void setup() {
Serial.begin(115200);
Serial.println();
Wire.begin(); // SDA = D2 (GPIO4), SCL = D1 (GPIO5)
// The library's default address is 0x77; most Indian purple boards answer at 0x76.
uint8_t addr = 0x76;
if (!bmp.begin(addr) && !bmp.begin(addr = 0x77)) {
Serial.println("No BMP280 at 0x76/0x77. A chip id of 0x60 means it is really a BME280.");
while (true) delay(100);
}
Serial.printf("BMP280 at 0x%02X\n", addr);
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, Adafruit_BMP280::SAMPLING_X2,
Adafruit_BMP280::SAMPLING_X16, Adafruit_BMP280::FILTER_X16,
Adafruit_BMP280::STANDBY_MS_500);
delay(100);
startHpa = bmp.readPressure() / 100.0F;
}
void loop() {
float hpa = bmp.readPressure() / 100.0F;
Serial.printf("Temp %.1f C Pressure %.2f hPa Change %+.2f hPa\n", bmp.readTemperature(), hpa, hpa - startHpa);
delay(5000);
}Library: Adafruit BMP280 Library (Adafruit (also install Adafruit Unified Sensor)) — compiled with Adafruit BMP280 Library 3.0.0.
Expected serial output
BMP280 at 0x76
Temp 28.1 C Pressure 1005.83 hPa Change +0.00 hPa
Temp 28.1 C Pressure 1005.79 hPa Change -0.04 hPa
Temp 28.2 C Pressure 1005.80 hPa Change -0.03 hPaBMP280 at 0x76 Temp 28.1 C Pressure 1005.83 hPa Change +0.00 hPa Temp 28.1 C Pressure 1005.79 hPa Change -0.04 hPa Temp 28.2 C Pressure 1005.80 hPa Change -0.03 hPa
Common errors
“No BMP280 at 0x76/0x77”
SDA/SCL swapped (SDA is D2), no 3.3 V, or the chip is a BME280. Run the I2C scanner to see what answers.
Pressure reads about 700 hPa or jumps wildly
A faulty or fake chip, or a loose GND. Re-seat the jumpers; if it persists, try another board.