Environment Parameters Control Based on Wireless Sensor Network in Livestock Buildings

The products quality and welfare of animals are closely related to the environment parameters in livestock buildings. A monitoring and control method of environment parameters in livestock buildings based on wireless sensor network is proposed in this paper. Temperature, humidity, light, carbon dioxide concentration, ammonia concentration, and hydrogen sulfide concentration can be monitored in real time by this method. The above six parameters will be adjusted and controlled through WLS algorithm and the minimizing deviation criteria. Compared with the traditional method, the high labor cost will be saved and energy consumption will be decreased. The experimental results show that this method can in real time monitor, effectively adjust, and control the environmental parameters in livestock buildings.


Introduction
The world's energy is facing a major challenge on resources, environment, configuration, efficiency, and so on. So, people's attention to the exhaustion of resources, climate change, carbon dioxide emissions, and environmental pollution is gradually increasing [1]. In other industries, the Internet of Things has fast development on the field of machine learning [2], data fusion [3,4], and image annotation [3,5,6]. By contraries, the informatization in the field of the agricultural level is lower. By drawing on the concept, method, and technology of Internet of Things in the field of information, "information flow, energy flow, control flow" of agriculture can be made with a perfect fusion, and then the agricultural production efficiency will be improved and the energy consumption will be reduced.
In China, studies have demonstrated that the proportion of terminal energy consumption increases by 1% and energy intensity will decrease by 3.7% [7]. China is a big country of livestock and poultry breeding. Imminently, it requires the development of intelligent and intensive industry. The practice and related scientific research of livestock and poultry production have shown that the growth, health, reproduction status, and forage utilization of livestock and poultry are restricted by the environment of its house and stall. The environmental condition of the poultry house and livestock stall has become an important factor in the development of poultry house and livestock production. In the process of poultry and livestock breeding, controlling the poultry environment has an important significance to the animal healthy growth to maximize the use of its growth performance.
According to The Latest Agriculture Industry Standard of China, it is the main environment parameter in livestock buildings such as temperature, humidity, light, carbon dioxide concentration, ammonia concentration, and hydrogen sulfide concentration. Most of the research results, at present, are only in the theoretical stage and the experimental stage, few of them have been tested for a long time, and the accuracy and stability of data acquisition and system still cannot be verified before having mass field testing in livestock buildings.

The Influence of Various Environmental Factors.
Corral environment controlling mainly includes two aspects of content. One is up to the monitoring of air environmental conditions; the other one is up to control air environmental quality. The former is mainly aimed at the environmental 2 International Journal of Distributed Sensor Networks factors such as light, temperature, and humidity, and the latter one is based on the control of all kinds of harmful gases [8][9][10][11]. In China, there are some special industry standards on the livestock and poultry field environment. In the "NY/T388-1999," it says that the relative humidity is 80%, ammonia concentration is 20 mg/m 3 , carbon dioxide concentration is 1500 mg/m 3 , and hydrogen sulfide is 8 mg/m 3 .
2.1.1. The Air Temperature. Corral air temperature mainly depends on the way to dissipate heat such as the sunlight illumination, body temperature, artificial heating, fermentation heat of manure and straw, the wall transferring heat, and ventilation. The sunlight varies with the seasons and time, so temperature in the corral is not set in stone. When corral temperature changes, livestock and poultry body activities will react accordingly. Take the temperature dropping, for example; livestock and poultry will make spontaneous activity weakened and decrease sweat glands and respiratory activity, in order to reduce heat loss. At the same time, under the cold condition, livestock and poultry also use the oxidation of nutrients in the body to increase the body's heat peroxide and maintain body temperature regulation.

The Relative
Humidity. The air humidity inside the corral mainly comes from the discharge of water vapor and air flow into the livestock and poultry and the evaporation of corral's water vapor. Compared with a closed corral or semiclosed one, the relative humidity is much higher than an open corral. The influence of air humidity on livestock and poultry productivity mainly reflects in what follows. (a) It is the most direct impact of air humidity on livestock and poultry breeding, which affects livestock and poultry thermal regulation. Under the condition of high temperature, livestock and poultry regulate their own body temperature by evaporative heat, but high humidity can reduce the temperature difference between skin and air difference to reduce the heat. In fact, it is not conducive to keep the livestock and poultry body temperature constant. Under the condition of low temperature, maintaining constant body temperature needs to reduce the heat by the way of evaporation like radiation, conduction, and convection, but high humidity of the air environment can increase the temperature difference between skin and air. Accordingly, adding to cold stress, it is comfortable to keep the corral's relative humidity of 60∼70%. And, the lower limit and upper limit should not exceed 80% and not be less than 50%. (b) Humidity is an environmental factor and promotes fattening and growth of livestock with other environmental factors together. (c) The rise of humidity will have a harmful effect on the composition of the breast milk.

Ammonia.
First, it is harmful for livestock and poultry's eyes and respiratory system. Ammonia can be soluble in water easily. And it will be absorbed easily by livestock and poultry's conjunctiva and mucous membrane adsorption, which causes congestion and edema, and the number of secretions becomes increased. Even it can cause tracheitis, bronchitis, pulmonary edema, and so on. Second, it is harmful for the circulation of the blood system. Ammonia is absorbed by livestock and poultry body, when the quantity is small, it can be directly transformed into urea and be eliminated from the body, but it also affects the disease resistance of livestock and poultry. If the quantity is large, blood can bring it through the lungs and generate the low iron into the alkaline high iron red element, which influences blood oxygen capacity of livestock and poultry, causing symptoms such as anemia and lack of oxygen.

Hydrogen Sulfide.
First, it is harmful for livestock and poultry's respiratory system. Hydrogen sulfide enters into the livestock and poultry body by respiratory system. Combined with sodium ions, it can produce sodium sulfide in respiratory mucosa, which stimulates mucous membrane, causing inflammation, and even tissue edema. Second, it is harmful for the circulation of the blood system. Hydrogen sulfide enters into livestock and poultry body by alveolar. Part of them is oxidized into nontoxic substance and sulfate exhausted out of the body. Most of them is free in blood and make the reduction ferric iron ions in the blood of bivalent iron ions. Thus, it affects cell oxidation ability, causing systemic poisoning symptoms.

Carbon Dioxide.
Most of carbon dioxide comes from livestock and poultry breathing activity; a dew part of carbon dioxide comes from the decomposition of organic matter. Carbon dioxide is nontoxic substance. However, livestock and poultry are relatively concentrated in enclosed corral. If carbon dioxide is too much, the concentration of oxygen in the air will drop greatly. Thus, inhibit normal breathing and physiological metabolism of livestock and poultry; and what is even more serious, it can cause the intoxication of livestock and poultry [12][13][14]. The experimental research shows that the concentration of carbon dioxide rises in the enclosed corral; other harmful gas concentrations are also likely to increase. Therefore, carbon dioxide concentrations are usually used to corral degree of air pollution in testing standards.

Light Intensity.
Light intensity is the luminous flux in the form of object area and surface. It is indispensable to corral environment factor, which plays a key role in the process of external conditions, such as the survival, growth, development, and breeding. On the natural conditions, natural light has a high regularity, with the seasons changing, day and night shifting. It makes a lot of functions of livestock and poultry body deal with regular sunlight life activities, such as sleep, tissue metabolism, hormone levels, and immune and nervous system.

Sensor Node
2.2.1. Temperature Sensor. Temperature sensor makes use of various physical properties with temperature change law of the category of sensor temperature conversion into electricity (usually avail for single chip microprocessor to collect voltage or current). According to the measurement, method can be divided into the contacting temperature sensor that makes use of principle of heat conduction to the temperature measurement and the noncontact temperature sensor that takes advantage of principle of thermal radiation.
According to the principle of work, it can be divided into pyroelectric temperature sensor, thermal resistance temperature sensor, and PN junction temperature sensor. Surface temperature is the important basis of animal epidemic prevention. The temperature sensor is mainly used in agricultural farming, such as houses environment temperature monitoring and individual body surface temperature monitoring to livestock and poultry and so forth.

Humidity Sensor.
Humidity sensor is a class of sensor that takes advantage of component materials of physical or chemical properties, which changes with the humidity of the environment humidity value converted to electricity. Common method is to measure humidity absolute humidity and relative humidity. The former is the density of water vapor in the atmosphere, which gives out the specific content of moisture in the air. The latter is in the air vapor pressure and the percentage of the saturated vapor pressure, which give out air degree of humidity. According to different devices, the humidity sensor can be divided into two major categories of the resistive one and the capacitive one. Humidity is an important environmental parameters index, and humidity sensors are widely used in greenhouses and livestock and poultry breeding places to monitor humidity.

Light Intensity Sensor.
Light intensity sensor is part of the photoelectric sensor, which can take advantage of the component of the photoelectric effect to convert light flux into electricity. Light is closely related to the physiological cycle regulation of livestock and poultry, so the light sensor is widely used in the field of monitoring and control of agricultural production.

Harmful Gas Transducer.
Gas sensor is a type of sensor that can convert gas concentration measurement to the amount of voltage or electric flow by single chip microprocessor collecting. According to the different principle, gas sensor can be divided into semiconductor gas sensors, electrochemical gas sensor and infrared gas sensor, and so forth. Semiconductor gas sensor takes advantage of high sensitivity, fast response speed, good maintainability, and low cost; however, it only can measure the existence of the harmful gas, which means we cannot get the accurate concentration of harmful gas. Electrochemical sensor takes advantage in the field of high precision, low concentration of toxic gas, organic vapor, alcohol gas, and oxygen. Infrared gas sensors are suitable for monitoring various inflammable and explosive gases, carbon dioxide; it has high accuracy, good selectivity, high reliability, and no poisoning, is not dependent on the oxygen, has less interference by environmental factors, long life, and other significant advantages.
The common using sensor of harmful gas is used for monitoring of toxic gas such as ammonia, hydrogen sulfide, and carbon dioxide sensor sensors. Most of toxic gas sensors are the electrochemical gas sensors; carbon dioxide sensor belongs to the infrared gas sensor. Harmful gases will directly affect the quality of growth and livestock and poultry products; thus most of harmful gas sensors are used in livestock and poultry breeding environment intelligent control field. (WSN) is a new type of information awareness and network system of collection. It can obtain all kinds of detailed and accurate target data information at any time, any place, and any environment too.

Wireless Sensor Network. Wireless sensor network
These tiny sensors have the characteristics of low cost and low power consumption, and some of the microsensors inside also integrate the function of information collection and wireless communication. Wireless sensor network is made up with plenty of these types of sensor nodes in the wireless self-organizing network system. These sensor nodes are distributed in a specified area. Through wireless communication and self-organized manner forming multihop network, various environmental information can be gotten by sense in target area or target individual information, and it will send data to the specific port.
Considered concrete environment in the poultry house, we used wireless sensor network (WSN) to replace the traditional wired networks. Each sensor node was equipped with ZigBee module, which can complete a certain range of house data communication interaction. The center node in a wireless network was equipped with GPRS module, which can send the data via mobile communication network to the backend server.

The Environment Parameters Control Algorithm
The Internet of Things (IoT) of agriculture information perception front is usually equipped with multiple sensors, so the multisensor information fusion technology has been widely applied in agriculture information processing. At the same time, the Internet of Things of agriculture is a highly important branch in the field of intelligent agriculture. Intelligent algorithm and intelligent control techniques are also the key point of research [15][16][17][18].

Multisensor Fusion and WLS Algorithm.
There are multiple same type sensors in the livestock house, in order to increase the information content of perception system. Through proper processing method, it can use the redundant information, improve precision of the system of information awareness, and improve the anti-interference ability of information acquisition system and fault tolerance ability. As shown in Figure 1, assume that each sensor data set obtained by each sensor is expressed by a direction vector line. Due to the existence of the system measurement error, when there are two or more sensors' vector line, multiple measurements will not be necessary to the intersection point, but what is clear is that the real sensors' target information real aim is in the vector line of a few areas.
Aiming at this kind of situation, we can get the estimates of the sensory information. It can be applied in the field of multisensor data fusion algorithm; specific algorithm is as follows. Set as the number of sensor subsets; is the real value of the first group subset data; is measurement error of the first group subset data; then the system state equation is (2) ( = 1, 2, . . . , ) is unit matrix whose dimensions are the same as .
Set as × order matrix and is dimension of target position vector ; then Therefore, WLS algorithm can be used to complete a data fusion, and its error covariance is, respectively,

The Minimizing Deviation Criteria of Environment
Parameters Control. The control of temperature and humidity has been a significant problem. Many people attempt to find out an accurate and efficient way to control temperature and humidity. In order to solve this problem, a useful method will give us some inspiration. Environment parameters influence each other nonlinearly so that they cannot be adjusted separately. Set and as standard values and measured values of the monitoring parameters. Define the minimizing deviation criteria of environment parameters control for If tends to be the minimum, the control algorithm works. In practice, usually set the temperature and humidity as a group, and set the gas as the other group.

Environment Control System
Framework. Livestock and poultry breeding environment intelligent control system can obtain the environment information such as temperature, humidity, light intensity, and harmful gas concentration (carbon dioxide, ammonia, hydrogen sulfide, and so on) through a variety of sensors and pass the monitoring information to the main control node through the wireless sensing network, The master node can realize the communication in a certain range and send the monitoring data to the remote server on time. Through the intelligent algorithm, the server carries on the comprehensive to the data, while it completes the control of temperature and humidity combined with linkage harmful gas concentration by the nonlinear algorithm processing. The server will ask devices to open or close fans, wet curtains, electric lights, and so on. The schematic diagram of the system is shown in Figure 2.
As shown in Figure 3, the project team realized 3 sensor nodes based on the system design shown in Figure 2. Each node has six types of sensors, including ammonia gas sensor, hydrogen sulfide sensor, illumination sensor, temperature and relative humidity sensor, and carbon dioxide sensor. Due to the condition being worse, the power can be offered by 220 V alternating current or battery packs. What is more, to keep working normally under the high-humidity condition, a layer of waterproof coating is covered on circuit boards and sensors.

The Experiment and the
Results. Based on the system design shown in Figure 2, two sets of system are finished. Each system contains three sensor nodes. Each node has six kinds of sensors, which include temperature and humidity sensor, ammonia sensor, hydrogen sulfide sensor, carbon dioxide sensor, and light sensor. But one has a system which has a device to control the environment of livestock and poultry; the other does not.

The Location of Experience.
In August 2015, a system was tested in certain livestock and poultry houses in Heilongjiang Province, China. Every house is a north-south direction, and each one is 100 meters long and 15 meters wide, the distance of the interfacing houses is 35 meters, and double sides are fence. The number of cattle in the house is around 150. Windows and doors are installed on the north and south of both side walls. It has the effect of ventilation and lighting.

The Method of Monitoring.
In this experiment, the test happened in August; the outdoor temperature was at about 25 degrees. As shown in Figure 4, black dots are the location where the set of the system that contains three sensor nodes was fixed. Node 1 was installed on the right of the door at the height of 1.5 meters; Node 2 was installed in the central house on the wall at the height of 2 meters; and Node 3 was installed on the southern wall at the height of 1.5 meters. Assume that the environmental parameters of two interfacing houses are the same, and there is not any difference. Define that System 1 is the system which does not include a control device and System 2 is the system which includes a control device.
The experiment has continued for 4 hours; the interval time of data uploaded by nodes is ten minute, because the livestock and poultry house are big; the environment could not response instantly. First of all, two sets of systems turned on the monitoring device at the same time. One hour later, turn on the controlling device of System 2. The monitoring and controlling of environment continued for 3 hours (the network transmission protocol is the TCP, and the interval of data upload is longer, so the byte loss in the transmission error was negligible).

The Analysis of Results.
After the four-hour experience, the concentration of carbon dioxide, hydrogen sulfide, and ammonia content is relatively normal, because of the good ventilation condition. It hardly exceeded the maximum critical value which affects the growth of the cattle. This paper does not focus on the environmental concentrations of gas.
The optimal conditions of the growth are that the temperature is 21-25 ∘ C and the relative humidity is 65%-80%. At that time, it is a hot and recent rainy day. The environment indoor has been greatly affected. In Figure 5, it practically shows the environmental parameters of temperature and humidity in the experience with System 1, the temperature rose with the air temperature, and there is still a rising trend which is clearly over the cattle growth conditions. At the same time, as Figure 6 in the interfacing houses, according to one-hour data receiving and analysis, the temperature and humidity effect in the later three hours is more significant. Sometimes it still has surpassed from the temperature and humidity of the environment standard. Compared with the group without control, the effect is very significant.

Discusses.
As livestock and poultry house scale up and feeding density and the degree of refinement are much bigger than before, the demand for environmental factors in the breeding process is also growing rapidly. In this paper, a set of intelligent monitoring system for the environmental parameters of livestock buildings was realized based on wireless sensor network. It could monitor real-time environmental parameters in livestock building, such as carbon dioxide and hydrogen sulfide. And it also has other functions, like threshold alarm and historical data query.
In the future work, we will carry on further research on the data fusion and other data processing and improve the level of system performance. Also, in order to get the better control result, how to assign weights for deviation of each environment parameter should be studied.