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 LOLIN S2 Mini — wiring and code

Read temperature, humidity and pressure from a BME280 on a LOLIN S2 Mini over I2C on GPIO33 (SDA) and GPIO35 (SCL), 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 S2 Mini makes a tidy Wi-Fi weather node, and the BME280 gives it temperature, humidity and pressure on two wires. Use GPIO33 for SDA and GPIO35 for SCL, and power from 3V3.

The sketch prints the chip ID first: 0x60 is a BME280, 0x58 a BMP280 without humidity.

Wiring

LOLIN S2 MiniOnly the pins used are shown · 3.3 V logicBME280 breakout3V335 · 3533 · 33GNDVIN / VCCGNDSCLSDACSB (not connected)SDO (not connected)
Every connection
LOLIN S2 MiniBME280 breakoutWireNotes
3V3VIN / VCCred
GNDGNDblack
33SDAblue
35SCLyellow

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

  • GPIO33/35 are the S2 Mini’s default I2C pins (D2/D1 positions of a D1 mini). Sketches written for the ESP8266 D1 mini that call Wire.begin(D2, D1) won’t compile here — use the GPIO numbers.
  • The S2 has no Bluetooth, so this can’t become a BLE sensor; Wi-Fi (MQTT, HTTP) works as usual.
  • Keep the sensor off the board: the S2 Mini’s regulator and chip warm the air around them by a degree or two.

Code

bme280-s2mini.inoArduino C++Open in PlaygroundOpen in PlaygroundFlash
// BME280 on a LOLIN S2 Mini over I2C.
// VIN → 3V3, GND → GND, SDA → GPIO33, SCL → GPIO35.
#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(33, 35);  // SDA, SCL
  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.4 C  Humidity 61.0 %  Pressure 1006.9 hPa
Temp 28.4 C  Humidity 60.9 %  Pressure 1006.9 hPa

Common errors

“No BME280 at 0x76 or 0x77”

Check SDA on 33 and SCL on 35. Full fix.

“BLEDevice.h: No such file” when adding Bluetooth

The ESP32-S2 has no Bluetooth radio. Use Wi-Fi, or switch to an ESP32-C3/S3.

↑↓ to move · Enter to open