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 Mini | BME280 breakout | Wire | Notes |
|---|---|---|---|
| 3V3 | VIN / VCC | red | |
| GND | GND | black | |
| 33 | SDA | blue | |
| 35 | SCL | yellow |
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 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);
}// 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
Sensor ID 0x60
Temp 28.4 C Humidity 61.0 % Pressure 1006.9 hPa
Temp 28.4 C Humidity 60.9 % Pressure 1006.9 hPaSensor 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.