Lately the Internet of Things has completely changed how we monitor and automate things in our lives. This paper presents an environmental monitoring system designed using an ESP32 microcontroller tested on the Wokwi online simulator. The system uses a DHT22 sensor to measure temperature and humidity, an LDR sensor to sense light intensity and a potentiometer dial to simulate a rain sensor. All sensor data is continuously sent to the ESP32 microcontroller, which takes actions based on predefined conditions. If the temperature crosses 30°C, the relay module turns on the Green LED, representing a cooling fan. The ESP32 also switches on the Red LED when the environment becomes dark and activates a buzzer alarm when rain is detected through the potentiometer input. A 20x4 LCD screen displays all live sensor readings and device status in real time. The ESP32 also uses its built-in Wi-Fi to upload the collected data to the ThingSpeak cloud platform, allowing users to monitor and log data remotely. The simulation proved that the sensors, LEDs, buzzer and cloud communication worked properly. This IoT system acts as a working prototype suitable for smart homes, farming, greenhouses and warehouse monitoring applications.
Introduction
This project presents an IoT-based environmental monitoring and automation system using the ESP32 microcontroller, which is chosen for its built-in Wi-Fi and strong processing capability. The system measures environmental parameters such as temperature, humidity, light intensity, and rain conditions using sensors like the DHT22, LDR, and a potentiometer (used to simulate rain). Based on these inputs, the system automatically controls devices like LEDs and a buzzer while displaying real-time data on a 20×4 LCD screen.
The system operates in a continuous loop where the ESP32 reads sensor values, converts them into digital form, and compares them with predefined thresholds. If temperature exceeds 30°C, a green LED (representing a cooling fan) is activated. Low light conditions trigger a red LED, and simulated rain activates a buzzer alarm. All readings and device statuses are shown on the LCD for local monitoring.
In addition to automation, the system supports remote monitoring by uploading data to the ThingSpeak cloud platform via Wi-Fi, enabling users to access environmental data from anywhere. The simulation results confirm that the system responds accurately to changing conditions, with reliable sensor detection, real-time display updates, and successful cloud data logging.
Conclusion
This project showed that an Environmental Monitoring and Automation System using the ESP32 microcontroller works well. The system checked temperature, humidity, light intensity and rain. It also controlled LEDs, a relay and a buzzer automatically based on set limits. The ESP32 sent sensor data to the ThingSpeak cloud for monitoring from anywhere. A Wokwi simulation test proved that all parts, including sensors, actuators and cloud connection worked correctly. This makes the prototype reliable for use.
In the future we can make the system better by adding advanced sensors and actuators. This will improve automation. We can also add an app, for easier monitoring and control and send notifications in real-time. The project can be expanded to homes, industrial safety, greenhouse monitoring and big IoT automation projects. The ESP32 and IoT-Based Environmental Monitoring and Automation System can be used in areas. The system and ESP32 have a lot of potential for growth.
References
[1] Espressif Systems, ESP32 Technical Reference Manual. Available: https://www.espressif.com/en/support/documents/technical-documents
[2] Wokwi, Wokwi Online Arduino & ESP32 Simulator. Available: https://wokwi.com/
[3] MathWorks, ThingSpeak API Reference: Read Data from Channel. Available: https://uk.mathworks.com/help/thingspeak/read-data-from-channel.html
[4] Arduino, WiFi Library for ESP32. Available: https://www.arduino.cc/reference/en/libraries/wifi/
[5] Adafruit Industries, DHT Sensor Library. Available: https://github.com/adafruit/DHT-sensor-library
[6] F. de Brabander, LiquidCrystal I2C Library. Available: https://github.com/johnrickman/LiquidCrystal_I2C
[7] M. S. Bakare and K. Abubaker, “IoT-based indoor environmental monitoring system using multi-parameter sensing and ESP32-WROOM integration,” Discover Electronics, vol. 3, no. 6, 2026.
[8] N. Wivanius, W. I. Sihombing, and D. Kamsyah, “Design and Prototype Development of an IoT-Based Temperature and Humidity Monitoring System with Real-Time Data and Automated Alerts,” Jurnal Teknologi dan Riset Terapan, vol. 7, no. 2, 2026.