Rain Detection and Prediction System Using AI and Esp32-Based Sensor
Rain Detection and Prediction System Using AI and Esp32-Based Sensor
Manthan Vaidya1 , Prof. Bharati Bisane2 , Nayan Nemade 3, Tejas Nade4
*1,3,4, Bachelor of Engineering (BE), Department of Artificial Intelligence and Machine Learning (AIML), Alard College of Engineering and Management, Pune, Maharashtra, India
*2 Professor Bachelor of Engineering (BE), Department of Artificial Intelligence and Machine Learning (AIML), Alard College of Engineering and Management, Pune, Maharashtra, India
ABSTRACT
Localized, short-notice rainfall continues to disrupt agriculture, small-scale construction, and everyday building management, particularly where access to dense, official meteorological infrastructure is limited. Conventional weather stations are accurate but sparse and expensive, while consumer-grade IoT weather gadgets typically offer passive monitoring without any predictive capability or automated response. This paper presents the design, implementation, and bench-level evaluation of a Smart Rain Detection and Prediction System that couples an ESP32-based sensor node (DHT22 temperature/humidity, BMP280 barometric pressure, and an analog/digital rain sensor) with a Node.js/Express backend, a PostgreSQL relational database, and a Random Forest machine learning pipeline for rain detection and short-term (1–3 hour) rainfall forecasting. An SG90 micro servo simulates automated window/roof closure when rain is detected, and a React dashboard built on Recharts presents live readings, predictions, and alerts to authenticated users under role-based access control. Unlike many reported systems, the backend includes an explicit, deterministic fallback heuristic that returns a prediction even if the Python inference process is unavailable, and the rain-alert probability threshold is stored as a runtime-configurable database value rather than hardcoded in firmware. On the project's bundled 500-row sample dataset, the Random Forest rain-detection classifier reached 100% test-split accuracy and the rainfall regressor achieved a mean absolute error of 0.213 mm across the 1/2/3-hour forecast horizons; both figures are reported transparently as sample-data results pending validation on real, field-collected data. We further outline a proposed 30-day field deployment protocol, including hardware placement, calibration steps, and the metrics that such a trial would need to capture, as a concrete next step toward field validation. The system's full hardware cost is estimated at INR 900–1300 (USD 11–16), and the complete software stack — Node.js, Express, PostgreSQL, React, and scikit-learn — is open-source, keeping the design reproducible at zero licensing cost. This work positions itself as a transparent, engineering-first account of building an end-to-end IoT rain-intelligence pipeline, deliberately distinguishing demonstrated, code-verified results from proposed future validation work.
Keywords: ESP32, IoT, Rain Detection, Machine Learning, Random Forest, Node.js, Express, PostgreSQL, React, DHT22, BMP280, Servo Motor, Real-Time Monitoring, REST API