13. Web Page Remote Monitor Air Quality
In smart school era, environment perception and data interconnection are becoming important symbols of its modernization. In this project, with the theme of Remote Monitoring of Air Quality, we will guide you to deeply explore the innovative application of Internet of Things in school monitoring.
From now on, let’s protect the school environment with technology, build a smart learning environment with innovation, and jointly explore the infinite possibilities of Internet of Things in education!
Principle
Data collection
ENS160 sensor → ESP32 (via I2C)
Data transmission
ESP32 → Router → Mobile phone/Computer
Data display
Browser request → Server response → Update web page
Code Flow
flowchart TD
A[Initialization] --> B[Network connection]
B --> C[Server starts]
C --> D{Request processing}
D --> E[Web page]
D --> F[Sensor data]
E --> G[Real-time monitoring display]
F --> G
G --> H[Application completed]
Test Code

Code Explanation
Here covers extracurricular knowledge of HTML, CSS, and JS, so we only provide a brief introduction.
Click
to choose the extension. Search the following extension to load it.

Back to the editing area after it is loaded.


Initialize the OLED and serial port
Set the WiFi name and password, and connect to WiFi. Then print the IP address on the OLED and the serial monitor.
Please replace the WiFi name and password in the code with yours.

There are three components on the page: AQI, TVOC and CO2
AQI: Display the comprehensive air quality index from levels 1 to 5 in real time
TVOC: Display the volatile organic compound concentration in real time
CO2: Display the equivalent carbon dioxide value in real time
Update the data every 5 seconds.
Test Result
After uploading the code, open the serial monitor and set the baud rate to 115200. You can see the printed IP information:

The IP address will also be printed on the OLED at the same time.

Enter this IP address in the browser of your mobile phone or computer to access the air quality monitoring page.
Data is obtained immediately when the page is opened, and it is refreshed every 5 seconds.
Note: Make sure your mobile phone/computer and ESP32 are connected to the same WiFi.

FAQ
If nothing is printed on the serial monitor, please press the reset button on the board.

If the ESP32 has not been able to obtain an IP address, it is usually because the WiFi connection has failed. Solutions:
Make sure that the WiFi name and password in the code have been replaced with yours.
Make sure your WiFi network is 2.4GHz. ESP32 does not support 5GHz WiFi.
If there is no page when entering the IP address,
Make sure the IP address is entered correctly.
Check whether your mobile phone/computer is on the same network as the ESP32.