Built to order

TinyML Air Quality Forecaster

Knowing the air will be bad in three hours is more useful than knowing it is bad now — you can close windows, reschedule a run, or switch on a purifier. This project builds a TinyML air quality forecaster: an ESP32 node with a laser PM2.5 sensor and temperature/humidity sensing runs a quantized neural network that predicts near-term PM2.5 levels entirely on-device, displaying the forecast band (Good / Moderate / Poor) on an OLED with threshold alerts. The model is trained on the real Beijing multi-site air-quality dataset from the UCI Machine Learning Repository (hourly readings from 12

AI & Machine Learning OLED DisplayESP32TensorFlow Lite Microint8 quantizationPython training pipelinePMS5003 PM sensorBME280 climate sensorBeijing air-quality datasetHardware
TinyML Air Quality Forecaster — project thumbnail preview
More project photos (6)

The problem

Most student air-quality projects stop at displaying the current PM2.5 reading — useful, but reactive. The genuinely valuable step is forecasting: pollution follows daily rhythms driven by traffic, cooking hours, temperature inversions and wind, and those patterns are learnable. This project builds a forecaster that runs on the sensor node itself. An ESP32 reads a PMS5003 laser particulate sensor plus temperature, humidity and pressure, keeps a rolling history in RAM, and feeds it to a tiny quantized regression network that predicts PM2.5 a few hours ahead — no cloud, no API key, no subscription. Training uses the well-documented Beijing multi-site air-quality dataset from the UCI repository: hourly pollutant and meteorological readings from 12 stations across four years, the standard public dataset for this task. The report is honest about the limits: a single node's forecast is approximate and is evaluated against the dead-simple persistence baseline ("tomorrow equals today") that any forecaster must beat to be worth anything.

SYSTEM FLOW

4 components 3 connections

Live flow
Drag to explore
100%
sensorPMS5003 sensor

Measures PM2.5 and PM10 particulate levels on a fixed schedule.

Follow the working sequence

How it works

  1. The ESP32 polls the PMS5003 (PM2.5/PM10) and BME280 (temperature, humidity, pressure) on a fixed schedule and appends readings to a rolling history buffer in RAM.
  2. Every forecast cycle, firmware assembles the recent history window (design: trailing 24 hourly-equivalent samples, resampled) plus time-of-day features into the model input vector.
  3. The quantized regression network outputs the predicted PM2.5 for the forecast horizon (design: 1–3 hours ahead), entirely on-device.
  4. Firmware maps the predicted value to an air-quality band (Good / Moderate / Poor per standard breakpoints) and updates the OLED with the current reading, forecast band and trend.
  5. Crossing into the Poor band drives the alert LED/buzzer; the band thresholds are firmware constants the student can adjust.
  6. The model is trained offline on the Beijing dataset with the identical windowing, quantized to int8, and flashed with the firmware; the report includes the persistence-baseline comparison.

Tech stack:

  • ESP32 (sensing + inference)
  • PMS5003 laser PM2.5/PM10 sensor
  • BME280 temperature/humidity/pressure sensor
  • TensorFlow Lite Micro (int8 regression model)
  • Python training pipeline (pandas, TensorFlow)
  • Beijing multi-site air-quality dataset, UCI ML Repository
  • 0.96-inch OLED display, buzzer, LEDs
  • Arduino IDE / PlatformIO (C/C++ firmware)

Dataset & model details

  • Dataset: Beijing Multi-Site Air-Quality Data — hourly air-pollutant (PM2.5, PM10, SO2, NO2, CO, O3) and meteorological (temperature, pressure, dew point, rain, wind) readings from 12 nationally-controlled monitoring sites in Beijing, March 2013 to February 2017, hosted on the UCI Machine Learning Repository. Public research dataset.
  • Task: Short-horizon regression — input = trailing window of PM2.5 plus temperature/humidity/pressure and time-of-day features, output = predicted PM2.5 at the forecast horizon (1–3 hours ahead).
  • Model: Compact regression network — a small LSTM or MLP (design target ~10k–50k parameters), trained in Python with the identical windowing used on-device, post-training quantized to int8 and deployed with TensorFlow Lite Micro.
  • Metrics: MAE and RMSE on a held-out time period, compared against the persistence baseline; forecast skill is a design target reported from the actual training run in the delivered report — never claimed as measured in advance. On-device forecast behavior is characterized by the student's own logging procedure.
Parameter Value
PM sensing PMS5003 laser sensor, PM2.5/PM10 (datasheet)
Climate sensing BME280 temp/humidity/pressure (datasheet)
Forecast horizon 1–3 hours ahead (design)
History window Trailing 24 samples, resampled (design)
Model size Under ~80 KB flash after int8 quantization (design target)
Display OLED: current PM2.5, forecast band, trend
Alerts LED + buzzer on Poor-band forecast
Power 5 V USB adapter

Project features

  • [On-device PM2.5 forecasting] A quantized regression network predicts near-term PM2.5 from the sensor history and local meteorology — the forecast is computed on the ESP32, not fetched from an API.
  • [Real multi-year training data] The model is trained on the Beijing multi-site air-quality dataset (UCI ML Repository): hourly PM2.5, gases and weather from 12 monitoring stations over four years.
  • [Honest baseline comparison] Forecast skill is evaluated against the persistence baseline, and the report states plainly where the tiny model beats it and where it does not — the kind of honesty examiners respect.
  • [Forecast band display] The OLED shows current PM2.5, the predicted band (Good / Moderate / Poor) and a simple trend arrow; a buzzer/LED flags Poor-band forecasts.
  • [Multi-sensor node] A PMS5003 laser PM sensor plus BME280 temperature/humidity/pressure gives the model the meteorological context that drives pollution dynamics.
  • [Rolling history buffer] Firmware maintains the trailing sensor history in RAM with graceful handling of gaps (sensor warm-up, power cuts), documented in the report.
  • [int8 TinyML deployment] The network is quantized to 8-bit integers with TensorFlow Lite Micro, running inference on the ESP32 within its memory budget.

What is included

  • Assembled air-quality node (ESP32 + PMS5003 + BME280 + OLED + buzzer)
  • Trained int8 forecasting model and the training notebook (Beijing dataset pipeline)
  • Firmware source with sensor drivers, history buffer and inference
  • Wiring diagram and forecast-logging test procedure
  • Baseline-comparison analysis (model vs persistence) in the report
  • Project report PDF (theory, dataset, model, quantization, results)
  • PPT presentation and viva Q&A document

Limitations & prerequisites

  • A single low-cost sensor node is approximate: PMS5003 readings drift with humidity and the node is not a reference-grade monitor — the report states this plainly.
  • The Beijing training data comes from a different city and era than the student's deployment; the model transfers pollution dynamics, not local calibration, and local accuracy is approximate.
  • Forecast skill figures are design targets from the training run, reported honestly after training — nothing is claimed as measured before the build.
  • Sudden local events (nearby construction dust, a diesel generator starting) are invisible to the history window and will surprise the forecast.
  • The horizon is short (1–3 hours); multi-day forecasting needs weather-model inputs beyond this build.
  • Sensor warm-up and power gaps create history gaps; the firmware's gap handling is documented but forecasts after gaps are less reliable.

Frequently Asked Questions

Why forecast instead of just displaying current PM2.5?

Current readings are reactive; a 1–3 hour forecast lets someone act — close windows, reschedule outdoor work, start a purifier. The project demonstrates that the step from monitoring to forecasting is a learnable regression problem, not magic.

Is the Beijing dataset real?

Yes — hourly pollutant and meteorological readings from 12 Beijing monitoring stations over four years, hosted on the UCI Machine Learning Repository and widely used in air-quality forecasting research.

How do you know the forecast is any good?

Every forecaster is compared against persistence ("the next hours look like the last hours"). The report shows MAE/RMSE for both and states honestly where the tiny model wins and where it ties — beating persistence is the bar.

Will it work in my city?

The model learns general pollution dynamics (daily cycles, temperature-inversion effects); absolute calibration to your street is approximate. The report explains this transfer honestly and shows the student how to log local data against forecasts.

Why run the model on the ESP32 instead of the cloud?

No API key, no subscription, no connectivity dependency — and the whole point of the project is demonstrating that forecasting fits in a microcontroller's memory via quantization.

Is this project suitable for a final-year project?

Yes — for AI & Machine Learning, Electronics and IoT programs. It combines sensor interfacing, time-series modeling, honest evaluation and embedded deployment. Suitable for B.E./B.Tech final-year projects in AI & Machine Learning, Electronics / E&TC and IoT & Embedded.

Components & software requirements
  • ESP32 (sensing + inference)
  • PMS5003 laser PM2.5/PM10 sensor
  • BME280 temperature/humidity/pressure sensor
  • TensorFlow Lite Micro (int8 regression model)
  • Python training pipeline (pandas, TensorFlow)
  • Beijing multi-site air-quality dataset, UCI ML Repository
  • 0.96-inch OLED display, buzzer, LEDs
  • Arduino IDE / PlatformIO (C/C++ firmware)

Dataset & model details

  • Dataset: Beijing Multi-Site Air-Quality Data — hourly air-pollutant (PM2.5, PM10, SO2, NO2, CO, O3) and meteorological (temperature, pressure, dew point, rain, wind) readings from 12 nationally-controlled monitoring sites in Beijing, March 2013 to February 2017, hosted on the UCI Machine Learning Repository. Public research dataset.
  • Task: Short-horizon regression — input = trailing window of PM2.5 plus temperature/humidity/pressure and time-of-day features, output = predicted PM2.5 at the forecast horizon (1–3 hours ahead).
  • Model: Compact regression network — a small LSTM or MLP (design target ~10k–50k parameters), trained in Python with the identical windowing used on-device, post-training quantized to int8 and deployed with TensorFlow Lite Micro.
  • Metrics: MAE and RMSE on a held-out time period, compared against the persistence baseline; forecast skill is a design target reported from the actual training run in the delivered report — never claimed as measured in advance. On-device forecast behavior is characterized by the student's own logging procedure.
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation