1. Introduction
Given the growing global population and the quest for improved nutrition, it is crucial to acknowledge that pork production holds unparalleled importance as a primary source of protein in numerous countries. Pork is globally the second most consumed meat after poultry and beef, which account for 92% of total meat produced [
1,
2]. Pigs are commonly raised in enclosed pig barns, closed pig barns, or confinement buildings. These structures protect pigs from harsh weather conditions and facilitate better management of pigs, including monitoring, feeding, vaccination, and waste handling [
3]. The optimal indoor environment is associated with good indoor air quality and comfortable temperatures. In contrast, pollutants accumulating within confinement facilities can harm both human beings and animals housed in them. One environmental pollutant, particulate matter (PM), consists of solid particles and liquid droplets suspended in the atmosphere. High concentrations of PM, mainly delicate particulate matter, which can penetrate the alveoli during respiration due to their size, pose a potential threat to worker safety and animal welfare [
4]. Scientists categorize PM into PM
10 (inhalable particles with diameters generally 10 µm (10 μm) and smaller), PM
2.5 (fine inhalable particles with diameters of generally 2.5 µm and smaller), and PM
1 (extremely fine particles with a diameter less than 1 µm, significantly smaller than PM
2.5). PM
2.5 is a significant global public health concern, notorious for having various detrimental effects on cardiopulmonary health [
5]. Its adverse impacts extend to the male reproductive system upon exposure. Research indicates that PM
10 significantly affects the respiratory health of finishing pigs, with nursery pigs demonstrating greater sensitivity to particulate matter than fattening pigs due to their comparatively weaker immune systems [
3]. Despite the comprehensive documentation of the health effects associated with PM, no identified threshold concentration level for PM guarantees the absence of adverse health effects. While monitoring PM concentration is crucial for assessing air quality; swine farmers often overlook this measure due to the perceived expense of the monitoring methods.
Past research emphasizes the importance of real-time indoor air quality monitoring, as understanding the air quality within confinement buildings is crucial for evaluating potential risks [
5]. Typically, evaluating indoor air quality in confinement buildings may require the services of professional environmental testing equipment, such as TEOM (Model 1400 AB, Thermo Scientific, Waltham, MA, USA), DustTrak (Model 8520, TSI Inc., Shoreview, MN, USA), HAZ-DUST (Model EPAM-5000, SKC Inc., Fullerton, CA, USA), and others [
6]. While choosing professional equipment, they are impressive in measuring air quality in pig barns. Unfortunately, there are certain disadvantages to acquiring such equipment, which are detailed as follows.
Cost: Professional-grade equipment is often expensive, making it a significant investment for farmers, especially smaller operations;
Complexity: These instruments can be complex to operate and may require trained personnel, which can add to operational costs and the need for specialized training;
Maintenance: Regular maintenance is essential to ensure accurate and reliable measurements. This can be time-consuming and may require technical expertise;
Limited Accessibility: Due to the high cost, not all farmers may have access to such equipment, limiting widespread adoption and monitoring in smaller or resource-constrained farms;
Real-time Data Challenges: Some professional equipment may not provide real-time data, leading to delays in identifying and responding to changes in air quality;
Specificity: Some equipment may be designed for specific pollutants and using them for a broader range of air quality parameters may not be as accurate or comprehensive;
Portability: Some professional instruments may lack portability, making it challenging to monitor air quality in the different areas of a pig barn;
Limited Sensor Capabilities: Some professional air quality sensors may be designed specifically for particulate matter or certain gases, and they might not be equipped to measure additional parameters like temperature, humidity, light, sound, motion, vibration, flame, or other types of gases;
Sensor Integration Challenges: Integrating multiple sensors for different parameters may be challenging, especially if the sensors come from different manufacturers. Compatibility issues can arise regarding communication protocols, data formats, and power requirements;
Calibration: Regular calibration is necessary to maintain accuracy. Calibration processes can be intricate and require technical knowledge;
Power Requirements: Certain professional instruments may have specific power requirements, making them less suitable for locations with limited power infrastructure.
To overcome this challenge, there is a demand for environment monitoring systems that are affordable, scalable, and easily accessible. The current phase of agriculture, known as agricultural era 4.0, incorporates modern technologies like the Internet of Things (IoT), big data analysis, artificial intelligence, cloud computing, and remote sensing [
7,
8,
9]. The IoT has played a pivotal role in various sectors, including industry, healthcare, agriculture, logistics, transportation, power grids, environmental protection, fire safety, furniture, and other facets closely intertwined with daily life. Incorporating these cutting-edge technologies has significantly improved agricultural practices by developing single-board computers such as Raspberry Pi, which are compatible with cost-efficient sensors and open network platforms. Advancements in information technology, sensor technology, and IoT technology have made it feasible to construct a comprehensive system that is well suited for continuously monitoring the environment of livestock buildings over an extended period. In recent decades, the application of environmental monitoring systems based on IoT devices that incorporate low-cost sensors has significantly increased. Along with the low-cost sensor technology, the availability of open source furthered the proliferation of IoT-based environmental monitoring. In a broad sense, the term “open source” pertains to software applications where the source code is accessible to the public so they can modify or utilize the program as intended.
This research paper explores developing and implementing a low-cost Raspberry Pi-based air quality monitoring system tailored to the specific needs of livestock management. We will discuss the hardware and sensor components, the data collection and visualization techniques, and the potential benefits of such a system for livestock health and farm productivity. Furthermore, it has undergone comprehensive testing and validation in an actual environment and was assessed through co-locating testing. This research endeavors to make a valuable contribution to the welfare of livestock, farmers’ health, and the agricultural industry’s sustainable development by offering a cost-effective and easily accessible air quality monitoring solution for livestock buildings. The subsequent sections of this paper are organized in the following manner. The experimental site and setup are described in
Section 2, which focuses on materials and methods.
Section 3 of the document outlines the prototype’s system architecture, along with detailed descriptions of the software and hardware components. In
Section 4, an examination is conducted on the outcomes of the co-location test and the system’s performance.
Section 5 and
Section 6 are dedicated to the discussion and conclusion of the respective sections.
Literature Review
While data collection has always been difficult and costly in smart building research, it is essential for the creation of smart agricultural buildings. To address this, IoT-based monitoring systems have been put into practice. However, the ability to acquire, gather, and process continuous indoor air quality data in agricultural buildings at a reasonable cost is still limited. In indoor environmental monitoring, several earlier studies are being put forth and making substantial contributions; these will be covered in the current part.
A previous study [
10] did a laboratory assessment of low-cost PM monitors to evaluate the performance of four low-cost PM monitors (Speck (Airviz Inc., Pittsburgh, PA, USA), Dylos 1100 Pro/Dylos 1700 (Riverside, CA, USA), AirAssure PM
2.5 IAQ Monitor (TSI Inc., Shoreview, MN, USA), and AirSense (Buffalo, NY, USA)) against well-characterized reference instruments. Even though a critical assessment was conducted between multiple sensors, those are not custom-built, and the data collection system is poor, such as stored in the SD card or 9-pin serial cable. Likewise, Ref. [
11] evaluated the performance of low-cost sensors for air quality measurements (PM
1, PM
2.5, and PM
10). They have used GRIMM Aerosol (GRIMM EDM 107) and plantower (pms5003) to collect the data as a collection test. However, the major objective of this study is to compare both sensors with public data monitoring rather than building a database management system. Additionally, Ref. [
12] accessed three different sensor units from AQMes (AQMesh pods (Environmental Instruments Ltd., Stratford-upon-Avon, UK) with a colocation test. That study asses the NO
2, NO, O
3, temperature (T), relative humidity (RH) and atmospheric pressure (P). That study evaluated the performance during the winter and summer seasons of Parma and Modena provinces of northern Italy. However, it is imperative for an effective data collection system to offer up-to-date air quality data, which can be valuable in comprehending the surrounding environment and aiding decision makers in formulating more effective pollution control policies. The utilization of a low-cost air quality monitoring system powered by a single-board computer (SCB) for the measurement of indoor air pollutants has experienced a significant increase in popularity in recent years [
13].
A wireless sensor network system combined with the XBee module, Arduino, and Raspberry Pi as open source hardware platforms was proposed by a previous study [
13]. The system is inexpensive and expandable in terms of the kind of sensors and the number of sensor nodes. An Arduino board was intercropped with several sensors acting as the data acquisition unit/sensing nodes. The prototype was designed to gather data on humidity and temperature. An XBee module integrated with Raspberry Pi Zero is used to create an access point that allows a continuous flow of data from the Raspberry Pi Zero to the data storage layer. The base station is built around a Raspberry Pi, which is connected to the Internet via a router. The base station’s XBee module functions as a coordinator device and can only support a maximum of 10 sensing nodes. The system is portable in the sense that the sensing nodes can be placed in proximity to the base station. It is appropriate for a broad range of environmental monitoring applications. In a previous study [
14], an Android-based smart home system was developed that can be controlled via Bluetooth and Internet connectivity. An Arduino Ethernet microweb server running consists of Arduino Mega 2560 and Arduino Ethernet Shield used as the motherboard of the system, which consists of a siren, a nRF24L01+ radio module to control the devices such as light switches, temperature sensors, gas sensors, motion detection sensors, and alarms in a household.
However, several studies were developed to control and automate residential buildings and office buildings. For instance, Ref. [
15] developed indoor air quality monitoring for multi-point based on IoT to monitor the air quality and microclimate of a residential building. That study utilizes a custom-made motherboard and resistance–capacitance (RC) elements to build the monitoring system, along with three sensors to monitor the temperature, humidity, CO
2, and PM
2.5. The distribution monitoring page, historical data report, and monitoring alarm functions were added to their own designed web page, along with the data visualization of collected variables using Modbus protocol. Likewise, another recent study [
16] implemented an indoor environment monitoring system for residential buildings, a Raspberry Pi-based multi-sensor microclimate monitoring system. They used multiple sensors, including a temperature and humidity sensor (DHT11), a light sensor (GL5528), a microphone sound sensor, flame sensor, a vibration sensor (SW420), and a passive infrared motion sensor (HC-SR501) to collect environmental variables. They also conducted a case study to check the performance of the system in different rooms in that house. The systems suggested in Reference [
16] possess the characteristic of being cost-effective, portable, and capable of scaling to a certain degree.
Nonetheless, the implementation of IoT systems is imperative in sectors such as agriculture and livestock management, which are susceptible to current climatic conditions but are not conducive to ensuring food security. While there have been many studies on the use of IoT in agriculture [
7,
17,
18,
19,
20,
21] there is a noticeable lack of research on the air quality monitoring systems specifically in livestock buildings. The current study aims to address these limitations by focusing on the development of a cost-effective, straightforward, effective, scalable, and portable indoor air quality monitoring system utilizing Raspberry Pi technology. To ensure cost-effectiveness, the study employed inexpensive sensors, while wireless communication was utilized to achieve portability.
5. Discussion
5.1. Limitations and Obstacles
Several studies have already developed air quality monitoring systems in recent days, yet it is for outdoor or living houses or small buildings. That kind of system also can be adopted for the swine building, but the building dynamics of humans and animal shelters are completely different. The present study demonstrated a low-cost air quality monitoring system and validated it in a real pig barn. However, the authors highlight the practical technical obstacles that arise while implementing such systems and the corresponding methodologies for finding solutions.
Hardware Limitations: Hardware durability in indoor air quality monitoring systems can fluctuate based on environmental conditions, usage patterns, technological advancements, and component quality, among other variables. The components of superior-quality hardware typically have longer lifespans than those of inferior quality. The current investigation purchases superior hardware to develop the present monitoring system. For example, while most studies employed Raspberry Pi Zero to fabricate the sensor nodes, the current investigation utilized Raspberry Pi 4B, an even more powerful model capable of supporting greater sensor loads and being compatible with future sensor additions. For measuring air quality parameters, IoT devices rely on sensors. However, the collected data may contain some errors due to these sensors’ variable precision and dependability. While the calibration and maintenance of sensors are critical, they can present difficulties when applied to real-world conditions. In addition to investing in sensors of standard quality to address this obstacle, the current investigation validated the sensors in real-world situations to ascertain their precision and dependability.
Interference and Environmental Factors: IoT sensors could experience interference from various environmental and human sources, including but not limited to dust, humidity, temperature fluctuations, and barn cleaning activities. These environmental factors may impact the performance of sensors, resulting in accurate readings or consistent data. Using appropriate casing, the present study protects the sensor nodes from environmental factors that may interfere with measurements.
Unexpected Collisions: IoT devices depend on Internet connectivity to transmit data to central servers or cloud platforms for analysis. Data transmission may be impeded, however, by unreliable or restricted Internet connectivity in specific regions; this may cause delays or data loss. This challenges remote or rural areas characterized by inadequate network infrastructure. Several unexpected run-time crashes transpired throughout the data collection phase. Errors in sensor readings, poor connection, overloaded access, and server unavailability contributed to the issues. To address this difficulty, the authors employ local data processing and storage capabilities to temporarily store data during network outages and retransmit it once connectivity is restored. Furthermore, the sensor gateway guarantees consistent data transmission and restarts the data acquisition system in case of unexpected network collisions. Furthermore, local storage is an additional measure to prevent data loss; the log will be transferred to the central database once the network connection is restored.
Cost and Scalability: The financial investment required to implement IoT-based indoor air quality monitoring systems can be substantial at the outset, particularly when considering comprehensive solutions that encompass numerous sites or expansive buildings. Further infrastructure expansion or the need to scale up these systems may necessitate additional hardware, software, and maintenance expenditures. The current study opts for inexpensive yet high-quality equipment to align expenses and minimize initial investment. Compared to other studies, the spending associated with developing this monitoring system is reasonable.
The present study effectively addresses the constraints of IoT in indoor air quality monitoring and maximizes the capacity of these systems to enhance occupant comfort and environmental health by implementing these strategies.
5.2. Future Directions
The developed prototype’s collection of sensitive data regarding indoor air quality gives rise to apprehensions regarding data privacy and security. Unauthorized access to this information may expose building occupants to potential dangers or compromise their privacy. It can be difficult to implement robust cybersecurity measures effectively and ensure compliance with data protection regulations, even though such measures are vital. Subsequent lines of inquiry could encompass data-related concerns, including the security and privacy of user data, alongside the assessment of diverse privacy preservation methodologies to safeguard user information. The objective of forthcoming research is to develop robust encryption and authentication mechanisms to safeguard data while they are in transit and at rest.
Despite the completion and experimentation of the proposed prototype, the system is still in the developmental phase, with certain constraints that will be rectified or alleviated in subsequent iterations. Certain sensors necessitate calibration and fine-tuning to produce more precise readings. Although the prototype has undergone calibration, the system must be calibrated in various environmental conditions for more precise results. Given that the study’s primary goal is to develop affordable air quality sensors, the focus is primarily on designing the system. As a result, the system is unable to compare data with the traditional, expensive, and calibrated system. Nevertheless, future studies will assess the performance of the current system in comparison to the conventional calibrated air quality monitoring system. Furthermore, the sensor was only deployed in the pig barns for a limited duration, limiting its ability to capture data across various seasons, as the experiment was exclusively carried out in the model pig barn. Future studies will address these limitations by implementing a year-round air quality monitoring system to understand the seasonal impacts on air quality comprehensively.
6. Conclusions
This study presents a Raspberry Pi-based air quality monitoring system that is customized to meet the unique requirements of livestock management at an affordable price. This study makes a scholarly contribution by introducing a novel approach to installing a portable, scalable, and cost-effective IoT data infrastructure to sense indoor environments. The proposed wireless distributed sensing network comprises two prototype sensing nodes and the system’s design. Furthermore, it has undergone comprehensive testing and validation in an actual environment and was assessed through co-locating testing. The Wilcoxon rank sum test demonstrates that there are no significant differences between the two sensor datasets, as all variables have a p-value greater than 0.05. The prototypes can generate data about various parameters, including temperature, humidity, light, CO2, pressure, NH3, different types of gases, PM1, PM2.5, and PM10. However, except for carbon monoxide (CO), none of the variables exhibit an R-value exceeding 0.5 with PM concentrations. A graphical user interface is incorporated into the system to facilitate data access, visualization, and download and to enable adjustments to the sensing nodes and sensor modules. The study recorded the average values of PM1 (23.116 μg/m3), PM2.5 (34.34 μg/m3), and PM10 (38.099 μg/m3) based on the sensor readings. The experimental results demonstrate the proposed system’s functionality, portability, and scalability.
This study’s primary objective is to develop a low-cost air quality monitoring system for pig barns to protect farmworkers, as few are cognizant of the adverse effects of PM concentrations while working in pig barns. PM2.5 should not exceed 35 µg/m3, as the National Ambient Air Quality Standards for Particle Pollution specified. However, PM1, PM2.5, and PM10 are considerably higher in the table than this standard. Farm owners should consider this type of monitoring system, and it must be repaired. Presently, the system establishes communication with the sensors through the general-purpose input–output ports of the Raspberry Pi. After this, the controlling strategies for the pig barns could be enhanced through the addition of actuators to regulate and improve the air quality within the pig barns. Subsequently, the authors intend to incorporate additional functionalities, such as controls for ventilator fans, to enhance the usability and functionality of the system.