Keywords: Internet of Things (IoT), Environmental Monitoring, Smart School, ESP32, Air Quality, Risk Classification, Decision Support, SDG 17
Students spend six to eight hours a day at school, so the environment in and around it directly affects their health, comfort and learning. Fine particulate matter (PM2.5), carbon dioxide (CO2) in crowded classrooms, heat, noise, ultraviolet (UV) radiation and heavy rain can all change within a few hours, yet most schools have no instrument to measure them. Government air-quality stations are few and mostly in cities, and decisions such as cancelling assembly, moving physical education indoors or declaring a holiday rest on weather bulletins, telephone calls and manual reports that pass through several administrative levels. By the time the information reaches the official who can act, the students may already have been exposed.
This paper proposes an IoT-Enabled Smart Environmental Decision Support System for Schools, in which each school is a node in a shared sensing network. An ESP32-based station continuously measures temperature, humidity, PM2.5, CO2, rainfall, noise level, UV index and soil moisture and sends the data securely to a cloud platform, where it is stored, processed, displayed and compared across schools. The platform does more than display readings: it classifies risk and alerts the right decision makers in time. The system must be scalable, secure, reliable, low-latency and cost-effective, requirements shared by earlier real-time environmental monitoring systems (Spachos et al., 2025) [1], (Ding et al., 2024) [4], (Alshami et al., 2024) [5], (Naik et al., 2024) [10].
The contributions are: (1) a school-level IoT sensing architecture for eight environmental parameters; (2) a centralized cloud model that integrates sensor data across schools; (3) a configurable decision-support model for risk classification, recommended actions and escalating alerts; and (4) a collaboration-oriented monitoring model linking schools and authorized government stakeholders in support of SDG 17.
The rest of the paper is organised as follows. Section 2 reviews related work, Section 3 describes the proposed architecture, Section 4 explains data validation, risk classification and alert delivery, Section 5 reports the evaluation and test results, Section 6 discusses the alignment with SDG 17, and Section 7 concludes the paper.
IoT sensing, cloud connectivity and analytics are widely used in environmental and educational applications. Spachos et al. reported a large-scale IoT deployment in 25 K-12 schools in Europe that supported energy saving through behaviour change (Spachos et al., 2025) [1], and Rosa-Bilbao et al. built an indoor air quality management system for educational buildings that uses machine learning to predict air quality (Rosa-Bilbao et al., 2025) [2]. Both show that school environments can be measured at scale, but neither classifies risk or alerts education authorities.
Beyond schools, Ding et al. monitored an ecological environment with sensor nodes and GIS visualization (Ding et al., 2024) [4], and Chen et al. used adaptive Kalman filtering to improve the reliability of low-cost air-quality sensing and prediction (Chen et al., 2020) [9]. Afzal et al. predicted soil moisture with ARIMA (Afzal et al., 2025) [3] and Abdurohman et al. applied decision tree regression to an IoT control system (Abdurohman et al., 2022) [7]. These works confirm that filtering, time-series prediction and machine learning suit sensor-driven systems.
Other studies address wireless infrastructure: a survey of IoT and wireless sensor networks for agriculture (Mowla et al., 2023) [6], IoT innovations in water-quality monitoring (Alshami et al., 2024) [5] and machine-learning-based autonomous configuration of IoT communication (Glória et al., 2021) [8]. They offer architectural and communication lessons, but none provides a unified decision-support platform for many schools and government entities.
Closest to our design, Naik et al. proposed RTEPMS, a real-time monitoring system for underground mines built on an ESP32, gas and climate sensors, LoRa communication, SD-card storage and threshold alarms (Naik et al., 2024) [10]. We extend this sensing-to-alert idea to schools with a multi-school cloud platform. Taken together, the literature shows a gap between the data collected and centralized, cross-school decision support: existing systems serve a single site, domain or small set of parameters. This work combines multi-parameter sensing, multi-school integration, risk classification and authorized government monitoring.
The architecture has five layers, shown in Fig. 1: school sensing nodes, a communication layer, a cloud data platform, a decision-support layer and a presentation layer with role-based dashboards for the head master, the district official (Chief or District Educational Officer) and the state directorate.
Each node reads its sensors, averages the values over one minute and publishes a JSON message. Telemetry travels by MQTT (Preethi et al., 2024; Central Pollution Control Board, 2014; Ministry of Environment and Forests, 2000; WHO, 2002; OASIS, 2019) [14, 15, 16, 17, 18] over Wi-Fi or a 4G router, while configuration, firmware updates (OTA) and synchronization use an HTTPS REST API. In the cloud, an ingestion service validates and time-stamps every reading, links it to its school and writes it to a time-series database; a relational database holds schools, devices, users and threshold rules. The decision-support layer turns readings into a risk status, selects a recommended action and raises alerts, so decision makers receive a concise summary instead of raw numbers.
Each node is built around an ESP32-WROOM-32 (Fig. 2). A BME280 (I2C) measures temperature and humidity, a PMS5003 (UART) PM2.5 and an MH-Z19B NDIR sensor (UART) CO2. An INMP441 MEMS microphone (I2S) provides the noise level, from which the firmware computes the RMS sound level in dB; a GUVA-S12SD gives the UV index, a capacitive probe gives soil moisture, and a tipping-bucket gauge counts 0.2 mm rainfall tips through a GPIO interrupt. A DS3231 RTC and a micro-SD card provide timekeeping and offline storage. Capacitive probes and tipping-bucket gauges were chosen over resistive probes and rain-drop modules because they resist corrosion and report rainfall in millimetres. The indicative cost of one node is about ?10,450 without a 4G router, a small fraction of a commercial air-quality monitor, and the modular interface allows new sensors to be added as the deployment grows.

Because many schools share one cloud service, security and reliability are part of the design from the start. Nodes connect to the Mosquito broker over TLS with per-device credentials, an access control list lets each device publish only to its own topic, and messages use QoS 1 for at-least-once delivery. Users authenticate with JSON Web Tokens, passwords are stored as salted hashes, and every query is filtered by the user's role and jurisdiction. When the network fails, the node appends readings to the SD card and uploads them in order, with their original timestamps, once the link returns, so short outages cause no data loss. The modular design allows the system to grow from a pilot to a regional or national network without heavy deployment and maintenance effort.
All nodes write to one database tagged by school code, block and district, so authorized users can compare conditions school-wise, block-wise and district-wise. Fig. 3 shows the district dashboard of the prototype: it lists every school sorted by risk status, with the parameter driving that status and its current value, so an official can see which schools need attention first and issue a common instruction to the affected group without waiting for telephone reports.


Fig. 4 summarizes the workflow. The node samples its sensors and publishes one-minute averages; the cloud validates and stores them; a job running every minute computes five-minute averages, maps each parameter to a band and sets the school status to the worst band. A status is confirmed only after two consecutive windows, which filters short spikes such as a student standing near a sensor. A confirmed High or Severe status creates one alert carrying a recommended action: High alerts go to the head master, Severe alerts go to the head master and the district official together, and any alert not acknowledged within fifteen minutes is escalated to the next level. Alerts close automatically when the parameter returns to a lower band.

The node firmware is written for the Arduino framework on the ESP32 and runs separate FreeRTOS tasks for sensor sampling, MQTT communication and SD-card logging, so that a slow sensor, such as the MH-Z19B during its warm-up, never blocks publishing. Each sensor is read every few seconds and the values are averaged over one minute before a message is sent. The tipping-bucket count is held in an interrupt-driven counter and converted to millimetres only when the message is built, so no tip is missed while the node is busy with the network. A hardware watchdog restarts the node if a task hangs, and at start-up the node publishes a short status message with its firmware version and reset reason, which helps the maintainers diagnose faults remotely.
For deployment, the node is housed in a weatherproof enclosure on a school wall or pole. The rain gauge is placed in an open area, and the PM2.5 and temperature sensors are kept under a ventilated shield away from direct sunlight and heat sources. CO2 and noise are better measured inside a representative classroom, so a school can use one outdoor and one indoor unit that share the same school code. School staff only need to power the node and enter the Wi-Fi details once; the remaining settings are downloaded from the cloud.
Before any value is used, the ingestion service checks that the device exists and belongs to an active school, that the timestamp is neither in the future nor older than the seven-day buffering limit, and that each value lies within the physical range of its sensor, for example 0–1000 µg/m3 for PM2.5 and 400–5000 ppm for CO2. Duplicates are ignored. Rejected messages are written to a fault log with the reason, and repeated faults from one device raise a maintenance flag, so invalid or inconsistent records never enter a decision. CO2 values are marked invalid during the sensor's three-minute warm-up, and a device silent for five minutes is shown as offline. Accepted readings are stored with school and location metadata, so time-series analysis is possible at school and location level.
Each parameter is classified into Low, Moderate, High or Severe using thresholds taken from published standards (Table 1). The thresholds, the action library and the persistence rule are configuration data, not program code, so an administrator can revise them when a standard changes, and statistical or machine-learning models can be introduced later without changing the sensing or cloud layers. The action library maps each hazard and band to a plain-language response: for example, High PM2.5 suspends outdoor assembly and physical education, High CO2 calls for opening windows and running exhaust fans, Severe heat index recommends a half-day or closure to the district office, and Severe rainfall prompts a district decision on a holiday.
Alerts are delivered through the channel that suits the receiver. The dashboard shows an in-page notification and a coloured status badge, while SMS is used for Severe alerts and escalations so that an official who is away from a computer still receives the message. Each alert carries the school name, the parameter, the measured value, the band, the time and the recommended action. To avoid alert fatigue, a school has at most one open alert per parameter, repeated crossings within the same band update the existing alert instead of creating a new one, and the alert closes when the parameter returns to a lower band.
The head master's dashboard shows the current status of the school, a 24-hour trend chart for each parameter and the list of open alerts. The district dashboard lists all schools sorted by risk with a count of schools in each band, and the state view groups them by district. Every alert, acknowledgement and threshold change is written to an audit log with the user and the time, so that a decision such as cancelling outdoor activities can be reviewed later.
The prototype is evaluated against four measurable metrics: end-to-end latency (sensor reading to dashboard), data delivery reliability (readings stored divided by readings sent), alert latency (threshold crossing to notification) and scalability (message throughput and storage as nodes are added). Sensor accuracy must still be verified against calibrated reference instruments, and field trials remain future work. The dashboard screens in this paper use simulated sensor data.
Table 1 lists the default threshold bands. Because they are stored as configuration, each parameter has its own Low, Moderate, High and Severe bounds, and a changed rule is applied from the next five-minute window.
| Parameter | Low | Moderate | High | Severe | Reference |
|---|---|---|---|---|---|
| PM2.5 (µg/m3) | ? 60 | 61–90 | 91–250 | > 250 | CPCB National AQI [11] |
| CO2 (ppm) | < 1000 | 1000–1500 | 1500–2500 | > 2500 | ASHRAE 62.1 ventilation guidance |
| Heat index (°C) | < 32 | 32–41 | 41–54 | > 54 | NOAA heat index |
| Noise (dB(A) Leq) | ? 50 | 51–65 | 66–80 | > 80 | Noise Rules, 2000 [12] |
| UV index | 0–2 | 3–5 | 6–10 | ? 11 | WHO Global Solar UV Index [13] |
| Rainfall (mm/24 h) | < 15.6 | 15.6–64.4 | 64.5–115.5 | ? 115.6 | IMD rainfall intensity classes |
| Soil moisture (% VWC) | 15–35 | < 15 or 35–45 | > 45 | > 45 with heavy rain | Playground advisory |
Testing combined laboratory and simulated conditions. On the bench, CO2 was raised by breathing near the sensor in a closed box, PM2.5 by a burning incense stick at a safe distance, noise by a calibrated speaker tone and rainfall by pouring a measured volume of water into the gauge funnel. Unit tests covered the sensor drivers, frame checksums, the rain counter, the heat-index function and the server-side validation, band lookup and persistence logic. Integration tests injected known inputs along each path from node to dashboard and switched the Wi-Fi access point off and on to check buffering and recovery. Table 2 lists the functional test cases with the input applied, the result observed and the status. Of the 10 cases, 8 passed in the first run. Two (TC06 and TC10) failed, were corrected and were repeated, and all 10 passed in the final run.
| ID | Test case and input | Expected result | Observed result | Status |
|---|---|---|---|---|
| TC01 | Node left running for 60 min with normal sensor values | 60 messages stored, each with the correct school code | 60 of 60 stored; school code correct; interval 60 s ± 1 s | Pass |
| TC02 | CO2 = 9000 ppm sent from a test publisher | Reading rejected and written to the fault log | Rejected; fault log shows "CO2 out of range" | Pass |
| TC03 | PM2.5 about 120 µg/m3 (incense stick) for two windows | Status High; alert with recommended action created | Status turned High after the second window (about 10 min); alert "Suspend outdoor assembly" created | Pass |
| TC04 | PM2.5 raised for one window only, then removed | No alert (persistence check) | Status stayed Moderate; no alert created | Pass |
| TC05 | High alert left unacknowledged for 15 min | Escalated to district official by SMS | SMS received at 15 min 20 s | Pass |
| TC06 | Wi-Fi switched off for 30 min, then restored | All 30 buffered readings uploaded in order with original timestamps | First run: 30 uploaded but the last two were out of order. Fixed by sorting by timestamp; retest 30 of 30 in order | Pass (retest) |
| TC07 | Head master logged in to school A opens school B page | Access denied (jurisdiction check) | HTTP 403 returned; page not shown | Pass |
| TC08 | Administrator changes CO2 High limit from 1500 to 1800 ppm | New limit used from the next window | Applied from the next 5-min window; earlier alerts unchanged | Pass |
| TC09 | Node powered off for 5 min | Device shown offline on dashboard | Shown offline after 5 min 10 s | Pass |
| TC10 | Node reset; CO2 read during 3-min warm-up | Readings marked invalid until warm-up ends | First run: first two values stored as valid. Warm-up flag now set at boot; retest all flagged invalid | Pass (retest) |
Pass (retest): the case failed in the first run, the fault was corrected and the test was repeated.
A data simulator publishing readings for 100, 500 and 1,000 virtual schools at one message per school per minute is used to measure latency, delivery ratio, alert latency and dashboard response time, with repeated short network interruptions. Head masters, teachers and district officials also perform typical tasks during user acceptance testing, and their feedback on wording, colours and notification counts refines the dashboards.
Most failures found during testing were small integration defects rather than design problems. In TC06 the buffered readings were read back from the SD card in file order, and two readings written around the moment the link dropped were uploaded out of sequence; the node now sorts buffered records by timestamp before uploading. In TC10 the CO2 warm-up flag was set only after the first message was built, so two invalid readings were briefly stored as valid; the flag is now set at boot. These faults are hard to find without deliberately injecting failures, which is why the failure paths were tested as carefully as the normal path.
The bench checks of the sensors are qualitative and are not a calibration: CO2 from breath, PM2.5 from incense smoke and the noise tone depend on the individual unit and on the test set-up. Accuracy against calibrated reference instruments, long-term sensor drift and behaviour under real outdoor conditions such as dust, heat and heavy rain still need field trials, and the dashboard figures in this paper come from simulated data.
This work supports Sustainable Development Goal 17, Partnerships for the Goals. Schools share the data they collect, and education departments and local administrations use the pooled platform for easier access and monitoring. Real-time monitoring gives all partners a common reference, comparison across institutions is seamless, and role-based access keeps the data available only to authorized users while allowing faster responses to identified problems. The design also leaves room for other agencies and technologies to contribute.
The system also supports SDG 4 (safe and effective learning environments, target 4.a), SDG 3 (reduced illness from air pollution, target 3.9) and SDG 11 (local air-quality data, target 11.6).
In practical terms, a district official who today waits for reports from individual schools can see from one screen which schools have crossed a threshold and send the same instruction to all of them. Schools in the same block can compare their readings, and data pooled over a season can show, for example, which schools have persistently high CO2 in classrooms and need better ventilation, supporting planned rather than reactive decisions.
The IoT-enabled Smart Environmental Decision Support System for Schools brings environmental monitoring to the place where students spend their day. Low-cost ESP32 nodes send eight parameters over Wi-Fi/4G and MQTT to a shared cloud platform that validates and stores the data of many schools, classifies each school into four risk bands with configurable thresholds, and sends timely alerts with recommended actions to head masters and officials, with automatic escalation. The layered, configuration-driven design replaces slow manual reporting with consistent decisions based on measured data and can grow from a pilot to a district or state network, in line with SDG 17.
The work is currently a prototype: field validation, calibration against reference instruments and large-scale deployment remain to be done. Future work includes Kalman-filter-based sensor correction (Chen et al., 2020) [9], short-term prediction of PM2.5, heat index and rainfall, anomaly detection, integration with IMD and CPCB data, LoRaWAN gateways and solar power for poorly connected schools, and a mobile application with notifications in Tamil and English.
The authors thank Mr. Ravi Kumar T, M.Tech., Assistant Professor, Department of Information Technology, for his guidance and support in developing the proposed system.