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.

BME280 with Arduino Nano ESP32 — I2C on A4/A5

Read temperature, humidity and pressure from a BME280 on an Arduino Nano ESP32 over I2C on A4/A5, powered from 3V3.

Arduino C++Verified — core esp32 3.3.12, Adafruit BME280 Library 2.3.0, 3 Nov 2026Compile-only

Community draft — report a mistake

The BME280 is a natural add-on for the Nano ESP32: temperature, humidity and pressure, ready to publish over Wi-Fi. Wire it to 3V3, GND, A4 (SDA) and A5 (SCL).

The sketch prints the chip ID and then a reading every 2 s.

Wiring

Arduino Nano ESP32Only the pins used are shown · 3.3 V logicBME280 breakout3V3A4A5GNDVIN / VCCGNDSCLSDACSB (not connected)SDO (not connected)
Every connection
Arduino Nano ESP32BME280 breakoutWireNotes
3V3VIN / VCCred
GNDGNDblack
A4SDAblue
A5SCLyellow

3.3 V (VIN boards with a regulator: 3.3–5 V) part, 3.3 V board. The chip itself is 3.3 V-only. Many purple 6-pin boards have no regulator — feed them 3.3 V only. Boards with a VIN pin and regulator accept 5 V, but keep SDA/SCL at the board's logic level.

Board quirks

  • A4/A5 are the Nano ESP32’s I2C pins, same as a classic Nano. Inside they are GPIO11/12 of the ESP32-S3.
  • Power from 3V3. The common purple BME280 board has no regulator or level shifting; it must not see 5 V.
  • Because A4–A7 are ADC2 pins, the Nano ESP32 loses analog on them with Wi-Fi on. Using them for I2C leaves A0–A3 (ADC1) free for analog sensors.

Code

bme280-nanoesp32.inoArduino C++Open in PlaygroundOpen in Playground
// BME280 on an Arduino Nano ESP32 over I2C.
// VIN → 3V3, GND → GND, SDA → A4, SCL → A5.
#include <Wire.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() {
  Serial.begin(115200);
  uint32_t t0 = millis();
  while (!Serial && millis() - t0 < 3000) {}
  Wire.begin();  // A4 / A5
  if (!bme.begin(0x76, &Wire) && !bme.begin(0x77, &Wire)) {
    Serial.println("No BME280 at 0x76 or 0x77 - check SDA/SCL and power");
    while (true) delay(1000);
  }
  Serial.printf("Sensor ID 0x%02lX\n", (unsigned long)bme.sensorID());
}

void loop() {
  Serial.printf("Temp %.1f C  Humidity %.1f %%  Pressure %.1f hPa\n",
                bme.readTemperature(), bme.readHumidity(), bme.readPressure() / 100.0F);
  delay(2000);
}

Library: Adafruit BME280 Library (Adafruit (also install Adafruit Unified Sensor)) — compiled with Adafruit BME280 Library 2.3.0.

Expected serial output

Serial Monitor · 115200Output
Sensor ID 0x60
Temp 28.6 C  Humidity 60.8 %  Pressure 1006.0 hPa
Temp 28.6 C  Humidity 60.7 %  Pressure 1006.0 hPa

Common errors

“No BME280 at 0x76 or 0x77”

Check A4/A5 and 3V3. Full fix.

Sensor ID 0x58

BMP280 — no humidity.

↑↓ to move · Enter to open