Use of IoT Sensors to Build an Intelligent Monitoring and Control System for Poultry House Environment

.


Introduction
"Smart Farming" plays an essential role in today's agriculture.Smart farming refers to using IoT sensors combined with information and communication technology to manage farms to increase the quantity and quality of products while optimizing the power required to perform work on the farm.IoT sensors can collect soil, water, light, humidity, temperature, and other types of data.The concept of smart farms has been extended to the field of poultry farming through, for example, the automation of intelligent poultry house management to improve the sanitation of the poultry house environment and avoid the infection hazards of epidemic viruses.
Automation applications such as smart farms, smart cities, and smart homes are all based on integrating Internet of Things (IoT) sensors, networks, information technology, and cloud space. (1)IoT technologies have connected farming harvest data and have given agriculture new opportunities.The number of agriculture IoT devices reached 75 million by 2020, and connected farming has helped farmers optimize crops, reduce downtime, and promote sustainable agriculture. (2)As data are collected through IoT, the activities of these farmers have considerably changed and take on a whole new technical level.With the help of IoT, farmers can minimize wasting of physical effort or resources and increase productivity.With data and automation, farmers can better nurture, harvest, and replenish their crops or raise animals or poultry. (2)Smart farming technologies allow farmers to monitor poultry better and adjust their growing environment accordingly, preventing disease and enhancing poultry health.In poultry farming, sensors monitoring house temperature, humidity, and air quality, (3) and collecting lighting data are essential for regulating the poultry house environment. (4)This is a crucial factor for improving production efficiency and preventing the spread of avian f lu.
In the construction of an intelligent monitoring and control system project in an indoor poultry house, we need to consider solar radiation incidence, ventilation, temperature, and humidity to maintain a comfortable level suitable for poultry growth. (5,6)An intelligent monitoring and control system still includes construction, water and electricity, drainage, and other projects.The system developed in this study can be installed and utilized in an indoor poultry house with an area of about 3600 m 2 (width: 90 × length: 40 m 2 ).After deducting the work space for management personnel, the actual internal use is 2625 m 2 (75 × 35 m 2 ).Depending on the construction area, 6.2-6.3 geese can be raised in 10 m 2 , and hence, about 1650 breeding geese can be raised.The experimental site is located in Yunlin County, Taiwan, as shown in Fig. 1.
To implement automated smart monitoring applications, many electrical devices and sensors must be used for environmental control operations.It is not suitable to use motion detection sensors for energy saving and carbon reduction in indoor poultry houses. (7)By using fixed sensors, energy saving and emission reduction can be achieved with the operation of solar radiation and temperature control appliances, (8) such as lights and exhaust fans.Among environmental control operations, power calculation can provide environmental data and the accumulated usage hours of electrical equipment in the simplest way to convert carbon emission and calculate power consumption, as shown in Table 1.CEF is the electricity carbon emission factor.
Astill et al. argued that smart poultry management systems need to incorporate (1) smart sensors, (2) automated farm processes, and (3) data-driven decision-making platforms. (9)With smart sensors collecting data on various parameters in poultry farming in real time and making good use of this huge amount of data, big data analysis tools can be adopted to make data-driven decisions. (9)Dallimore argued that the poultry house environment is an essential production factor that can be monitored.The ultimate goal of precision livestock farming is to transmit real-time data related to health parameters using a combination of mobile phones and Internet to enable the end user to monitor and track f lock health to enhance the productivity and welfare of the birds. (10)Environmental parameters include temperature, wind speed, ventilation rate, litter quality, humidity, and gas concentrations, including CO 2 and ammonia concentrations. (10)The effects of these parameters on poultry farming can improve the production of the poultry industry through reasonable automation control.The above-mentioned smart environment management requires precision livestock farming (PLF) technologies to integrate cameras, microphones, other tracking sensors, and related functional software to use quantitative and continuous recorded data as a reference for subsequent management.PLF technologies for real-time data collection enable better decision-making, better management practices, and higher production levels. (9)ompared with previous studies, (9,10) in this study, we developed an indoor poultry environment intelligent monitoring and control system on an Ethernet and Internet platform using IoT sensors, by which we can monitor the climate conditions of the indoor poultry environment in real time.This study is different from previous studies in that (1) in addition to automatically adjusting the temperature, humidity, wind speed, and light intensity to address sustainability management issues, the system will also record the cumulative use time of electronic equipment through sensors and calculate carbon emission.(2) Users can monitor the visual management webpage via tablet computers, smartphones, or other mobile devices and remotely turn on fans in accordance with the temperature and humidity to meet the hygienic requirements for poultry growth.It embodies the labor-saving characteristics of smart farms.

System Architecture
Oliveira et al. identified environmental control as the most critical issue in optimizing poultry production. (5)They used an array of wireless sensors to measure air temperature, humidity, and solar radiation incidence to mitigate the performance loss and even heat stress death of poultry.All data are stored on the Internet and interpreted by software that analyzes the thermal status of poultry houses.On the basis of this analysis, the computer remotely defines actions and sends commands to electronic devices connected to equipment in a poultry house.The system allows farmers to remotely turn on fans and close or open shades to obtain ideal temperature and humidity conditions for poultry growth.This increases the thermal comfort of the poultry.This is also the core issue where smart farms can effectively save power. (7)On the basis of the functions mentioned above, we extended related applications to include the following.(1) The visual interface enables users to view environmental data and the health status of poultry easily.(2) Through the integration with IoT, the system transmits the data of environmental sensors such as temperature, humidity, wind speed, light intensity, and CO 2 concentration to a cloud database for subsequent data analysis.(3) The system automatically adjusts power control in accordance with environmental variables to reduce energy consumption.(4) The system records the cumulative usage time of electronic equipment and can estimate power consumption and carbon emission.(5) The user can control IoT devices to adjust wind speed, temperature, and humidity to achieve a comfortable environment by connecting to the background management web through a tablet computer, smartphone, or other mobile devices, realizing intelligent monitoring control and power analysis to save energy.
In this section, we will explain the hardware and software functions, and the system architecture shown in Fig. 2. The central hardware core is a programmable logic controller (PLC; model: ECM6L45160, referred to as 6L45), which is a digital electronic device with a microprocessor made by ECOA.Its internal components include a CPU, instruction and data memory, input and output unit, power supply module, analog conversion digital module, and other unit modularizations.It uses a programmable memory to store instructions for performing logic operations, sequence control, timing, counting, and arithmetic operations.These instructions can control various types of mechanical equipment through digital or analog input and output.PLC is a digital logic controller that can be used for automatic control and can load control instructions into memory for storage and execution.It has the characteristics of solid versatility, convenient use, wide adaptability, high reliability, strong anti-interference ability, and simple programming.Therefore, in this study, PLC is used to monitor multiple parameters (temperature, humidity, illuminance, and CO 2 concentration), wind speed, and other data changes of these sensors.
In addition, we also added a programmable controller (ECI2626440, referred to as 2626) to match with IoT sensors.Used to control the operation of exhaust fans, the system also integrates an access control magnetic reed (magnetic switch) for safety monitoring.The data are connected to the web service through the transmission control protocol (TCP), output in the XML exchange format, and converted through the Web Service Python 3. The Web Service mainly facilitates the conversion of the XML format into the MySQL Database, stores the data in the MySQL data table, and connects to the cloud database (Cloud DB).The system communicates with the Web network service platform to achieve the system's automatic monitoring of the current condition of the indoor poultry environment.
The various software services required by the software development environment are described as follows.1. Programming development: In Fig. 2, ECM6L45160 (6L45) is used as the control server of the system, and the web-based visual monitoring software, as shown in Fig. 3, can be constructed using the diagram programming software RBDLC TOOLS.2. Network application (built-in HTTP web server): The Python3 to MySQL module in Fig. 2 uses JavaScript, Java Applets, and CGI Scripts to code programs.The 6L45 server sends XMLHttpRequest (xmltcp packet format) and data to the web application service in the cloud at a fixed time.Python3 to MySQL is the daemon operated by Web Service.In this study, when we refer to digital input (DI), we mean a digital signal received from an external source, such as a switch, button, or binary state.This signal is represented in binary form and usually used to control, monitor, or detect specific functions or events in the system.The term digital output (DO) represents the digital signal output from the system.This signal drives IoT components such as switches, relays, or indicators to perform specific operations or control.Analog input (AI) is a continuously changing signal from an IoT device or sensor.This

Monitoring System
The conceptual diagram of the system for the indoor poultry house environment is shown in Fig. 6.The control server contains a built-in database service that stores real-time information, operation records, status and address information of IoT devices, command monitoring results, and other related information.The control server processes include AI, conversion program, timing report, and XML data transmission.The communication between systems adopts the communication method designed by the intelligent monitoring and control system application (BACnet).The architecture of the control server is shown in Fig. 7, which clearly illustrates the overall operation of the control host and the various functions responsible for performing it.The management GUI of the system for the indoor poultry house environment is shown in Fig. 3, which was developed using the diagram programming software RBDLC TOOLS.
In Fig. 7, the hardware configuration and corresponding host control functions include the (1) message transfer function, (2) member management function, (3) job scheduling function, (4) system setting (configuring) function, (5) log storage function, (6) IoT management function, (7)  data uploading database function, and (8) HTTP web server, which provides web-based interface embedded graphic control software.The IoT management function integrates the values returned by the IoT sensors with the control of electrical appliances.Through the GUI, the current data of the indoor poultry house environment is retrieved, and the IoT devices are controlled and adjusted in accordance with the suitable growth conditions of poultry.The system sets the indoor temperature as lower than 25 ℃, and the first set of fans (two fans in one group) is turned on.When the indoor temperature is higher than 25 ℃, the two sets of fans are turned on.When the indoor temperature is higher than 30 ℃ , the system automatically starts three sets of fans and runs at full speed.Conversely, if the fans are fully turned on and the indoor temperature is lower than 30 ℃ (e.g., 29 ℃), the system will stop the second set of fans from running.Only the first set of fans will run if the temperature is lower than 24 ℃, as shown in Fig. 8.
The ECM6L45160 Digital Logic Controller (DLC) is a preprogrammed controller intended for building the system that controls the indoor poultry house environment.Being fully programmable ensures complete application versatility, allowing specific requirements and functions to be created for customers.This configurable unitary controller is based on the PIC series single-chip microcomputer and has three RS-485 local buses.The five digital outputs with 220-volt relays are ideal for driving contactors and starters.The four analog outputs are used for modulated actuators, electronicpneumatic transducers, variable speed drives, and other analog signal devices.The twelve digital inputs may be used for reading contact closures directly.The six analog inputs read the NTC thermistor with 4 to 20 mA for reading and 0 to 10 volt input signals.The specifications and pins of the ECM6L45160 DLC hardware are shown in Table 2.

Experimental Results and Discussion
On the basis of Fig. 5, we set up a list of control points for indoor poultry environments, as shown in Table 3.In the experimental stage, we connected the controller and sensor wires to the display breadboard following the location list in Fig. 5, as shown in Fig. 9. Lamp circuits (1), (2), and (3) are represented by f luorescent lamps, indoor thermometers (1) and ( 2) were used to detect the temperatures of the front and back areas of the indoor poultry house in Fig. 8, respectively.The anemometer is a three-group anemometer sensor, and exhaust fans (1) to ( 6) were merged into three groups of industrial exhaust fans, namely, the first group of exhaust fans ( 1) and ( 2), the second group of exhaust fans (3) and ( 4), and the third group of exhaust fans ( 5) and ( 6).The multifunction sensor EMR4 collects indoor temperature, humidity, CO 2 , and illuminance information.The EMR5 sensor is responsible for collecting outdoor temperature and illuminance information.The experimental data include those collected by EMR4, EMR5, the NTC temperature sensor, the anemometer sensor, and so forth.These data are integrated into   the web page for visual presentation.The IoT sensing range includes environmental data such as temperature, humidity, CO 2 , wind speed, and illuminance to form a visual dashboard, as shown in Fig. 10.
In the practical application of indoor poultry houses, the temperature collection includes two measurement points: indoor and outdoor.In addition, there are two measurement points in the poultry house space's front and back sections.In this way, it can be detected whether the exhaust efficiency differs between the front and rear areas.Therefore, in this study, the change in temperature and the number of exhaust fans are integrated, and on the basis of the temperature point adjustment at different stages, the system can automatically turn on/turn off exhaust fans to control the indoor poultry house temperature, as shown in Fig. 11(a).
For air quality maintenance in the indoor poultry house space of 2625 m 2 (75 × 35 m 2 ), there are two methods of air ventilation, namely, natural and mechanical, depending on the airflow in the environment.The industrial exhaust fan used in this study belongs to mechanical ventilation.Ventilation design is divided into negative-and positive-pressure ventilation.The negativepressure ventilation system uses a fan to extract dirty air from the house to facilitate air exchange inside and outside the poultry house.It is simple and low in cost, and is primarily used in large poultry houses.The positive-pressure ventilation system uses a fan to send in fresh air and drive out dirty air, which can be pretreated.Centrifugal or axial fans are used to maintain suitable temperature and humidity, and a clean environment.The function of exhaust fans is primarily to discharge dirty air, send in fresh air, or adjust the airflow in the poultry house in order to circulate the internal air.The characteristics of the exhaust fan include low pressure, high air volume, low noise, energy saving, stable operation, automatic opening and closing of louvers, easy maintenance, suitability for longitudinal and horizontal ventilation, and ideal ventilation equipment for the poultry house.The anemometer sensor is placed in the indoor space and used to measure whether the airflow of the negative-pressure ventilation in the poultry house is sufficient.
Proper lighting is one of the critical factors in poultry growth.Illumination has an essential regulatory and positive effect for poultry bone growth.Maintaining an appropriate light intensity in the poultry house not only helps to regulate the physiological functions of poultry but also facilitates their activities and human operations so that even if the poultry is raised indoors, they can feel the light changes during the day and night.Therefore, we incorporated time-sequence control into the light-off schedule, and the illuminance change during the day was integrated with the light circuit.The light circuit can be automatically turned on or off in accordance with the illuminance settings at different stages to manage the light control setting, as shown in Fig. 11(b).
Logging into this study's web-based visual monitoring UI requires identity authentication to enter the home screen.In Fig. 12, once the blue button of the environmental control automatic system in the upper right corner of the screen is activated (One Touch), the system can switch to the automatic operation mode.In practical applications, in addition to the management center logging into the intelligent monitoring and control system of this study through a desktop computer, mobile monitoring can also be performed in the poultry house environment using a tablet computer or a mobile phone, as shown in Fig. 12.Take the illuminance-linked light circuit as an example.After the system is operational, the first group of lights selected for the basic lighting settings is turned on during the day.The system compares the current outdoor and indoor illuminance values and takes the higher value as the benchmark illuminance.If the illuminance of the first lighting stage has been reached (the system defaults to 500 ±50 Lux), one set of light circuits will be automatically turned off.If the illuminance of the second stage of light unloading has been reached, the second set of light circuits will be automatically turned off.If the illuminance is lower than the illuminance requirement, one or two sets of lamp circuits will be automatically turned on.In the early stage of the experiment, when we use a fixed schedule to control the operation of electrical appliances, the recorded daily average carbon emission is 147 kg CO 2e /kWh, as shown in Fig. 13.In the later stage of the experiment, after adding the automation and monitoring of light and temperature detection, the daily average carbon emission is reduced to 94 kg CO 2e /kWh, as shown in Fig. 14.
This study has proven that applying IoT sensors combined with smart poultry farming applications can efficiently manage the breeding environment factors, such as lighting, wind speed, and CO 2 concentration.The experimental results also confirm that manpower and power resources can be saved via the environmental control automatic system.
A comfortable climate in poultry houses improves production results.The average daily power consumption of poultry houses in these experimental areas was reduced from 147 to 94 kg CO 2e /kWh, which represents the benefits of automation.In this study, we integrated lighting control, IoT sensors, cloud data conversion, and web-based GUI into an automatic monitoring and control system for the poultry house environment.The system can monitor the surrounding area's temperature, humidity, light, and wind speed, and remotely and automatically control electrical equipment.In addition, this system also provides an automatic scheduling function through the Internet and XML data exchange; the sensor data are collected in the environment, the electrical equipment is controlled, various data are stored in a cloud database, and the administrator can access the data through a remote network device.The control interface monitors the indoor poultry house environment in real time and receives any alarm notifications through email and messages.Finally, through the carbon emission record, the intelligent monitoring and control system is found to achieve effective and intelligent energy saving and carbon emission reduction.

Conclusions
We summarize the findings and merits of using an automatic monitoring and control system for the poultry house environment in this study as follows.
(1) Convenient access: By displaying the image recognition results on the web control interface, users can easily access and view these results on any device with a network connection.(2) Immediateness: This display method lets users immediately see the recognition results on the web control interface without waiting for additional steps.(3) Intuitive presentation: The recognition results are presented on the web control interface in images, labels, or other intuitive ways, making it easier for users to understand and interpret these results.(4) Operation and interactivity: This design allows users to interact with the recognition results on the web control interface, such as marking or editing the results, to further operate or trigger related tasks or functions.

3 .
Database service: We use the phpMyAdmin interface to manage Cloud DB (MySQL 5.0), as shown in Fig. 4. phpMyAdmin is a MySQL database management tool built on the website host in the form of Web-Base, which allows the administrator to manage the MySQL database through the Web interface.4. Ethernet protocol (IEEE 802.3):The communication protocol for the Building Automation and Control Network (BACnet) is supported by BACnet IP, Modbus TCP/IP, and URL. 5. Device communication connection: We used TIA/EIA-485, or RS-485, as the connection standard for IoT devices in this study.All the devices used follow the two-wire wiring system, and in accordance with the requirements of the indoor poultry environment, the system uses the RS-485 to Wi-Fi serial module for connection.

Fig. 5 .
Fig. 5. (Color online) Data transfer environment of intelligent monitoring and control system.

Fig. 6 .
Fig. 6. (Color online) Conceptual diagram of control system for indoor poultry house environment.
Fig. 9. (Color online) Controller and sensor wires connected to breadboard.

Fig. 10 .
Fig. 10.(Color online) Visual dashboard for environment data of indoor poultry house.

Fig. 12
Fig. 12. (Color online) Web-based visual monitoring system for automatic control of poultry house environment.

Fig. 13 .
Fig. 13.(Color online) Daily average carbon emission in initial stage of experiment.

Fig. 14 .
Fig. 14. (Color online) Daily average carbon emission in later period of experiment.

Table 3
List of environmental control point locations for indoor poultry houses.