A fully integrated IoT-based environmental monitoring system built on ESP8266, capable of:
- Real-time Carbon Monoxide (CO) monitoring (MQ-9)
- Temperature & Humidity sensing (DHT22)
- Local OLED visualization
- Remote dashboard control via Thinger.io
- Configurable gas threshold
- Automated email alerting when safety limits are exceeded
- WiFi-connected IoT device
- Cloud integration using Thinger.io
- Live dashboard monitoring
- Remote threshold configuration
- Automated email alert system
- Local OLED real-time display
- Externalized credentials (
secrets.h) - Non-blocking timing architecture
- Edge-side data processing
- Sensors are sampled every 2 seconds.
- CO concentration is calculated in ppm.
- Values are pushed to Thinger.io.
- If ppm exceeds threshold:
- Email alert is triggered
- Local OLED shows ALERT state
- Threshold can be remotely modified from dashboard.
| Component | Description |
|---|---|
| ESP8266 (NodeMCU) | WiFi microcontroller |
| MQ-9 | Carbon Monoxide Gas Sensor |
| DHT22 | Temperature & Humidity Sensor |
| SSD1306 OLED (128x64) | I2C Display |
| Breadboard + Jumpers | Prototyping |
Platform: Thinger.io
The dashboard provides:
- Live CO ppm gauge
- Temperature & Humidity widgets
- Remote threshold control slider
- Real-time device status
environmenttemperaturehumidityppm
threshold- Read/Write numeric resource
gas_alert_email
{
"ppm": 350,
"threshold": 200,
"temperature": 27.5,
"humidity": 33.8
}When gas concentration exceeds the configured threshold, an email is automatically triggered.
The email contains:
- Current CO ppm
- Configured threshold
- Temperature
- Humidity
- Timestamp of alert
Sensitive credentials are isolated in secrets.h
#ifndef SECRETS_H
#define SECRETS_H
#define USERNAME "your_username"
#define DEVICE_ID "your_device"
#define DEVICE_CREDENTIAL "your_credential"
#define WIFI_SSID "your_wifi"
#define WIFI_PASSWORD "your_password"
#endifThe CO concentration is calculated using the MQ-9 sensor resistance model:
Rs = (3.3 - Vout) * RL / Vout
ratio = Rs / R0
ppm = 1000 * pow(ratio, -1.5)Where:
| Value | Description |
|---|---|
RL |
Sensor load resistance (10 kΩ) |
R0 |
Calibrated baseline resistance |
NOTE: This measurement is approximate — calibration improves accuracy.
- Temperature (°C)
- Humidity (%)
- CO ppm
- ALERT indicator when threshold exceeded
The UI layout uses dynamic text centering and split-screen visualization.
- Install required Arduino libraries:
- Adafruit SSD1306
- Adafruit GFX
- DHT sensor library
- ThingerESP8266
- Create
secrets.h - Upload code to ESP8266
- Configure device in Thinger.io
- Create Email Endpoint
- Add Dashboard widgets
if (currentPPM > gasThreshold && !alertSent)- Prevents alert spamming
- Resets when ppm returns to safe range
- Configurable remotely (200–500 ppm range)
- Non-blocking loop using
millis() - Edge-side alert logic
- Payload-based endpoint invocation
- Resource-based Cloud API
- Separation of configuration and logic
- Memory-efficient design for ESP8266
This project is licensed under the MIT License.
This project demonstrates a full-stack IoT pipeline:
Sensor → Embedded Processing → Cloud API → Dashboard → Automated Notification
It is suitable for:
- Academic IoT demonstrations
- Smart home gas monitoring
- Industrial safety prototyping
- Cloud-connected embedded system portfolios



