A tiny CO₂ monitor for Wemos/LOLIN D1 mini (ESP8266) + Sensirion SCD30 with a 128×64 SSD1309 OLED.
It provides a dark-mode web UI (with WiFiManager captive portal), a live brightness slider, and UDP telemetry/controls.
- Wemos/LOLIN D1 mini (ESP8266)
- Sensirion SCD30 CO₂ / Temperature / Humidity sensor (I²C)
- 128×64 OLED, monochrome, SSD1309 controller (I²C)
- Optional: LM2596 buck/step-down converter (if powering from >3.3 V)
Input voltage: 3.3 V (logic).
docs/wiring.png
- WiFiManager (tzapu)
- SparkFun SCD30 Arduino Library
- U8g2 (olikraus)
- ArduinoJson v6+ (Benoit Blanchon)
- LittleFS (bundled with ESP8266 core) for config storage
In Arduino IDE → Preferences → Additional Boards Manager URLs, add:
https://arduino.esp8266.com/stable/package_esp8266com_index.json
Then open Tools → Board → Boards Manager…, search for ESP8266 by ESP8266 Community, and install.
- Wi-Fi setup: WiFiManager captive portal (AP
D1Mini-Setup) for first-time configuration; then auto-reconnect. - Web UI (dark mode):
- Status card (IP, configured UDP target and ports).
- Brightness slider (0–100) — RAM-only; 0 turns the OLED off (power-save). Resets to 0 on reboot.
- Settings to set:
- UDP target IP & port (telemetry)
- UDP listen port (brightness control)
- UDP telemetry (sender): three small packets:
T+ temperature (°C) //disabled, enable by uncommenting it
H+ humidity (%RH) //disabled, enable by uncommenting it
C+ CO₂ (ppm)
- UDP brightness (receiver): listens on the configured port; accepts either:
- ASCII integers
0..100(e.g.,"42") - single-byte binary values
0..100
- ASCII integers
- OLED display: large numeric CO₂ readout (ppm) for readability at distance.
- Config persistence: UDP target + ports saved in LittleFS (
/config.json).
Brightness is RAM-only to avoid flash wear; not persisted across resets.
- Install ESP8266 board support (see Boards Manager URL above).
- Install the Required libraries via Library Manager.
- Select Board:
LOLIN(WEMOS) D1 R2 & mini. - Open the sketch, verify the U8g2 constructor matches your OLED.
(SSD1309 is enabled by default; if you use SSD1306, switch the constructor.) - Upload.
- On boot, the device starts an AP EagleDisplay (password
config123) if it can’t join Wi-Fi. - Visit
http://192.168.4.1/to configure Wi-Fi (captive portal). - After connecting to your network, open the device’s IP to access the web UI.
- Telemetry target: configurable via web UI (IP + port).
- Packets: three separate UDP packets labeled
T,H, andC(ASCII payload). - Brightness control: send UDP to the listen port with value
0..100:- ASCII:
"0","25","100" - Binary: single byte
0..100 0turns the display OFF (power-save);>0maps to OLED contrast.
- ASCII:
- ESP8266 Arduino Core (ESP8266 Community)
- WiFiManager (tzapu)
- U8g2 (olikraus)
- ArduinoJson (B. Blanchon)
- SparkFun SCD30 library
