Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6, 886-895 2024 Publisher: Learning Gate DOI: 10.55214/25768484.v8i6.2182 © 2024 by the authors; licensee Learning Gate © 2024 by the authors; licensee Learning Gate * Correspondence: khanchai.tun@kmutt.ac.th Applying the internet of things (IoT) for raising black soldier Fly (BSF) in closed system to minimize greenhouse gas emissions Kitiphan Soontronprasatporn1, Somchai Arunrungrusmi2, Khanchai Tunlasakun3*, Narong Mungkung4, Tanapon Tamrongkunannun5 1,2,3,4,5Faculty of Industrial Education and Technology, King Mongkut’s University of Technology Thonburi, Bangkok, Thailand, 10140; kitiphan.soon@kmutt.ac.th (K.S.) Somchai.aru@kmutt.ac.th (S.A.) khanchai.tun@kmutt.ac.th (K.T.) narong.mun@kmutt.ac.th (N.M.) nathwut.kow@kmutt.ac.th (T.T.). Abstract: The Black Soldier Fly (BSF), scientifically known as Hermetia Illucens L., effectively reduces organic waste and decreases harmful gas emissions more efficiently than landfill or composting methods. However, it can still produce harmful gases during the rearing of BSF larvae, including carbon dioxide (CO2), methane (CH4), nitrous oxide (N2O), and ammonia (NH3), which contribute directly and indirectly to the greenhouse effect. The pH level of the food provided to the larvae affects their biomass and leads to varying levels of gas emissions. This study aims to investigate the impact of greenhouse gas emissions when different pH levels of food are used, utilizing IoT technology to measure greenhouse gases and control the environmental conditions for rearing BSF larvae. The greenhouse gases monitored in this study include carbon dioxide (CO2) and methane (CH4), with environmental factors such as air temperature, humidity, soil moisture, and light intensity being controlled. The experiment tested pH levels ranging from 2.0, 4.0, 6.0, 7.0, and 8.0 to 10.0. The results show that different pH levels in food affect the emission of CO2 and CH4. Initially, a large amount of CO2 is released, gradually decreasing over time, while CH4 emissions steadily increase. In the early days, CH4 emissions are unstable, fluctuating before stabilizing. Food with a pH of 2.0 results in the lowest average CO2 emissions (430.53 PPM) from BSF larvae, and the lowest CH4 emissions (16.11 PPM) are also observed with a pH of 2.0. Keywords: Black soldier fly, Global warming, Greenhouse gasses, Internet of things. 1. Introduction In today's rapidly expanding society, growth in sectors such as the economy, industry, agriculture, and many others has increased demand for consumer goods. Production has often exceeded the need to meet these demands, resulting in a significant rise in waste. This has led to a growing issue of solid waste, a major environmental problem affecting public health due to inefficient waste management. Studies have shown a continuous increase in waste generation each year. For example, in 2022, Thailand's Pollution Control Department reported that the country generated 25.70 million tons of solid waste, with 9.91 million tons remaining untreated. Notably, 64 percent of this solid waste consists of organic waste. Organic waste, which includes rapidly decomposing waste materials such as vegetable scraps, food remnants, meat leftovers, fruit peels, and leaves, is a significant environmental concern. This type of waste, commonly managed through landfill disposal, initially helps reduce odor-related pollution. However, this approach can lead to several significant issues, such as soil contamination due to leachate, prolonged decomposition periods, and the production of methane (CH4), a potent greenhouse gas that significantly contributes to the greenhouse effect [1]. 887 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate Another standard method for managing organic waste at the household level is composting, which is favored for its simplicity and convenience. However, if not correctly managed according to appropriate scientific principles, composting can lead to issues such as foul odors from the organic waste and may become a breeding ground for pests and disease-carrying insects. This can result in adverse environmental and health impacts [2]. A popular method for managing organic waste is using Black Soldier Fly (BSF) larvae [3]. BSF larvae are more effective at processing organic waste than traditional methods such as landfill disposal and composting [4-6]. They are not disease vectors, do not harm crops, and do not cause nuisance to communities. Additionally, BSF larvae can produce compost from organic matter and be used as animal feed [7]. BSF can naturally be found in environments with rotting organic matter that emits a sour odor. Their life-cycle consists of five stages: egg, larva, prepupa, pupa, and adult. The duration of each life stage depends on environmental conditions. The larval stage is the most beneficial for practical uses, as fresh BSF larvae can be directly used as animal feed or dried and ground into meals to extend shelf life. This helps reduce the need for soybean and fish meals, as BSF larvae contain more than 40% protein and 35% fat. Currently, BSF farming can be categorized into two main types: open and closed systems [8]. Open systems involve raising BSF in a natural environment, which is commonly practiced among farmers. This method is straightforward and low-cost, but the yield could be more consistent depending on the regional environment and seasonal conditions. On the other hand, closed systems involve the use of technology to manage the rearing process and are popular in commercial settings. Technologies such as IoT are employed to optimize the environment for BSF growth [9], allowing for better control over production [10-13]. Feeding BSF larvae involves two methods: continuous feeding and batch feeding. Continuous feeding entails providing food daily or every two to three days until harvest time, while batch feeding involves a single feeding followed by a one-time harvest. Research has shown that both methods yield similar survival rates. However, it's crucial to note that the pH levels of the food can significantly influence the survival rates and biomass of the larvae [14-16]. Studies have shown that using BSF larvae to manage organic waste can reduce harmful gas emissions more effectively than traditional methods such as disposal or composting [17]. However, BSF larvae can still produce harmful gases, including carbon dioxide (CO2), methane (CH4), nitrous oxide (N2O), and ammonia (NH3), which contribute both directly and indirectly to the greenhouse effect. Ammonia (NH3) is produced after carbon dioxide (CO2) reaches its peak emission level [18, 19]. Additionally, the pH level of the food provided to the larvae affects their biomass and results in varying levels of gas emissions [20]. Thus, the researcher aims to apply IoT technology to rear BSF larvae in a closed-system greenhouse to minimize greenhouse gas emissions. This study will examine greenhouse gas emissions when the larvae are fed food at different pH levels, specifically 2.0, 4.0, 6.0, 7.0, 8.0, and 10.0. IoT technology will be utilized to monitor emissions of carbon dioxide (CO2) and methane (CH4) and to control and measure temperature, humidity, and light intensity during the experiment. This study aims to identify the pH level in food that results in the lowest greenhouse gas emissions, develop an IoT system for monitoring greenhouse gas emissions, and create an IoT system for controlling temperature, humidity, and light intensity. 2. Material and Methods 2.1. BSF Larvae For this study, 1,800 BSF larvae will be used, divided into six groups of 300 larvae each. These groups will be assigned to six different experimental conditions to assess the effects of various factors on greenhouse gas emissions and environmental control. 888 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate 2.2. Food Preparation The food mixture used in this study consists of 15% rice bran, 10% corn flour, and 70% water. Eighteen thousand grams of this mixture will be prepared for use across the six experimental groups. 2.3. Adjusting pH in Food The experimental food's initial pH levels are experimental food's initial pH levels are 2.0, 4.0, 6.0, 7.0, 8.0, and 10.0. The pH is adjusted by adding either citric acid or hydrochloric acid. The minimum initial pH level is set at 2.0, as larvae will be killed if the pH falls below 1.80. 2.4. Greenhouse Gas Measurement In this study, greenhouse gas measurements will focus on carbon dioxide (CO2) and methane (CH4). The measurements will utilize IoT technology, employing the MQ-4 sensor (as shown in Figure 1) for methane (CH4) and the MQ-135 sensor (as shown in Figure 1) for carbon dioxide (CO2). The measured values will be transmitted to an Arduino Mega 2560, which will then send the data to an ESP-8266. The data will be stored in a server database and displayed in graphical format through a web application. 2.5. Environmental Control This study controlled environmental conditions such as air temperature, air humidity, food moisture, and light intensity using various sensors and equipment. The DHT-22 sensor (as shown in Figure 1) was used to measure air temperature and humidity, the Soil Moisture sensor (as shown in Figure 1) was used to measure food moisture, and the BH-1750 sensor (as shown in Figure 1) was used to measure light intensity. The data collected by these sensors was sent to the Arduino Mega 2560 and then transmitted to the ESP-8266 for storage in the server's database. The Arduino Mega 2560 also controlled the following through relay modules: an ultrasonic mist sprayer (as shown in Figure 1) to maintain food moisture between 60% and 90% by spraying fine water mist, a fan (as shown in Figure 1) to regulate air temperature between 24°C and 30°C, and a light bulb (as shown in Figure 1) to adjust light intensity to a range of approximately 1,500 lux to 2,500 lux during the day. 2.6. Rearing Location The rearing trays are 27 cm wide, 42.5 cm long, and 10 cm high. As shown in Figure 2, each tray is covered with a dome equipped with a ventilation fan to ensure proper air circulation. 889 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate Figure 1. Microcontroller and sensor. Figure 2. Trays and domes for raising BSF. 890 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate Figure 3. Control cabinet. 2.7. IoT System Design The Arduino Mega 2560 reads data from sensors and sends this data via the Serial Port to the ESP- 8266. The ESP-8266 reads data from the Arduino Mega 2560 through the Serial Port to compute the average values and then transmits the data to Node-RED using the MQTT protocol. Node-RED on the server waits for data from the MQTT protocol, stores this data in the server's database, and allows a web application to retrieve and display the data from the server's database, as illustrated in Figure 4. 891 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate Figure 4. Internet of Things diagram. 2.8. Experimental Design and Procedures Food with pH levels of 2.0, 4.0, 6.0, 7.0, 8.0, and 10.0 was placed separately into each tray, with each tray containing 3,000 grams of food, as this was a batch-feeding system. Each tray was stocked with 300 larvae. The trays were covered with domes equipped with ventilation fans. Sensors were installed to measure carbon dioxide (CO2) and methane (CH4) gases, air temperature, humidity, food humidity, and light intensity. Data was collected every 10 minutes and recorded in a database to compare greenhouse gas emissions from food with different pH levels. 2.9. Statistical Analysis Statistical analysis was performed using SPSS 20 (SPSS et al.). All experimental results were analyzed using one-way analysis of variance (ANOVA), followed by Tukey's Honestly Significant Difference (HSD) test for post hoc analysis to compare significant differences (P) between the means of different groups. 892 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate 3. Results 3.1. Carbon Dioxide (CO2) Emissions Carbon dioxide (CO2) emission while feeding black soldier fly (BSF) larvae with food at different pH levels showed that in the first 5 days, CO2 emissions were initially high, peaking early and then gradually decreasing. The highest CO2 emissions were observed for pH 7.0 (449.72 PPM on Day 2), pH 2.0 (449.12 PPM on Day 1), pH 4.0 (448.32 PPM on Day 1), pH 6.0 (447.82 PPM on Day 2), pH 8.0 (446.21 PPM on Day 1), and pH 10.0 (445.56 PPM on Day 1). Conversely, the lowest CO2 emissions were recorded for pH 2.0 (428.22 PPM on Day 13), pH 4.0 (432.37 PPM on Day 11), pH 6.0 (435.45 PPM on Day 14), pH 7.0 (435.54 PPM on Day 10), pH 8.0 (433.28 PPM on Day 8), and pH 10.0 (434.28 PPM on Day 4). According to the recorded data, food with a pH of 2.0 released lower levels of CO2 compared to other pH levels. This reduced CO2 emission might be due to the high acidity of the food, which could inhibit microbial activity and consequently lower CO2 production. In summary, the study found that food acidity plays a significant role in CO2 emissions during the feeding of black soldier fly larvae. Figure 5. CO2 emissions. Table 1. CO2 emissions. pH Sum CO2 emission Avg co2 emission 2 6027.37 430.53 4 6127.33 437.67 6 6123.48 437.39 7 6122.91 437.35 8 6120.99 437.21 10 6117.32 436.95 The average CO2 emissions from BSF larvae rearing with food at different pH levels showed that food with a pH of 2.0 had the lowest average CO2 emissions at 430.53 PPM. This was followed by food with pH levels of 10.0, 8.0, 7.0, 6.0, and 4.0, with average emissions increasing in the following order: 436.95, 437.21, 437.35, 437.39, and 437.67 PPM, respectively. 893 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate 3.2. Methane (CH4) Emissions The methane emission (CH4) while feeding BSF larvae with food at different pH levels continuously increased over time. Initially, CH4 emissions fluctuated but then showed a general trend of increase. The highest CH4 emissions were observed for pH 8.0 (18.37 PPM on Day 4), pH 4.0 (17.87 PPM on Day 14), pH 10.0 (17.87 PPM on Day 6), pH 7.0 (17.47 PPM on Day 14), pH 2.0 (17.45 PPM on Day 14), and pH 6.0 (17.17 PPM on Day 5). Conversely, the lowest CH4 emissions were recorded for pH 8.0 (14.53 PPM on Day 1), pH 4.0 (14.69 PPM on Day 6), pH 10.0 (14.82 PPM on Day 1), pH 2.0 (14.97 PPM on Day 4), pH 6.0 (15.64 PPM on Day 3), and pH 7.0 (15.87 PPM on Day 9). Figure 5. CH4 emissions. Table 2. CH4 emissions. pH Sum CH4 emission Avg CH4 emission 2 225.55 16.110 4 228.85 16.35 6 230.06 16.43 7 232.12 16.58 8 234.41 16.74 10 231.09 16.50 The average methane (CH4) emissions during the rearing of BSF larvae with food at different pH levels showed a clear trend. Food with a pH of 2.0 resulted in the lowest average CH4 emissions at 16.11 PPM. This was followed by food with pH levels of 4.0 (16.35 PPM), 6.0 (16.43 PPM), 10.0 (16.50 PPM), 7.0 (16.58 PPM), and 8.0 (16.74 PPM), demonstrating an increasing trend in CH4 emissions with higher pH levels. The experiment demonstrated that varying pH levels in the food significantly affect the emission of greenhouse gases. Initially, carbon dioxide (CO2) emissions were high and decreased progressively over time, while methane (CH4) emissions gradually increased. During the early days, CH4 emissions 894 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate fluctuated before stabilizing. Food with a pH of 2.0 resulted in the lowest average CO2 emissions at 430.53 PPM, followed by pH levels of 10.0 (436.95 PPM), 8.0 (437.21 PPM), 7.0 (437.35 PPM), 6.0 (437.39 PPM), and 4.0 (437.67 PPM). Similarly, food with a pH of 2.0 led to the lowest average CH4 emissions at 16.11 PPM, with increasing emissions observed for pH levels of 4.0 (16.35 PPM), 6.0 (16.43 PPM), 10.0 (16.50 PPM), 7.0 (16.58 PPM), and 8.0 (16.74 PPM) 4. Conclusions This study reveals that the initial pH level of food significantly impacts the greenhouse gas emissions from black soldier fly (BSF) larvae. This finding is beneficial in current global warming challenges, as it can help reduce greenhouse gas emissions. The research suggests that developing economic models for BSF farming could be advantageous in managing organic waste or producing alternative animal feed to replace costly protein sources from plants and animals, while reducing greenhouse gas emissions. It is evident that different pH levels in the food result in varying greenhouse gas emissions. Efficient management by adjusting the initial pH level of food for BSF larvae can effectively help lower greenhouse gas emissions. Acknowledgments: This research was funded by Petchra Pra Jom Klao Master's Degree Research Scholarship from King Mongkut's University of Technology Thonburi, Thailand. and this work is also supported by the project of the Research, Innovation, Partnerships Office (RIPO) with Financial Support from Faculty of Industrial Education and Technology. Copyright: © 2024 by the authors. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). References [1] Yasmin, N., et al., Emission of greenhouse gases (GHGs) during composting and vermicomposting: Measurement, mitigation, and perspectives. Energy Nexus, 2022. 7: p. 100092. [2] Cerda, A., et al., Composting of food wastes: Status and challenges. Bioresource Technology, 2018. 248: p. 57-67. [3] Alejandro, P.,Imke, J.M. De Boer Walter, J.J. Gerrits Joop, J.A. Van Loon Marcel, J.W. Heetkamp Jeroen, V.S. J., E.B. and Hannah H.E,. Van Zanten, 2020, “Bioconversion efficiencies, greenhouse gas and ammonia emissions during black soldier fly rearing – A mass balance approach”, Journal of Cleaner Production [Electronic],2020, Vol.271, pp.1- 8, Available: ScienceDirect [12 March 2024]. [4] Chen, J., et al., Effect of moisture content on greenhouse gas and NH3 emissions from pig manure converted by black soldier fly. Science of The Total Environment, 2019. 697: p. 133840. [5] Siddiqui, S.A., et al., Black soldier fly larvae (BSFL) and their affinity for organic waste processing. Waste Management, 2022. 140: p. 1-13. [6] Ermolaev, E., C. Lalander, and B. Vinnerås, Greenhouse gas emissions from small-scale fly larvae composting with Hermetia illucens. Waste Management, 2019. 96: p. 65-74. [7] Salomone, R., et al., Environmental impact of food waste bioconversion by insects: Application of Life Cycle Assessment to process using Hermetia illucens. Journal of Cleaner Production, 2017. 140: p. 890-905. [8] Chineme, A. and G. Assefa Open and Closed Black Soldier Fly Systems Tradeoff Analysis. Sustainability, 2023. 15, DOI: 10.3390/su152416677. [9] Dr. M. Newlin Rajkumar, Sruthi M. S , Dr. V. Venkatesa Kumar, " IOT Based Smart System for Controlling Co2 Emission, IInternational Journal of Scientific Research in Computer Science, Engineering and Information Technology(IJSRCSEIT), ISSN : 2456-3307, Volume 2, Issue 2, pp.284-288, March-April-2017. [10] Salam, M., et al., Effect of different environmental conditions on the growth and development of Black Soldier Fly Larvae and its utilization in solid waste management and pollution mitigation. Environmental Technology & Innovation, 2022. 28: p. 102649. [11] Kristianto, K., R.V. Lambert, and A.S. Girsang, Automated IoT Device to Manipulate Environmental Condition of Black Soldier Fly. International Journal of Emerging Technology and Advanced Engineering. 12: p. 33-40. [12] Meneguz, M., L. Gasco, and J.K. Tomberlin, Impact of pH and feeding system on black soldier fly (Hermetia illucens, L; Diptera: Stratiomyidae) larval development. PLoS One, 2018. 13(8): p. e0202591. https://creativecommons.org/licenses/by/4.0/ 895 Edelweiss Applied Science and Technology ISSN: 2576-8484 Vol. 8, No. 6: 886-895, 2024 DOI: 10.55214/25768484.v8i6.2182 © 2024 by the author; licensee Learning Gate [13] Luluk, S., et al., Implementation of Maggot Cage Temperature and Humidity Control Using ESP8266 Based On the Internet of Things. Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), 2022. 6(5). [14] Daniel, D., Paulin,N. Hervé, M.K. Janaina, M.K. Ornela, M. Timoléon T. and Rousseau, D., 2020, “Feeding strategies for small-scale rearing black soldier fly larvae (Hermetia illucens) as organic waste recycler”, SpringerLink , 2021 ,Vol 3, Available: SpringerLink [14 March 2024]. [15] Kofi,A.B., Alessio I.and Daniele D., 2022, “Greenhouse Gas Emissions and Life Cycle Assessment on theBlack Soldier Fly (Hermetia illucens L.)”, sustainability, 2022, Vol. 14, PP.29, Available: MDPI [15 March 2024]. [16] Pang, W., et al., Reducing greenhouse gas emissions and enhancing carbon and nitrogen conversion in food wastes by the black soldier fly. Journal of Environmental Management, 2020. 260: p. 110066. [17] Mertenat, A., S. Diener, and C. Zurbrügg, Black Soldier Fly biowaste treatment – Assessment of global warming potential. Waste Management, 2019. 84: p. 173-181. [18] Parodi, A., et al., Bioconversion efficiencies, greenhouse gas and ammonia emissions during black soldier fly rearing – A mass balance approach. Journal of Cleaner Production, 2020. 271: p. 122488. [19] Boakye-Yiadom, K.A., A. Ilari, and D. Duca Greenhouse Gas Emissions and Life Cycle Assessment on the Black Soldier Fly (Hermetia illucens L.). Sustainability, 2022. 14, DOI: 10.3390/su141610456. [20] Junhua, M., Yanyan, L. Kashif, u.R. Ziniu, Y. Jibin, Z. Wu, L. Qing, L. Jeffery, K.T. and Longyu, Z., 2018, “Dynamic Effects of Initial pH of Substrate on Biological Growth and Metamorphosis of Black Soldier Fly (Diptera: Stratiomyidae), ResearchGate, 2018, Vol. none, pp. 7, Available: ResearchGate [15 March 2024].