Unpredictable weather changes pose a major challenge in various sectors, including agriculture, transportation, and construction. Inaccurate rainfall predictions, especially on a local scale, often hamper community activities and decision-making that depend on weather conditions. This study aims to compare the performance of two artificial neural network models, namely Long Short-Term Memory (LSTM) and Recurrent Neural Network (RNN), in predicting rainfall based on hourly weather data collected in real-time using an ESP32 microcontroller equipped with BME280 and BH1750 sensors. The variables used include air temperature, humidity, rainfall, and light intensity. Both models were trained to predict weather conditions for the next few hours based on observation data that had been processed and normalized numerically. The evaluation was using three main metrics, namely Mean Squared Error (MSE), Mean Absolute Error (MAE), and the coefficient of determination (R²). The results shows that the LSTM model performed better with an MAE of 0.684, MSE of 0.7343, and R² of 0.2421, while the RNN model obtained an MAE of 0.2187, MSE of 0.3422, and R² of 0.8213. These findings prove that LSTM is more stable, efficient, and accurate in capturing the temporal patterns of weather data. This system has the potential to become the basis for developing local weather forecasts based on real-time data that are more adaptive to environmental changes
Copyrights © 2025