A portable, high-precision environmental monitor built with ESP8266 + BME680 + OLED, leveraging the Bosch BSEC (Bosch Sensortec Environmental Cluster) library for stable Indoor Air Quality (IAQ) readings, as well as temperature, humidity, pressure, and altitude.
The latest firmware introduces barometric calibration via Serial, allowing you to set QNH (sea-level pressure) directly or ALTREF (known reference altitude) for location- and time-accurate altitude measurement.
The QNH value is stored persistently in EEPROM and remains active across power cycles.
- Bosch BSEC Integration: Provides an IAQ index (0–500) with accuracy levels (
Acc 0–3). - Comprehensive Data: Measures temperature, humidity, pressure (hPa), gas/VOC (kΩ), and computes altitude (m).
- Persistent Calibration: Saves BSEC state to EEPROM every 4 hours (only when
iaqAccuracy==3) to minimize flash wear and preserve calibration across reboots.
- Variance-Aware IAQ Smoothing: Adaptive smoothing for static IAQ—stable yet responsive.
- Self-Adapting Gas Baseline: Automatically adjusts over time; freezes baseline when rapid environmental changes are detected.
- Altitude Filtering: Median-of-3 → outlier clamp (±18 m) → EMA with 0.4 m deadband for smooth and stable altitude readings.
- Serial-Based Calibration (No Wi-Fi Needed):
QNH=<hPa>→ set local QNH, store to EEPROM, persist across reboots.ALTREF=<m>→ compute QNH from known altitude reference, save and apply automatically.QNH?,ALT?,PRESS?→ quick inspection commands.
- Automatic Filter Reset: Setting QNH/ALTREF resets altitude smoothing for instant convergence.
- Precision Rule: ±1 hPa ≈ ±8–9 m at mid-altitudes.
Recalibrate whenever you change location or weather conditions vary.
- Automatic OLED Rotation: Three screens cycle every 5 seconds with change-detection refresh:
- Screen 1: Temperature, Humidity
- Screen 2: Pressure, Altitude
- Screen 3: Gas (kΩ), Static IAQ, Accuracy, AQS (Air Quality Status)
- Overheat Protection:
- Enters HOT HOLD mode at ≥45 °C with a moving “Overheat” warning.
- Resumes normal operation when ≤41 °C.
- BSEC Auto-Retry: Exponential backoff recovery if initialization fails.
- Offline-First Operation: Works fully offline using the last saved QNH.
- ESP8266 Dev Board + 0.96" SSD1306 OLED (I2C)
- Bosch BME680 Sensor (I2C)
- LiPo + TP4056 (optional, for portable setups)
- Power switch, custom PCB/enclosure (optional)
| Function | Pin / Address |
|---|---|
| I2C SDA | GPIO 14 |
| I2C SCL | GPIO 12 |
| OLED Address | 0x3C |
| BME680 Address | 0x76 |
- Connect your Android phone to the device via USB-C OTG + data cable.
- Open Serial USB Terminal (or any compatible terminal app).
- Set baud rate to 115200, newline to CR+LF.
- Type:
QNH=1013.25(Adjust this to the latest QNH in your location. Please check weather apps such as Breezy Weather and similar apps to see the atmospheric pressure in your area)
The device stores QNH in EEPROM and immediately recalculates altitude.
- Stand at a location with a verified elevation (e.g., summit, basecamp, map marker).
- Type:
ALTREF=709(Adjust this according to the altitude of your location)
The device computes QNH from the current pressure and saves it permanently.
Verify with the command below to see the current altitude:
ALT?
- At basecamp, perform one calibration (QNH or ALTREF).
- Recalibrate if the weather changes significantly.
| Command | Function | Example Response |
|---|---|---|
QNH=1012.8 |
Set QNH (hPa), save to EEPROM, reset altitude filter | OK QNH=1012.80 hPa |
QNH? |
Show current QNH | QNH=1012.80 hPa |
ALTREF=709 |
Compute QNH from 709 m reference and save | OK QNH from ALTREF -> 1014.32 hPa |
ALT? |
Show current altitude (m) | ALT=708.9 m |
PRESS? |
Show current pressure (hPa) | P=933.10 hPa |
HELP |
List all available commands | `CMD: QNH=... |
- Formula: Based on the standard barometric equation. Real-world temperature deviations may cause small altitude offsets.
- Sensor Tolerance: BME680 pressure bias ≈ ±1 hPa → ±8–9 m error.
- Weather Impact: QNH drifts naturally with weather; recalibrate as needed during extended outdoor sessions.