October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Bettesworth Construction
Air Quality Monitoring

Arduino-Based Air-Quality Monitoring IoT Project: ESP32, Sensors and Cloud Dashboard

A practical guide to building an ESP32-based air-quality IoT monitor, choosing sensors, logging data to the cloud and avoiding misleading AQI claims.

By Bettesworth Construction Team Updated 8 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The best modern design is an ESP32 connected to a particulate-matter sensor, temperature/humidity sensor, optional gas sensor, local display and cloud dashboard. It can provide useful indicative trends for a room, workshop or construction environment, but it is not automatically a certified air-quality station, emergency alarm or official AQI instrument. What the project measures depends entirely on the sensors installed.

What the project does

An Arduino-compatible air-quality IoT monitor follows five stages:

  1. Sensing: sensors collect particulate, gas, temperature and humidity readings.
  2. Processing: the controller samples, filters, timestamps and validates the data.
  3. Local output: an OLED, LCD, LED or buzzer shows the current status.
  4. Connectivity: Wi-Fi sends readings to a cloud service.
  5. Visualization: a dashboard stores history, plots trends and can support notifications.
Air
 ├── MQ-series gas sensor ─┐
 ├── PMS5003 PM sensor ────┼──> ESP32
 └── BME280/DHT22 ─────────┘       ├── OLED/LCD
                                   ├── LED/buzzer
                                   └── ThingSpeak/Arduino Cloud

For construction or workshop use, the system can help identify changes associated with dust, smoke, ventilation or humidity. It should supplement—not replace—site controls, risk assessments, certified alarms and legally required monitoring.

What does it actually measure?

Sensor Useful output Important limitation
MQ-135 or similar metal-oxide sensor Broad gas-response signal Not a selective, calibrated CO2, CO or AQI instrument
PMS5003 or similar optical sensor Particle readings such as PM1.0, PM2.5 and PM10, depending on model and output Requires correct airflow, power, serial parsing and environmental interpretation
BME280, DHT22 or DHT11 Temperature and relative humidity Context variables, not direct pollution measurements
CO sensor Potential carbon-monoxide measurement Safety use requires appropriate calibration and a certified alarm product
VOC sensor VOC-related or equivalent-CO2-style output Equivalent CO2 is not the same as directly measured CO2

The EPA explains that low-cost monitors detect only the pollutants covered by their sensors. A particulate sensor will not detect carbon monoxide or radon, and an MQ-135 response cannot identify one gas uniquely without suitable calibration and controlled conditions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Air Quality Monitor Indoor, 10-in-1 Portable Smart Real-Time CO2 Detector
  • 【10-in-1 Smart Air Quality Monitor: Your All-Round Environmental Guardian】 This portable intelligent air quality tester delivers ultra-precise multi-gas detection, accurately monitoring CO₂, HCHO (formaldehyde), TVOC, benzene, PM2.5 and PM10 with an error margin of less than ±5%. Its wide detection range enables smart, reliable air quality assessments for homes, offices, workshops and other scenarios, empowering you to grasp air conditions at a glance.
  • 【Smart HD LED Color Screen with Visual Data Display System】The monitor is equipped with a high-definition color display screen, which presents real-time detection data in a clear and intuitive layout. The system can automatically generate a comprehensive environmental quality assessment report. When the air quality exceeds the safety threshold, the screen will intelligently change color to highlight abnormal data, ensuring that you can fully grasp potential risks in real time.
  • 【High-Precision Smart Sensor Technology for Unmatched Reliability】 Built with a high-performance smart chip and advanced sensor array, this tester adopts dedicated intelligent sensing technology for CO₂ detection, paired with precision electrochemical sensors for HCHO and TVOC monitoring. Unlike ordinary detectors, it features smart calibration and stable sensitivity, ensuring long-term accurate data output without frequent manual adjustments.
  • 【One-Click Smart Operation for Hassle-Free Use】 The device is designed for intuitive, intelligent operation: press and hold the Power button for 3 seconds to power on/off, and it automatically initiates full-range detection the moment it’s turned on. The default temperature unit is Celsius (℃), and you can smartly switch to Fahrenheit (℉) with a 1-second press of the Power button—no complex menus or settings required.
  • 【Portable Design with Long-Lasting Smart Battery Life】 Packed with a 2000mAh rechargeable lithium battery and a USB charging cable, the monitor supports up to 20 hours of continuous intelligent detection on a single charge. Its lightweight, compact build makes it easy to carry, allowing you to perform smart air quality checks anytime, anywhere—whether at home, in the car, or in your plant and pet areas.

Recommended hardware

Best general-purpose build: ESP32

  • ESP32 development board
  • PMS5003 or comparable particulate sensor
  • BME280 or DHT22 temperature/humidity sensor
  • Optional MQ-135 for an educational broad gas-response experiment
  • 0.96-inch I2C OLED
  • Stable 5 V supply with adequate current capacity
  • Breadboard, jumper wires, USB cable and ventilated enclosure

ESP32 is preferable for a new design because Wi-Fi is integrated and the board generally offers more memory, processing capacity and peripheral options than an Uno-only build. Arduino Cloud documents workflows for ESP32 and ESP8266 devices: Arduino Cloud documentation.

When an Uno-based design makes sense

An Arduino Uno plus ESP8266 remains useful for a classroom that already has Uno boards or wants to demonstrate separate sensing and communications layers. However, it introduces more wiring and failure points. Voltage-level mismatches, SoftwareSerial reliability, limited RAM, a shared hardware UART and changing ESP8266 AT-firmware behavior make it harder to debug.

The original Arduino Project Hub design uses SoftwareSerial, ESP8266 AT commands and a roughly 16-second ThingSpeak upload interval. It is a useful example of the conventional architecture, but not the preferred starting point for a new build: Arduino Project Hub reference.

The official Arduino Uno WiFi Rev2 is a cleaner Uno-form-factor alternative because it includes an onboard u-blox NINA-W102 wireless module. For a new, expandable project, however, ESP32 is usually the more practical choice.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Minimum and improved versions

Version Hardware and capability
Minimum prototype ESP32, one sensor, OLED, Wi-Fi dashboard, serial diagnostics and timestamped records
Better educational build PMS5003, BME280, optional MQ-135, OLED, ThingSpeak, warm-up handling and smoothing
More credible monitor Calibrated PM2.5 sensor, humidity compensation, airflow-aware enclosure, reference comparison, long-term logging and quality flags

Wiring principles

MQ-series sensor and ESP32

Many MQ modules operate from 5 V and may output an analog voltage above the ESP32 ADC limit. Never connect an unknown 5 V analog output directly to an ESP32 input. Use a verified 3.3 V-compatible output, a correctly calculated resistor divider or suitable signal conditioning. Select divider values from the actual module output and the target board’s limits; do not copy resistor values blindly. A community implementation is available at this MQ-135 reference.

PMS5003 serial sensor

Use a hardware UART where possible. Confirm the sensor supply voltage, logic levels, baud rate, frame format, TX/RX crossover, common ground, fan startup current and whether the library reports standard or atmospheric particle values. Treat the PMS5003 as a serial protocol device, not an analog sensor.

Rank #2
SenseCAP Indicator (D1)
  • Dual MCUs and Rich GPIOs: Equipped with powerful ESP32S3 and RP2040 dual MCUs and over 400 Grove-compatible GPIOs for flexible expansion options.
  • Real-time Air Quality Monitoring: Built-in tVOC and CO2 sensors, and an external Grove AHT20 temperature and humidity sensor for more precise
  • Local LoRa Hub for IoT Connectivity: Integrated Semtech SX1262 LoRa chip (optional) for connecting LoRa devices to popular IoT platforms such as Matter via Wi-Fi, without the need for additional compatible devices.
  • Fully Open Source Platform: Leverage the extensive ESP32 and Raspberry Pi open-source ecosystem for infinite application possibilities.
  • Fusion ODM Service Available: Seeed Studio also provides one-stop ODM service for quick customization and scale-up to meet various needs.

OLED

OLED VCC  -> board-compatible supply
OLED GND  -> GND
OLED SDA  -> selected I2C SDA pin
OLED SCL  -> selected I2C SCL pin

Physical pin assignments vary between ESP32 board variants. Check the exact board pinout before wiring.

Software setup

  1. Install the Arduino IDE.
  2. Add the appropriate ESP32 board package.
  3. Select the exact board model.
  4. Install libraries for Wi-Fi, the display, particulate sensor, environmental sensor and chosen cloud service.
  5. Upload a minimal Wi-Fi test sketch.
  6. Test each sensor independently.
  7. Combine sensing, display and cloud code only after each subsystem works.

For a ThingSpeak implementation, the official library documentation is at Arduino ThingSpeak documentation. ThingSpeak is well suited to simple channel-based charts and time-series uploads. Arduino Cloud is better when you want Arduino-native device management, dashboards, properties and connected-device workflows: Arduino Cloud documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep credentials out of public repositories:

const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
String writeAPIKey = "YOUR_THINGSPEAK_WRITE_KEY";

Firmware design

Organize the program into independent functions such as:

readGasSensor();
readParticulateSensor();
readEnvironment();
updateDisplay();
connectWiFi();
uploadData();
handleErrors();

A robust loop should:

  1. Read sensors.
  2. Reject missing, impossible or checksum-failing values.
  3. Apply a moving average or median filter where appropriate.
  4. Update the local display.
  5. Reconnect Wi-Fi with a timeout if necessary.
  6. Upload fields and check the response code.
  7. Record an error or quality flag if uploading fails.
  8. Repeat using a non-blocking timer.

A long delay() may enforce an upload interval, but it also freezes display updates, error handling and reconnection. Non-blocking scheduling lets local monitoring continue when the cloud service is unavailable.

Suggested dashboard fields

Field 1: PM2.5
Field 2: PM10
Field 3: temperature
Field 4: relative humidity
Field 5: raw gas-sensor ADC value
Field 6: valid AQI or clearly labelled project score
Field 7: Wi-Fi status or quality flag
Field 8: sensor error/status code

Store raw gas response separately from particulate readings. Do not label an MQ-135 field CO2_ppm unless that hardware has genuinely been calibrated for that measurement.

Why raw sensor values are not automatically AQI

A shortcut such as this is not an official AQI calculation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
int aqi = analogRead(MQ135_PIN) / 4095.0 * 500.0;

It merely maps an ADC reading to an arbitrary display range. Label the result as a raw gas-sensor value, relative gas-response index or indicative project score.

An official AQI calculation requires a qualifying pollutant, the correct unit, suitable calibration or characterization, the correct averaging period and the breakpoint table for the relevant jurisdiction. A PM2.5-derived AQI is not the same as a homemade good/moderate/poor colour scale. The EPA’s air-sensor guidance discusses calibration, accuracy, precision and environmental influences.

Warm-up, calibration and validation

MQ-series sensors

MQ sensors use a heater and require warm-up. Their resistance changes with temperature and humidity, readings drift, and multiple gases can create similar responses. A library’s default calibration constant is not universal. Without sensor-specific calibration and controlled reference conditions, a ppm value is not credible.

  1. Warm the sensor according to its datasheet and project requirements.
  2. Record repeated baseline readings in a stable environment.
  3. Compare against a known reference or controlled condition.
  4. Store calibration parameters separately from the firmware.
  5. Repeat validation after changing the enclosure, supply or location.

Particulate sensors

Compare the PM sensor with a trusted reference over multiple conditions, recording temperature and humidity at the same time. Examine both short spikes and longer averages. Cooking aerosols, dust, smoke and condensation can produce unusual results. Reject missing, implausible or saturated values. EPA provides performance targets and testing protocols at Air Sensor Performance Targets and Testing Protocols.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Placement

  • Do not place the inlet directly beside an exhaust fan.
  • Do not seal a gas sensor in an unventilated enclosure.
  • Protect electronics from direct sunlight and condensation.
  • Do not position the monitor immediately beside a person’s mouth unless that is the test.
  • For indoor use, document the room, height, airflow and distance from sources.
  • For outdoor use, protect the electronics from rain without blocking airflow.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

Wi-Fi will not connect

Check the SSID and password, confirm the network provides 2.4 GHz access where required, move the board near the router, and test a minimal Wi-Fi sketch. Use a stable supply, reconnect with a timeout, and keep local display and measurement working during outages.

Cloud uploads fail

Check the API key, endpoint, field names, network status and upload interval. Print HTTP response codes, avoid uploading on every loop, and use a current documented library. Buffer records if the project requires data preservation; otherwise record the failure state and continue locally.

Rank #4
DIYables MQ2 Gas Sensor Module for Arduino, ESP32, ESP8266, Raspberry Pi - Smoke, LPG, Methane Detection, 2 Pieces, Tutorials Provided
  • MQ2 Gas Sensor Compatibility: Seamlessly integrates with Arduino, ESP32, ESP8266, and Raspberry Pi for versatile project applications.
  • Smoke and Gas Detection: Accurately detects smoke, LPG, methane, and other combustible gases for enhanced safety monitoring.
  • High Sensitivity Module: Reliable MQ2 sensor ensures precise gas concentration measurements for DIY electronics and IoT projects.
  • Easy-to-Use Design: Plug-and-play functionality simplifies setup with Arduino, Raspberry Pi, and ESP microcontrollers.
  • Wide Application Range: Ideal for home automation, environmental monitoring, and prototyping with ESP32 and ESP8266 platforms.

The ESP32 resets

Sensor heaters, fans and Wi-Fi transmissions can expose a weak USB supply, poor breadboard connection or noisy regulator. Use an adequate supply, add appropriate local decoupling, separate noisy loads from analog measurements and inspect the serial boot log for brownout messages.

MQ-135 values look random

Check warm-up, calibration, humidity, cross-sensitivity, ADC limits and divider calculations. Log temperature and humidity, use trend filtering and report the raw response rather than claiming exact ppm.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The PM sensor reports zero or invalid frames

Check RX/TX orientation, UART speed, common ground, power, checksum handling and fan operation. Use a hardware UART and print received bytes in hexadecimal while debugging.

ESP32, Uno plus ESP8266 or a ready-made platform?

Choose ESP32 for a new build with integrated Wi-Fi, multiple interfaces and room for expansion. Choose Uno plus ESP8266 when existing hardware or a legacy lesson plan is the priority. Choose the Uno WiFi Rev2 when an official Arduino board and familiar Uno form factor matter more than maximum capacity.

ESP8266 remains useful for existing projects, but Espressif’s ESP8266EX datasheet marks the chip as not recommended for new designs. A more complete open-source alternative is the AirGradient Arduino project, intended for readers who want a finished monitoring platform rather than component-level learning.

Useful upgrades

  • Use a better-calibrated PM sensor.
  • Add an NDIR CO2 sensor for direct CO2 measurement.
  • Add a dedicated VOC sensor where VOC monitoring is the actual requirement.
  • Back up data to an SD card when Wi-Fi is unavailable.
  • Use MQTT or Home Assistant for a vendor-neutral dashboard.
  • Add battery operation and deep sleep for low-power deployments.
  • Deploy multiple nodes for room-to-room comparison.
  • Use OTA firmware updates through an appropriate connected-device workflow.

Safety and accuracy boundaries

This project monitors selected indicators; it does not prove that an environment is safe. It does not detect pollutants for which no sensor is installed, and it should not replace a certified smoke alarm, carbon-monoxide alarm, occupational monitoring system or regulatory monitoring station. The EPA’s low-cost monitor guidance explains how placement, humidity, processing and multiple contaminants can affect results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a construction site, use the device for education, trend observation and supplementary data collection. Base safety decisions on appropriate risk assessments, professional instruments, ventilation controls and applicable regulations.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Site Office

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.