Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

BMP280 with NodeMCU ESP8266 — wiring and pressure-trend code

Wire a purple GY-BMP280 board to a NodeMCU ESP8266 on D1/D2 at 3.3 V, fix the 0x76 vs 0x77 address and track the pressure trend.

Arduino C++Verified — core esp8266 3.1.2, Adafruit BMP280 Library 3.0.0, 3 Nov 2026Compile-only

Community draft — report a mistake

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 ESP8266Only the pins used are shown · 3.3 V logicBMP280 breakout (GY-BMP280)GND3V3D1D2VCCGNDSCLSDACSB (not connected)SDO (not connected)
Every connection
NodeMCU ESP8266BMP280 breakout (GY-BMP280)WireNotes
3V3VCCredThe GY-BMP280-3.3 board has no regulator: 3.3 V only, never VIN.
GNDGNDblack
D1SCLyellowD1 is GPIO5 (default SCL).
D2SDAblueD2 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-nodemcu.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// 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

Serial Monitor · 115200Output
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 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.

↑↓ to move · Enter to open