What Is IoT and How Does It Work for Air Quality?
Internet of Things (IoT) is a network of devices communicating via the internet, but what makes IoT powerful for air quality management is the MQTT (Message Queuing Telemetry Transport) Protocol. Designed specifically for IoT, MQTT uses minimal bandwidth, transmits data quickly, and remains stable even on poor internet connections.
In HappySmart's system, each sensor acts as an MQTT Publisher, sending JSON payloads every 30-60 seconds to a Mosquitto Broker that serves as the central hub. Home Assistant or Node-RED then acts as a Subscriber, receiving and processing the data.
Four Essential Sensors for an IoT Air Quality System
A comprehensive system requires four sensor types: a Laser PM2.5 Sensor (Plantower PMS5003 or SPS30) using Light Scattering technology with ±10 μg/m³ accuracy; an NDIR CO2 Sensor (SCD40 or MH-Z19B) using Infrared Absorption for ±30 ppm CO2 readings; a MOX VOC Sensor (SGP30 or ZMOD4410) for TVOC; and a Capacitive Humidity and Temperature Sensor (SHT31 or BME280).
For beginners, the Airthings Wave Plus combines all sensors in one device at approximately 5,000-6,000 THB, or the HappySmart Air Sensor pre-calibrated for Thai environmental conditions.
Node-RED Dashboard: Visualizing Data in Real-Time
Node-RED is a Flow-based Programming Tool running on Node.js, ideal for building sensor data dashboards. A basic flow includes an MQTT In Node to receive broker data, a JSON Node to parse payloads, a Function Node for processing and adding metadata like AQI Category, and Dashboard Nodes displaying Gauges, Charts, and Text.
What makes Node-RED superior to typical dashboards is the ability to build complex Automation Logic without extensive coding. For example, build logic that checks PM2.5 every 30 seconds — if it exceeds 35 μg/m³ for three consecutive readings (1.5 minutes), trigger the purifier. This avoids false activations from temporary spikes.
Four Essential Automations to Configure from the Start
Four recommended automation sets: PM2.5 Response — activate purifier when PM2.5 > 35 three consecutive times, reduce speed when < 20. CO2 Ventilation — activate exhaust fan or ERV when CO2 > 900 ppm, deactivate at < 700 ppm. Humidity Guard — activate dehumidifier when humidity > 65%. Morning Routine — run ventilation from 7-8 AM daily to purge overnight CO2 accumulation.
The critical rule in automation is Hysteresis — the gap between Activate and Deactivate thresholds must be at least 15-20 μg/m³ to prevent Short Cycling that accelerates motor wear.
Measurable Benefits from an IoT Air Quality System
Six-month data tracking from a fully installed Bangkok home showed PM2.5 exceedance time (above 15 μg/m³) dropped 71% compared to before installation. Electricity bills fell 22% because purifiers only ran when needed. Users could identify which activities generated the most pollution — stir-frying raised PM2.5 from 8 to 85 μg/m³ within 3 minutes. This insight led to opening the kitchen window 5 minutes before cooking, reducing the spike by 60%.
