A Low-power Environmental Supervision System Suitable for Livestock and Poultry Breeding

: This paper is a kind of low power consumption environment suitable for livestock and poultry breeding regulation system, the system consists of livestock breeding related sensors, actuators, control equipment, LoRa gateway and control web parts, when the environment, carbon dioxide, carbon monoxide, methane, ammonia gas and hydrogen sulfide harmful gas concentration over the threshold will alarm and the system will take corresponding measures to ensure the production efficiency of animal husbandry and food safety, and reduce the incidence of livestock and poultry disease and environmental pollution.


Foreword
China is a major country in animal husbandry and one of the largest aquaculture producers in the world.Its scale and types of aquaculture are among the top in the world.In 2023,16.82 billion poultry were produced, an increase of 690 million or 4.2% over the previous year, the poultry production was 25.63 million tons, an increase of 1.2 million tons or 4.9%; and the egg output was 35.63 million tons, an increase of 1.07 million tons or 3.1% [1].In livestock, livestock house animal excrement and feed organic chemical reaction and produce a variety of chemical substances, such as increase the gas such as carbon dioxide, such as ammonia, hydrogen sulfide, carbon monoxide, such as harmful ingredients, these complex components may harm livestock and poultry and farmers health, more even cause acute or chronic poisoning [2] Therefore, livestock and poultry environmental monitoring occupies an important position in the production process of livestock and poultry industry.

System Structure and Principle
A low-power environmental supervision system suitable for livestock and poultry breeding consists of three parts: environmental monitoring node, LoRa gateway and cloud dynamic monitoring platform.The overall architecture is shown in Figure 1.The monitoring node is responsible for collecting the sensor data and transmitting it to the gateway via the LoRaMac protocol.After the gateway receives the LoRa signal, it transmits the node data to the server through the Internet network to realize the transformation from the LoRa signal to the network data storage [3].The server receives the data, and then the web and APP finally receive and displays the data.The system adopts LoRa low power wide area network (Low Power Wide Area Network, LPWAN) technology, which is a revolutionary new wireless access technology of the Internet of Things.The system is based on a LPWAN communication technology, which can realize low power consumption over long distance wireless transmission [4]

System Block Diagram
The overall structure diagram of a low-power environmental supervision system suitable for livestock and poultry breeding is shown in Figure 1.

Hardware Selection
The MCU control module was selected for the STM 22L151CBUxA chip based on the ARM architecture.The chip is small in size and powerful in performance, with multiple timer, USART interface, IIC interface, SPI interface, ADC channel, DAC channel, DMA channel and other peripheral resources, which can fully meet the needs of this design.
After sensor, HTU21D temperature and humidity sensor, BH1750 light sensor, MQ-127 ammonia sensor, MQ-4 methane sensor and CCS811 carbon dioxide sensor.Power supply circuit design: The power supply management module adopts BQ25570 equipment.BQ25570 Is an ultra-low power energy collection and management integrated circuit, specially designed to collect micro energy from environmental energy sources such as solar energy, thermal energy and vibration.The battery management function ensures that the rechargeable battery is not overcharged by this extraction power, voltage increase, or is depleted by the system load beyond the safety limit.In addition to the efficient supercharger bq25570 integrates an efficient nanopower buck converter.Sensor circuit design: In the terminal children of the monitoring system, HTU21D temperature and humidity sensor and BH1750 light sensor both communicate with MCU by using IIC bus interface.IIC (Inter-Integrated Circuit) communication protocol is a serial communication protocol for multi-master devices, using two signal lines (SDA and SCL) to achieve two-way data transmission, and to identify each device through a unique 7-bit address.The IIC protocol supports standard mode (100 kbps), fast mode (400 kbps), and high speed mode (2.4 Mbps), while using a clock stretching mechanism to allow transmission speed control from the device [5].The IIC communication protocol has the advantages of simple structure, suitable for multi-device connection and fast transmission speed, so the IIC bus interface is selected to communicate with the sensor in this monitoring system.

Software Program Design
Environmental parameter acquisition programming: Figure 5 of the software design of the environmental monitoring node of the system is shown.After the system is energized, the environmental monitoring node starts to initialize the drive of each device, and then starts the network access monitoring.If the network access is successful, it enters the task configuration stage to collect environmental information.After collecting the data, the data is packaged into a consortium form and sent to LoRa gateway in a x way.After sending, the node is in hibernation mode, and the program is terminated.
In the collection of environmental parameters, each environmental parameter was taken as a group of 10 times, and 6 sets of data were obtained.The median average filtering process of the acquired data was performed.After processing, the 16-bit data were divided into four digits, filled into the corresponding array, and sent in a consortium form.
Low power programming of environmental monitoring node: after the system is powered on, the program starts, sensors and other peripheral hardware and chip hardware are initialized, request LoRa to enter the network, then enter hibernation mode, and wake up when there is an interruption.Interruption is divided into LoRa communication baseband wake up and RTC alarm clock wake up, which are the same priority.The program uses a linked table data structure for multiplexing the RTC, virtual it into multiple timers.The end uses a link table to store the handle and interrupt service functions for each virtual timer.The program innovation uses the link table data structure for the multiplexing operation of RTC, making it virtual into the operation of multiple timers, used to replace the traditional timer in the single chip machine, so that the dormant power consumption of the whole system is reduced to a low level.

Human-computer Interaction Design
Based on human-computer interaction design, this system is based on the Web developed web control interface, aiming to provide convenient PC and mobile terminal viewing experience, and expand the user's access mode through WeChat small program.In terms of functions, we use the embedded real-time operation to reasonably schedule the gateway function tasks, optimize the gateway performance, improve the CPU utilization, and reduce the application development workload.At the same time, functions such as user permission setting, environmental data graphical processing and analysis, and intelligent management are added to improve the efficiency and convenience of unit scheduling, and enhance the maintainability of the system and the convenience of later update.

Early-warning Design Combined with Big Data
The system combines the big data to design the network server, and integrates the crop area management, equipment management, action management, alarm management, data query and other functions.This allows the data to be visualized and supports equipment, crop area customization and other functions.At the same time, combined with the AI platform, a complete hardware and software ecosystem.The crop area management interface realizes fine management, the equipment management interface simplifies the operation difficulty, the action management interface can manage the automatic operation threshold of the equipment, and the alarm management interface can realize automatic management.

Conclusion
According to the needs of livestock and poultry industry, this paper designs and completes a set of environmental supervision and management system for livestock and poultry industry, which can realize the monitoring of temperature, humidity, carbon dioxide concentration, organic volatile concentration, ammonia concentration and methane concentration in the air inside livestock and poultry house.The device has the characteristics of convenient plug and play installation, highly integrated sensor monitoring parameters, low power consumption and long running time.It provides a set of effective management system for the intelligent technology development of livestock and poultry breeding industry.The specific work completed in this article is as follows: (1) Analysis of environmental factors within the house, in view of the problems of livestock and poultry breeding, through the combination of single-chip computer technology, 3D printing technology, LoRaWAN communication protocol and large data analysis, designed a livestock and poultry industry management system based on LoRaWAN, implements the environmental parameters from breeding house collected to remote view and control the corresponding equipment to adjust function.
(2) Using PCB plate-making technology, multiple sensors are integrated into a PCB board to realize the integration of environmental parameter monitoring.The low power algorithm and low power circuit are designed to reduce the node power consumption and extend the node running time.
(3) Field test of the overall system.LoRa network test shows that within the radius of 3km, the information packet loss rate is less than 3%, and the error rate is 0, which can ensure the security and stability of information transmission.It can be seen that the communication quality and coverage meet the actual needs of livestock and poultry breeding industry users, and help the scientific and intelligent development of livestock and poultry breeding industry.

Figure 1 .
Figure 1.Overall structure of the livestock and poultry breeding industry management system .

Figure 2 .
Figure 2. System circuit design diagram

Figure 3 .
Figure 3. Power supply circuit design diagram

Figure 4 .
Figure 4. IIC communication display diagram Communication module circuit design: Communication module adopts Lo R a module WT-LoRa01 can be used for ultra-long distance spread frequency communication, and compatible with FSK remote modulation and demodulation technology, LoRa module WT-LoRa01 uses SX1278 chip, with high sensitivity (-148 dBm), high power output (+ 20 dBm), strong anti-interference and low power consumption, which is suitable for long-distance transmission and low power communication scenarios.It has 16 IO ports, three GND grounding pins, and four SPI signal interfaces: SCK, MISO, MOSI and NSS.And a RESET reset interface, and six digital signal DIO interfaces.3.1.3.Software Program DesignEnvironmental parameter acquisition programming: Figure5of the software design of the environmental monitoring node of the system is shown.

Figure 5 .
Figure 5. Flowchart of the environmental monitoring node program