Abstract
Weather is an essential part of life that affects livelihoods such as agriculture, aviation, etc. Existing systems for weather prediction use deep learning frameworks such as Recurrent Neural Networks and Long Short-term Memory. These models, however, suffer from vanishing gradients that affect the accuracy of the prediction. Using the Deep Belief Networks, we developed a model to address this. Historical weather data is obtained from the Philippine Atmospheric, Geophysical and Astronomical Services Administration for model training. The ground-level sensor data was used to normalize the inputs for the model. The resulting multiclass accuracy is 80%. A larger dataset is recommended for better performance.
1. Introduction
Weather refers to the various atmospheric phenomena that occur over time, including conditions such as rainfall, sunshine, wind, and storms. These phenomena are influenced by multiple factors, including temperature, air pressure, wind speed, precipitation, and cloud formation. Weather prediction is an essential practice, as it directly impacts critical sectors such as agriculture, public health, and aviation [1,2]. Accurate forecasting also plays a vital role in mitigating and preparing for natural disasters [3,4].
Traditional neural networks, such as Long Short-Term Memory (LSTM) models, have been employed in weather prediction systems. These models typically utilize input variables such as temperature and humidity to generate forecasts [5,6]. More recent studies have explored ensemble prediction systems to enhance accuracy. Artificial Neural Networks (ANNs) have also been applied to detect errors in prior forecasts and to improve predictive performance [7,8].
However, variability in the parameters used often results in forecasts that deviate from actual observations [9,10]. In hardware implementation, Raspberry Pi devices have proven reliable due to their General-Purpose Input/Output (GPIO) pins, which allow seamless integration with sensors and other components [11].
In this study, we developed a weather prediction system incorporating an in-built sensor reading correction algorithm within a Deep Belief Network (DBN). The system utilizes three sensors: the DHT11 for temperature and humidity, the BMP180 for barometric pressure, and the A3144E Hall effect sensor. All sensors are connected to a Raspberry Pi 4B.
Historical data from 2011 to 2020, provided by the Philippine Atmospheric, Geophysical and Astronomical Services Administration (PAGASA), were used. The data were processed to remove extraneous information such as instrument metadata and diagnostic logs. A specific geographic area near the site of interest was selected for testing the model, excluding rainforests due to their unique ecosystems and weather dynamics.
Existing weather prediction systems face challenges such as long processing times and vanishing gradients, which reduce predictive accuracy [12,13]. Furthermore, discrepancies between the resolution of sensors used in weather stations and those deployed at ground level contribute to inconsistencies in data quality. Through the implementation of a Deep Belief Network on a Raspberry Pi 4B, these limitations can be addressed to improve the accuracy and efficiency of weather prediction.
2. Methodology
2.1. Research Methodology
The research methodology involves analyzing similar studies to understand existing weather prediction systems and identify gaps (Figure 1). Figure 1 shows the conceptual framework of the study. The input data of the system included the wind speed, atmospheric pressure, temperature, and relative humidity. The data were used to calculate the apparent temperature, dew point temperature, sensor readings data correction, and the weather prediction using DBN. The final output of the system is the weather prediction for the following day.
Figure 1.
Conceptual framework of this study.
2.2. Hardware Development
The hardware block diagram is shown in Figure 2. The system consists of blocks that indicate the several sensors used connected to the Raspberry Pi 4B. The sensors used are the DHT11, BMP180, and A3144E for measuring the temperature and humidity, atmospheric pressure, and wind speed through a rotating magnetic disk attached to the anemometer and the hall effect sensor. A 5V 2.5A DC power source was used to power the Raspberry Pi and an LCD screen that displays the output to the user. The components used in the research study are from Makerlab Electronics in Manila, Philippines.
Figure 2.
Hardware Block Diagram.
2.3. Software Development
The system developed acquires parameters from the sensors, including wind speed, relative humidity, temperature, and atmospheric pressure. These values are processed by the sensor data correction module to enhance accuracy and resolution, aligning them with weather station standards. The corrected inputs are then fed into the DBN model, which generates the weather prediction for the following day and displays the output on the LCD screen. The system monitors the toggle switch status, which determines whether the program continues generating predictions or terminates execution.
2.4. Sensor Reading Data Correction Algorithm
The correction algorithm was applied after the sensor data were obtained. The input values were compared to ensure the reliability of the corrected data for the DBN model. Since the model is highly sensitive to input quality, accurate sensor readings are essential for producing valid predictions. Equation (1) is used to correct the gathered sensor data. To address potential anomalies, the algorithm employs data masking and calculates daily averages before passing the values into the correction equation, thereby improving the consistency and reliability of the inputs.
2.5. Deep Belief Network
Multiple stacked Restricted Boltzmann Machines (RBMs) form the basis of DBN. RBMs are energy-based models, comprising two layers: a visible layer and a hidden layer. The model employs an energy function that assigns a score to each possible configuration of the visible and hidden units, with the objective of minimizing energy. In a stacked architecture, each RBM is trained sequentially, where the output of one layer serves as the input to the next. This pre-training process enables the DBN to learn probabilistic representations from sample data. The learned probabilities are applied to both visible and hidden units to determine their binary states.
The output of each preceding RBM becomes the input for the subsequent RBM, meaning that the probability distributions learned in earlier layers influence the activation and probability calculations of later layers. These computations define the DBN’s output through a forward pass of the data. To enhance classification performance, a Random Forest classifier is applied to the output of the trained DBN, resulting in a hybrid model.
2.6. Experimental Set-Up
The developed system consists of a central enclosure housing the sensors and Raspberry Pi, with an anemometer mounted on top and a supporting stand for stability. The system was deployed in Barangay Culiat, Quezon City, where sensor data were collected from a garden environment. The testing period lasted two weeks to acquire sufficient input data for the model. These data were processed using the sensor correction algorithm. A second phase of implementation followed, lasting 30 days, during which corrected input data were fed into the trained DBN. The resulting predictions were then compared with weather station observations to evaluate system performance.
2.7. Data Gathering Procedures
Historical weather data were obtained from PAGASA, including temperature, humidity, wind speed, precipitation, and daily weather conditions. Ground-level sensor data were collected and normalized against the historical dataset to ensure consistency with the inputs used to train the DBN.
2.8. Statistical Treatment
A confusion matrix was employed to evaluate the accuracy of the DBN’s weather predictions. Forecasts were categorized into four common weather conditions in the Philippines: rainy, sunny, cloudy, and windy. A prediction was considered a true positive when the forecasted condition matched the actual observation. Misclassifications were assigned to error subclasses. For example, if the system predicted rain but the actual condition was sunny, the error was classified under the ERS subclass.
3. Results and Discussion
Table 1 contains the confusion matrix for the testing set, which was gathered during data gathering, involving the deployment of the prototype to gather information through its sensors. The data gathering has resulted in 24 correct sunny weather condition predictions, 2 correct rainy weather condition predictions, 1 incorrect rainy prediction, 1 incorrect cloudy prediction, and 2 incorrect windy predictions.
Table 1.
Confusion matrix.
Table 2 shows the multiclass metrics of the classes for cloudy, rainy, sunny, and windy. The multiclass classification accuracy (MCA) was calculated as the ratio of the summation of all true positives across classes to the total of true positives and errors across all classes as displayed on Table 2. This resulted in an MCA of 87.11% on the historical dataset. Several factors influence model accuracy, with data availability being a primary limitation. Since each entry corresponds to a single day, collecting sufficiently large datasets requires extended periods of time, thereby restricting opportunities to test different models.
Table 2.
Multiclass classification metrics.
The analysis results of class-specific performance revealed that cloudy and windy conditions achieved a precision score of 0%. This result is attributed to the low frequency of such conditions in the Philippines, where cloudy weather often transitions into rainfall. In contrast, sunny and rainy conditions exhibited high precision, indicating the model’s ability to minimize false positives for these classes. Similarly, recall for cloudy and windy conditions was adversely affected by their low occurrence, whereas sunny and windy conditions achieved high recall, demonstrating the model’s capacity to reduce false negatives.
The F1-score, which balances precision and recall, was calculated for each class. The overall F1-score was 40%, reflecting the impact of the low frequency of cloudy and windy conditions. These results were derived from the testing dataset, which consisted of only 30 days of recorded data. The limited sample size explains the relatively low performance metrics, as fewer occurrences of certain weather conditions were available for evaluation.
4. Conclusions and Recommendation
Using DBN and a sensor correction algorithm, a weather prediction system was developed on a Raspberry Pi platform. The system employed multiple sensors. A pair of A3144E hall effect sensors was used to measure wind speed using a rotating disk attached to an anemometer, a BMP180 sensor for atmospheric pressure, and a DHT11 sensor for relative humidity and temperature. DBN was trained using stochastic contrastive divergence to constrain the hidden and visible units of each RBM. The model achieved a weighted F1-score of 91.37%, indicating strong capability in minimizing false positives and false negatives. DBN, combined with a Random Forest classifier, attained an MCA of 87.11% on the historical dataset and 86.67% on the dataset collected through the prototype sensors. To improve performance, more frequently updated data sources are required, including those recorded at minute- or hourly-level intervals, to expand the dataset and enhance model generalization. Additionally, hybrid implementations of DBNs with other neural architectures, including CNNs and RNNs, are suggested. Such methods enable the system to address complex tasks, including image processing and multi-output time series prediction.
Author Contributions
Methodology, software, validation, formal analysis, investigation, resources, data curation, writing-original draft preparation, writing-review and editing, visualization, funding acquisition, A.S.E. and F.S.F.C.; Conceptualization, A.S.E., F.S.F.C. and R.V.P.; Supervision, Project Administration, R.V.P. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Data will be available upon request through email to the authors.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Hennayake, K.M.S.A.; Dinalankara, R.; Mudunkotuwa, D.Y. Machine Learning Based Weather Prediction Model for Short Term Weather Prediction in Sri Lanka. In Proceedings of the 2021 10th International Conference on Information and Automation for Sustainability (ICIAfS 2021), Negambo, Sri Lanka, 11–13 August 2021; pp. 299–304. [Google Scholar] [CrossRef] [Scilit]
- Saitulasi, K.; Deepa, N. Deep Belief Network and Sentimental Analysis for Extracting on Multi-Variable Features to Predict Stock Market Performance and Accuracy. In Proceedings of the 2021 International Conference on Computer Communication and Informatics (ICCCI 2021), Coimbatore, India, 27–29 January 2021. [Google Scholar] [CrossRef] [Scilit]
- Mishra, D.; Joshi, P. A Comprehensive Study on Weather Forecasting Using Machine Learning. In Proceedings of the 2021 9th International Conference on Reliability, Infocom Technologies and Optimization (Trends and Future Directions) (ICRITO 2021), Noida, India, 3–4 September 2021. [Google Scholar] [CrossRef] [Scilit]
- Das, L.; Kumar, A.; Singh, S.; Ashar, A.R.; Jangu, R. IoT Based Weather Monitoring System Using Arduino-UNO. In Proceedings of the 2nd International Conference on Computation, Automation and Knowledge Management (ICCAKM 2021), Dubai, United Arab Emirates, 19–21 January 2021; pp. 260–264. [Google Scholar] [CrossRef] [Scilit]
- Srivastava, A.; Anto, S. Weather Prediction Using LSTM Neural Networks. In Proceedings of the 2022 IEEE 7th International conference for Convergence in Technology (I2CT 2022), Mumbai, India, 7–9 April 2022. [Google Scholar] [CrossRef] [Scilit]
- Alimorong, F.M.L.S.; Apacionado, H.A.D.; Villaverde, J.F. Arduino-Based Multiple Aquatic Parameter Sensor Device for Evaluating PH, Turbidity, Conductivity and Temperature. In Proceedings of the 2020 IEEE 12th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM 2020), Manila, Philippines, 3–7 December 2020. [Google Scholar] [CrossRef] [Scilit]
- Tanzouak, J.; Bame, N.; Yenke, B.; Sarr, I. A System to Improve the Accuracy of Numeric Weather Prediction (NWP) for Flood Forecasting Systems. In Proceedings of the 13th International Conference on Signal-Image Technology and Internet-Based Systems (SITIS 2017), Jaipur, India, 4–7 December 2017; pp. 76–82. [Google Scholar] [CrossRef] [Scilit]
- Zhang, P.; Zhang, L.; Leung, H.; Wang, J. A Deep-Learning Based Precipitation Forecasting Approach Using Multiple Environmental Factors. In Proceedings of the 2017 IEEE 6th International Congress on Big Data (BigData Congress 2017), Honolulu, HI, USA, 25–30 June 2017; pp. 193–200. [Google Scholar] [CrossRef] [Scilit]
- Yumang, A.N.; Paglinawan, C.C.; Paglinawan, A.C.; Avendaño, G.O.; Esteves, J.A.C.; Pagaduan, J.R.P.; Selda, J.D.S. Real-Time Flood Water Level Monitoring System with SMS Notification. In Proceedings of the 2017 IEEE 9th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), Manila, Philippines, 1–3 December 2017. [Google Scholar] [CrossRef] [Scilit]
- Caya, M.V.; Dela Cruz, J.; Ballado, A.; Aggabao, M.C.; Bacolor, E.I.; Riego, H.A.G.; Vergara, M.E. Evapotranspiration-Based Irrigation System for Mustard Green Crop Cultivation Using Public Weather Forecast. In Proceedings of the 2020 11th IEEE Control and System Graduate Research Colloquium (ICSGRC 2020), Shah Alam, Malaysia, 8 August 2020; pp. 203–208. [Google Scholar] [CrossRef] [Scilit]
- Maramba, R.; Babila, A.; Bais, A.M.; Im, S.J.; Caya, M.V. Air Pollution and Particulate Matter Detector Using Raspberry Pi with IoT Based Notification. In Proceedings of the 2017 IEEE 9th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), Manila, Philippines, 1–3 December 2017. [Google Scholar]
- Saini, H.; Thakur, A.; Ahuja, S.; Sabharwal, N.; Kumar, N. Arduino Based Automatic Wireless Weather Station with Remote Graphical Application and Alerts. In Proceedings of the 3rd International Conference on Signal Processing and Integrated Networks (SPIN 2016), Noida, India, 11–12 February 2016; pp. 605–609. [Google Scholar] [CrossRef] [Scilit]
- Ma, D.; Sun, B.; Jia, B.; Li, Y. New Energy Short-Term Prediction System Based on Measured Weather and Network Weather Error Correction. In Proceedings of the 2019 3rd IEEE Conference on Energy Internet and Energy System Integration: Ubiquitous Energy Network Connecting Everything (EI2 2019), Changsha, China, 8–10 November 2019; pp. 1493–1498. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.

