readme.md

Markdown · 48 lines

# ESP8266 BME280 Captive Portal (FlashESP)

![Example usage](https://i.imgur.com/x1mFTH9.png "Example usage")

## Short description
ESP8266 creates an **open Wi-Fi Access Point (no password)** with a **captive portal**.  
When you connect, the portal page displays live readings from a **BME280 (3.3V)** sensor: **temperature, humidity, and pressure** (auto-refresh every 2 seconds).

---

## Wiring (ESP8266 ↔ BME280, I2C, 3.3V)
> Typical I2C pins on ESP8266 boards (NodeMCU / Wemos D1 mini): **D2 = SDA (GPIO4)**, **D1 = SCL (GPIO5)**

| BME280 pin | ESP8266 pin | Notes |
|---|---:|---|
| **VCC / VIN** | **3.3V** | Sensor power (3.3V only) |
| **GND** | **GND** | Ground |
| **SDA** | **D2 (GPIO4)** | I2C data |
| **SCL** | **D1 (GPIO5)** | I2C clock |

### Notes
- Many BME280 boards use I2C address **0x76** or **0x77**. The example code tries both.
- If your module has **SDO / ADDR** pin, it often selects the I2C address (0x76 vs 0x77).
- Keep wires short for stable I2C (especially on breadboards).

---

## Required libraries
Install via Arduino Library Manager:
- **Adafruit BME280 Library**
- **Adafruit Unified Sensor**

ESP8266 / Arduino core built-ins (no extra install):
- Wire
- ESP8266WiFi
- ESP8266WebServer
- DNSServer

---

## How to use
1. Flash the firmware to ESP8266 using **FlashESP**.
2. Power the ESP8266 and BME280 (3.3V).
3. Connect to Wi-Fi network: **ESP8266_BME280** (open network).
4. Captive portal should open automatically. If not, open any website or go to `http://192.168.4.1`.
5. The portal page shows **Temperature / Humidity / Pressure** and refreshes automatically every 2 seconds.

---