DOI: 10.3303/CET24114114 Paper Received: 30 June 2024; Revised: 16 September 2024; Accepted: 8 December 2024 Please cite this article as: Saniel A.L., Ombao R.J.D., Montemayor J.M.T., Hoybia J.C.B., Cruz P.A.M., Hernandez P.S.B., Mendova R.G.S., Martinez D.W.C., Panaligan A.N., 2024, Development and Optimization of IoT-Based Weighing Rain Gauge, Chemical Engineering Transactions, 114, 679-684 DOI:10.3303/CET24114114 CHEMICAL ENGINEERING TRANSACTIONS VOL. 114, 2024 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Petar S. Varbanov, Min Zeng, Yee Van Fan, Xuechao Wang Copyright © 2024, AIDIC Servizi S.r.l. ISBN 979-12-81206-12-0; ISSN 2283-9216 Development and Optimization of IoT-Based Weighing Rain Gauge Aldrich L. Saniel*,a, Roma Joy D. Ombaoa, James Micole T. Montemayora, Jandrix Clarence B. Hoybiaa, Philip Angelito M. Cruza, Pierre Sheann B. Hernandeza, Rommel Glenn S. Mendovab, Dan William C. Martineza, Ariel N. Panaligana aDepartment of Mechanical Engineering, College of Engineering and Architecture, Bataan Peninsula State University, Capitol Compound, Tenejero, Balanga, Bataan 2100, Philippines bDepartment of Civil Engineering, Gokongwei College of Engineering, De La Salle University, 2339 Taft Ave, Malate,Manila, Metro Manila, Philippines 1004 aldrichsaniel1.0@gmail.com Climate change significantly impacts the hydrologic cycle, altering water movement through land, oceans, and the atmosphere. The Philippines, an agricultural nation, experiences significant effects from the intensification of El Niño and La Niña events due to climate change. This highlights the need for accurate rainfall monitoring, which is crucial for everything from agricultural planning to flood control. This study aimed to develop and optimize an IoT-based weighing rain gauge to enhance the data’s accuracy and reliability. The design process involved analyzing existing rainfall data using the hydrological concept of return period and probability of non- occurrence while adhering to the World Meteorological Organization standards. Powered by a lithium-ion battery rechargeable by a solar panel, the system measures water in grams, converts it to millimeters, and stores it in the cloud. The fabrication employed 3D modeling and printing for efficient prototyping. Calibration used hysteresis and linear regression analysis to minimize errors, ensuring 99.999 % data accuracy. Validation in a laboratory setting showed that the prototype had 99.98 % accuracy, outperforming the commercial gauge’s 98.66 %. Standard deviation analysis indicated higher precision for the prototype. ANOVA confirmed no significant differences between the devices, validating the prototype’s reliability. Potential improvements include applying artificial intelligence to enhance performance. 1. Introduction Climate change is one of the most pressing challenges of the 21st century, significantly impacting various aspects of the planet’s ecosystems. Among its many effects, climate change has brought notable alterations to the hydrologic cycle, fundamentally reshaping the movement of water across land, oceans, and the atmosphere (Wang and Liu, 2023). Two prominent climate oscillations, El Niño and La Niña, stand out for their profound influence on global weather patterns. The fluctuations caused by El Niño and La Niña would lead to erratic weather patterns, disrupting ecosystems and livelihoods dependent on predictable climatic conditions in Asia (National Oceanic and Atmospheric Administration, 2023). In the Philippines, the vulnerability to climate change impacts is particularly pronounced. Ranked as the country facing the highest disaster risk worldwide, the Philippines experiences significant loss of life, livelihoods, and infrastructure due to approximately 20 typhoons annually (Nakasu and Amrapala, 2023). In addition, the Philippines is predominantly an agricultural nation. Preliminary figures for 2022 indicate that approximately a quarter of employed Filipinos work in the agricultural sector, which comprises four sub-sectors: farming, fisheries, livestock, and forestry (Balita, 2024). This makes the enhancement of rainfall monitoring technologies important in the Philippines as it will significantly improve data sources for agricultural purposes, water management, and hydrological modeling (Weir and Dahlhaus, 2024). Rainfall monitoring, conducted with a network of rain gauges deployed across a region, can show how rainfall varies in different places, changes over time, and relates to other types of weather (Veloria et al., 2021). Rainfall 679 data is crucial for everything from agricultural planning to flood control. Inaccurate precipitation measurement can have serious consequences, underscoring the importance of developing and optimizing reliable rain monitoring systems (Comptus, 2022) The current state of rain gauge technology is a blend of traditional methods and modern advancements. Traditional rain gauge technology, exemplified by those used by the Philippine Atmospheric, Geophysical, and Astronomical Services Administration (PAGASA), plays a crucial role in weather forecasting and climate studies (PAGASA, 2023). However, these traditional rain gauges are prone to manual reading errors and malfunctions. They are scattered across locations and limited in their accuracy in capturing rainfall data only within their immediate vicinity, especially in localized weather systems (Veloria et al., 2021). The study addresses the challenges in current rain gauges, such as inaccuracies, manual processes, and environmental sensitivity, by developing a precise and automated rain gauge using a weighing mechanism and IoT technology. Key innovations include the complete automation of data measurement, collection, storage, and access and the use of an automatic draining mechanism with a siphon tube. Objectives include optimizing structural elements, integrating IoT technology, calibrating the prototype, developing error compensation algorithms, and validating performance through comparative analysis. This enhances accuracy, efficiency, and real-time monitoring, offering a solution to the issues faced by existing rain gauge systems. The IoT-based weighing rain gauge would provide meteorological agencies, farmers, and climatology researchers with accurate, real-time rainfall data for weather forecasting, agricultural planning, disaster preparedness, and climate studies. 2. Review of Related Literature Weighing Rain Gauges (WRGs) have garnered significant attention in meteorological and hydrological studies over the past two decades due to their enhanced accuracy, resolution, and ability to measure short-term precipitation intensity. Despite these advantages, WRG designs still face several limitations. Ongoing research addresses these shortcomings, including issues related to the drainage process and capacity limitations (Barani, 2020). Several innovative solutions have emerged in recent studies to overcome the limitations of manual draining methods in current rain gauge models. Lim and Lim (2017) introduced a paired barrel concept for WRGs, featuring a flipping mechanism to efficiently empty rainwater. With a smaller capacity of 35 mL, this design demonstrated effectiveness in maintaining compact dimensions and reduced weight compared to traditional WRGs. However, its small capacity may not suffice during heavy and continuous rainfall, which is common in the Philippines during the rainy season. Similarly, Ibrahim et al. (2019) integrated a DC motor mechanism for periodic flip emptying of the WRG using a load cell and Arduino. This method enhanced operational efficiency, but the system could be improved by incorporating a data logging system, rainfall simulation for calibration, and error compensation algorithms. Using a DC motor also has a relatively high power requirement, potentially affecting the device's long-term efficiency. Advancements have also focused on improving the cost-effectiveness and accessibility of rain gauge technology. Integrating Internet of Things (IoT) technology has significantly advanced automatic rain gauges, enabling real-time monitoring and seamless data transmission. Valent et al. (2017) utilized 3D printing to enhance the precision of tipping bucket rain gauges while keeping costs low by pairing them with Arduino technology. However, their device showed lower accuracy compared to commercial models, though it can be improved through meticulous calibration. Martinez et al. (2023) further leveraged 3D printing technology to develop a cost-effective alternative for hydrologic monitoring. This study utilized multiple components such as a BH1750 sensor, GUVA-S12SD sensor, hall effect sensor, and AS5600 encoder. The ESP32 hardware processed all data from these sensors, which the commonly used Arduino board would struggle with due to differences in processing speed. The study achieved high data accuracy of 98.54 % to 99.71 % through meticulous calibration and testing. Their innovative approach underscores the potential for advancing rain gauge design and broadening its accessibility, significantly impacting the field and paving the way for future refinements and applications. However, this accuracy could be improved by utilizing load cells instead of the tipping mechanism of tipping bucket rain gauges. Despite these advancements, traditional manual rain gauges remain prevalent in many regions, including the Philippines, due to cost and accessibility constraints (Lena, 2023). This study builds on previous developments by leveraging 3D printing technology to optimize WRG design. This approach is advantageous due to its high customizability, sustainability, and cost-effectiveness. Another innovative feature is the auto-emptying mechanism facilitated by a siphon, which operates without additional components. The integration of IoT technology further enhances WRGs by automating processes to reduce measurement errors and provide seamless data access. While Arduino is the most commonly used hardware in IoT integration, alternatives such as ESP32 could offer better performance, especially when the system involves multiple sensors, programmed 680 algorithms, and data logging. This comprehensive strategy combines advanced technologies to improve the accuracy and reliability of rainfall measurements for meteorological, agricultural, and hydrological applications. 3. Methods The methodology began with theoretical research and adherence to World Meteorological Organization (WMO) rain gauge standards. The hardware setup included 3D modeling and printing, emphasizing sustainability with Acrylonitrile Styrene Acrylate (ASA) filament, which is known for its eco-friendly weather application properties. Concurrently, software configuration involved programming the microcontroller, load cell, water level sensor, and website development. The integration of hardware and software culminated in rigorous calibration. Laboratory testing followed, assessing the rain gauge's performance against a commercial alternative. 3.1 Structural Design and Optimization Rainfall data from the Department of Science and Technology (DOST) was used for a probabilistic rainfall depth analysis. The process involved calculating the probability of non-occurrence and using return periods in hydrology for specific rainfall intensities. With a 100-y design return period, the design is based on a 99 % or greater probability of non-occurrence. Probabilities were adjusted in increments, focusing on a 99.98 % non- occurrence rate to optimize the rain gauge design. Structural elements were calculated based on the analyzed rainfall intensities, ensuring compliance with WMO standards. The final design of the rain gauge presented in Figure 1a below includes a funnel diameter of 160 mm, a funnel area of 20,106.19 mm2, a bucket diameter of 80 mm, a bucket area of 5,026.55 mm2, a bucket height of 88 mm, and a design volume of 442,336.25 mm3. This ensures that the rain gauge can accurately measure rainfall over 15 min. Figure 1: (a) 3D model of the structural design (b) actual fabricated prototype 3.2 Integration with Internet of Things (IoT) Figure 2 displays the wiring schematics of the prototype. The project operates on a sustainable energy model powered by a 3.7 V lithium battery rechargeable via a 1 W solar panel, ensuring continuous functionality with minimal environmental impact. Rainfall measurement is facilitated by a 1 kg load cell, quantifying precipitation in grams, with raw data relayed to the ESP32-S2 Mini microcontroller with 4 MB flash memory and built-in Wi- Fi. The water level sensor with a 40 mm x 16 mm detection area served as an overflow indicator. Through programmed algorithms developed during calibration, the microcontroller converts the recorded grams into millimeters, utilizing a conversion formula based on the measured grams per bucket orifice area and the density of water. The processed rainfall data was sent to the ThingSpeak IoT cloud for storage and displayed on a developed website to enable IoT functionality. This allows users to remotely access real-time rainfall information from any device with a web browser, such as smartphones, tablets, or computers. 681 Figure 2: Wiring schematics 3.3 Calibration and Testing Before conducting experimental tests, a thorough calibration was performed to ensure the accuracy of the prototype rain gauge's weight measurement system. This involved collecting analog data from the load cell and using linear regression to establish a conversion factor between analog signals and the actual force in grams. Predicted weights from this model were compared to actual weights to assess accuracy. Any discrepancies or errors between the predicted and actual weights were noted for further analysis. To further improve the calibration accuracy, piecewise linear regression analysis was conducted and repeated up to two iterations. The pump that simulated rainfall was meticulously calibrated to ensure precise control over various rainfall intensities. This calibration process involved determining the pump's output rates at different analog signal levels, ensuring the simulated rainfall closely matched the desired intensities. The calibration was essential for providing reliable and accurate data during the experimental tests. An overflow compensation algorithm was developed to maintain measurement accuracy when the rain gauge bucket filled up. Triggered by the water level sensor indicating full capacity, the algorithm instructed the microcontroller to wait 23 s for the bucket to empty. If empty, 8.6 mm of water was added to the next 15-min interval reading. Any remaining water weight was added to this reading alongside the 8.6 mm. Hysteresis was incorporated to minimize sensitivity issues, ensuring only substantial weight changes were recorded as genuine rainfall, reducing errors. Experimental testing was executed in a controlled environment with a calibrated pump generating rainfall intensities ranging from 0 to 50 mm/h. The prototype and a commercially calibrated device were tested under these conditions, with measurements recorded five times for each intensity to ensure reliability. Environmental conditions such as temperature and humidity were kept constant to prevent any influence on the results, providing a comprehensive assessment of the prototype's performance. 4. Results and Discussions The study highlighted how 3D printing technology facilitated easy customization of the rain gauge to specific measurements, enhancing cost-effectiveness. The IoT-based rain gauge demonstrated greater economic viability through reduced maintenance requirements compared to traditional models. The device utilized a solar panel, reducing dependence on non-renewable energy sources. Durable materials were selected to ensure longevity and minimize the need for frequent replacements. The gauge's precision improves water resource management, potentially benefiting local ecosystems by preventing over-irrigation and reducing water wastage. The rigorous calibration process achieved a remarkable accuracy of 99.999 %, ensuring the reliability of the data collected during testing. Figure 3 visually represents the effectiveness of the second compensation iteration, demonstrating how corrected measurements align closely with actual values and showcasing the accuracy improvements from the iterative calibration. 682 Figure 3: Final corrected values vs. true pump rate Table 1 presents the overall accuracy of the prototype and the calibrated device. During laboratory testing, data analysis revealed that the prototype achieved a remarkable accuracy of 99.98 %, surpassing the calibrated tipping bucket rain gauge, which achieved 98.66 % accuracy. A significant contributor to the prototype's superior accuracy is the integration of the load cell. Unlike the tipping bucket rain gauge, which measures to one decimal point and counts in increments of 0.2 mm, the load cell offers much greater precision. Capable of measuring water levels with accuracy up to eight decimal places, the load cell provides finer granularity in data capture. Table 1: Overall accuracy Device Mean percent error Overall accuracy Prototype 0.023033583 % 99.97696642 % Calibrated rain gauge (onset) 1.339604365 % 98.66039563 % Figure 5 illustrates the standard deviation of both devices for each set of measurements at different rainfall intensities. Standard deviation analysis further underscores the prototype’s consistency and reliability, with more minor deviations observed across most rainfall intensities, indicating higher precision. The prototype maintained low variability, particularly at lower intensities, while the calibrated gauge exhibited increased variability, especially at higher intensities. Figure 5: Standard deviation of measurements The result of the analysis of variance (ANOVA) is tabulated in Table 2. The analysis revealed a P-value of 1 (1), much higher than the typical significance level of 0.05 (1). This comparison means that there is no statistically significant difference between the groups. In other words, the prototype performs as accurately as a commercial rain gauge. Additionally, the F-value is much smaller than the critical F-value. This suggests that the variation between the groups is not significantly larger than the variation within the groups. The variability within each group outweighs any differences between their means, further supporting the conclusion that there are no significant differences in measurements between the prototype and the calibrated device. 683 Table 2: ANOVA result Source of Variation SS (1) df (1) MS (1) F (1) P-value (1) F crit (1) Between Groups 1.487722009 9 0.165302445 0.000601825 1 1.974829198 Within Groups 27466.85978 100 274.6685978 Total 27468.3475 109 5. Conclusions In conclusion, this study has successfully developed an IoT-based weighing rain gauge that significantly enhances accuracy and reliability in measuring rainfall. The device, guided by WMO standards, has achieved 99.98 % accuracy, surpassing traditional methods. This comparison highlights the superiority of weighing rain gauges over traditional tipping bucket rain gauges in accurately capturing rainfall data. By incorporating a load cell, weighing rain gauges offers precision that exceeds tipping bucket rain gauges. These findings underscore the potential of IoT-based technologies in advancing rainfall monitoring. IoT technology for real-time data transmission and sustainable energy models enhances the accessibility and usability of rainfall data. Laboratory testing validated the prototype's performance across various simulated rainfall intensities, demonstrating its effectiveness comparable to commercial alternatives. While this project has made significant advancements, future research could focus on validating the rain gauge prototype's performance under real-world conditions. Exploring AI integration for predictive analytics and broader environmental monitoring capabilities could further enhance its utility. Overall, this study highlights the potential of IoT-based technologies in advancing rainfall monitoring, which is critical for climate change mitigation, agricultural planning, and disaster preparedness, particularly in regions like the Philippines. References Balita C., 2024, Agriculture in the Philippines - statistics & facts, >, accessed 12.04.2024. Barani J., 2020, Guide to Rain Gauges: Types, Sizes, Benefits and Drawbacks, , accessed 09.12.2023. Comptus 2022, Importance of Accurate Precipitation Measurement, , accessed 10.12.2023. Ibrahim A.D., Basarudin H., Ramli A.F., Yaakop, M., Sulaiman M.I., Abu M.A., 2019, Development of Rain Gauge Using Weight Measurement for Microwave Network. AIP Conference Proceedings, 2129. Lena P., 2023, Iloilo to install 50 rain gauges for faster weather watch, , accessed 10.12.2023. Lim G.-H., Lim E.O., 2017, A Paired Barrel Capable of Automatic Storage and Emptying of Water for a Weighing Raingauge. Atmosphere, 251-258. Martinez D.W., Gozun P.J., Panaligan A., Cruz G., Mendova R.G., 2023, Development of Community-Based Three-Dimensional Printed Weather and Hydrologic Monitoring System with Cloud Data Storage and Web Application. Chemical Engineering Transactions, 106, 157-162. Nakasu T., Amrapala C., 2023, Evidence-Based Disaster Risk Assessment in Southeast Asian Countries. Natural Hazards Research, 295-304. Nakasu T., Amrapala C., 2023, Evidence-based disaster risk assessment in Southeast Asian countries. Natural Hazards Research, 3, 295–304, DOI: 10.1016/j.nhres.2023.04.001. National Oceanic and Atmospheric Administration, 2023, What are El Niño and La Niña?, , accessed 10.12.2023. PAGASA, 2023, Daily Rainfall and Temperature, , accessed 09.12.2023. Valent P., Danacova M., Výleta R., 2017, Calibration of a Low-Cost 3D Printed Rain Gauge Utilizing an Open- Source Arduino Platform. 17th International Multidisciplinary Scientific GeoConference SGEM2017, 17 – 31, DOI: 10.5593/sgem2017/31/S12.010. Veloria A., Perez G., Tapang G., Comiso J., 2021, Improved Rainfall Data in the Philippines through Concurrent Use of GPM IMERG and Ground-Based Measurements. Remote Sensing, 13, 2859. Wang X., Liu L., 2023, The Impacts of Climate Change on the Hydrological Cycle and Water Resource Management. Water, 15, 2342. Weir P., Dahlhaus P., 2024, Merging Weather Radar and Rain Gauges for Dryland Agriculture. Journal of Southern Hemisphere Earth Systems Science, 74, ES23023, DOI: 10.1071/ES23023. 684