Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Organizer:

  China Breeding Pig Information Network & Editorial Department of “Swine Industry Science”

  Information Technology Branch of China Animal Husbandry and Veterinary Medicine Association

Special Support:

  Muyuan Food Co., Ltd.

Co-Organizer:

  Shanghai Casu Biotechnology Co., Ltd.

Co-Sponsors:

  Tianjin Modern Tianjiao Agricultural Technology Co., Ltd.

  BEAGRO

  Henan Hengyin Automation Technology Co., Ltd.

  Wuxi Fuhua Technology Co., Ltd.

  Fangfei Biotechnology (Beijing) Co., Ltd.

  Shanghai Xiangxin Livestock Co., Ltd.

  Weilong Yashike International Pharmaceutical Group

  Jinan York Agricultural Machinery Co., Ltd.

  Chengdu Yinfukesi Technology Co., Ltd.

  Tianjin Dahong Hengxiang Machinery Co., Ltd.

  Henan Longgang Technology Co., Ltd.

  Henan Zhengben Qingyuan Technology Development Co., Ltd.

  Guangzhou Yitaike Technology Co., Ltd.

  Ningbo Pioneer Central Heating Technology Co., Ltd.

  Shenzhen Xinzhuan Agricultural Technology Co., Ltd.

  Warm Hydrogen (Zhejiang) New Material Manufacturing Co., Ltd.

  Anhui Ruibai Chuangwu Internet of Things Technology Co., Ltd.

  Qingdao Jizhuwu Livestock Equipment Co., Ltd.

  Shanghai Humu Information Technology Co., Ltd.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

SWINE INDUSTRY SCIENCE

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Abstract

/

Promoting the pig industry towards intensification, automation, and intelligence has been one of the biggest characteristics of agricultural development in China over the past decade. Currently, more and more farms are willing to adopt precision feeding technology to reduce feed-to-weight ratio and minimize feed waste. Therefore, how to accurately control or monitor the feed intake of pigs is a very important issue. With the development of measurement technology, scholars in China have innovatively developed a new type of electronic compass by combining infrared distance measurement with a compass, aiming to autonomously measure the diameter of a circle as the primary goal and extend outward, using the infrared distance measurement function to detect the distance between two feet. Research shows that using infrared sensors to construct a detection system can effectively and inexpensively solve the problem of real-time monitoring of feed residual amounts, which is of positive significance for improving the level of pig breeding in China. The software designed in this paper is mainly for detecting the remaining amount of feed and will save the data entered in the app in an internal database for easy viewing at any time. Additionally, the program design within the software enables communication with the Bafayun cloud server.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Promoting the pig industry towards intensification, automation, and intelligence has been one of the biggest characteristics of agricultural development in China over the past decade. Currently, more and more farms are willing to adopt precision feeding technology to reduce feed-to-weight ratio and minimize feed waste. Therefore, how to accurately control or monitor the feed intake of pigs is a very important issue. Research shows that using infrared sensors to construct a detection system can effectively and inexpensively solve the problem of real-time monitoring of feed residual amounts, which is of positive significance for improving the level of pig breeding in China.

With the development of measurement technology, scholars in China have innovatively developed a new type of electronic compass by combining infrared distance measurement with a compass, aiming to autonomously measure the diameter of a circle as the primary goal and extend outward. There are also scholars who have combined infrared distance sensors with computer image processing technology to propose a non-contact method for measuring the depth information of fruit trees, enabling robots to quickly recognize and locate fruit trees. Furthermore, some scholars have used infrared distance sensors as components, adopting a non-contact measurement method to capture geometric information of the human body surface, designing an infrared body leg circumference measurement system. It is evident that infrared technology can be effectively used for distance measurement and positioning, and it can also be applied in the feed field.

1

Overall System Design

The granular feed monitoring system’s core control chip is Arduino UNO, with external modules including Esp8226 wireless communication module, infrared sensor GP2D12 integrated module, servo motor module, and a 7.4V lithium battery. Instructions are given to the main control via a mobile phone, utilizing a cloud server to complete the closed-loop signal transmission.

The framework of the granular feed monitoring system is shown in Figure 1.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Figure 1 Structure diagram of the data acquisition system

1.1 Introduction to Main Modules

In this design, the overall system uses Arduino as the core control, with external Esp8226 wireless communication module, infrared sensor GP2D12 integrated module, high-torque servo motor module, and 7.4V lithium battery, etc. Below is a brief overview of each module.

1.1.1 Wireless Module

The Esp8266 series wireless module is an economical and efficient WiFi SOC module that supports the standard IEEE802.11b/g/n protocols and has a complete TCP/IP protocol stack built-in. Users can use this series of modules to add networking capabilities to existing devices or build independent network controllers.

The Esp8266 is a low-power UART-WiFi transparent transmission module with competitive packaging size and ultra-low power consumption technology, designed specifically for mobile devices and IoT applications, allowing users’ physical devices to connect to Wi-Fi wireless networks for internet or local area network communication and achieve networking functionality.

1.1.2 Processor Module

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It has various types of interfaces and can use USB interfaces to upload programs. Its advantages include the characteristics of AVR microcontrollers, cross-platform compatibility, and the Arduino software (IDE) running on Windows, Macintosh OSX, and Linux operating systems. The simple and clear programming environment makes Arduino software (IDE) easy to operate for beginners. The strong openness and extensible software of Arduino is released as an open-source tool for experienced programmers to expand.

1.1.3 Infrared Monitoring Module

The main principle of infrared distance measurement is to use the intensity of light reflection to determine distance, featuring high accuracy, low consumption, small size, and resistance to interference. It consists of an infrared emitting tube, a position-sensitive detection device, and corresponding computing circuits. The position-sensitive detection device can measure slight displacements of the light spot on it, using this characteristic for geometric distance measurement.

1.1.4 Battery Module

The entire system can generally be powered directly by connecting the development board with a USB data cable or through an external independent power source. This experiment uses a rechargeable soft-pack lithium battery with a voltage output of 7.4V, a capacity of 1500mAh, and a charging cut-off voltage of 8.4V.

1.2 Solutions and Design for Various Issues

1.2.1 Infrared Monitoring Module

The surface of the feed in the feed barrel or feed pan is uneven. Four infrared sensors are placed at four symmetrical points, and the average of the heights collected by the four sensors is used to replace the actual height of the plane. The completed design of the feed barrel’s internal and external structure is shown in Figure 2.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Figure 2 Completed design diagram of the feed barrel’s internal and external structure

For the GP2D12 sensor, two issues need to be resolved in data processing: (1) signal linearization; (2) the measurement data has significant noise, meaning that the error data content is relatively high.

The infrared module mentioned above experiences certain fluctuations during measurement. To filter out reasonable data, it is necessary to utilize data from a specific time interval during the measurement process for reasonable elimination and filtering. The GP2D12 infrared sensor module outputs an analog voltage value, and its value does not present a linear relationship with distance. By using the linearization equation obtained through the least squares fitting method, a program can be written to ensure that the feedback height presents a linear relationship. Data collected over a specific time period is filtered using the improved Shouvine algorithm to eliminate noise.

1.2.2 Communication Program Design between Arduino Board and Esp8226

The connection between Arduino UNO and Esp8226 primarily relies on D2 and D3 as the soft serial RX and TX set for Arduino, allowing communication through the built-in library functions once connected (Figure 3).

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Figure 3 Connection interface indication diagram

1.2.3 Server Part (Bafayun)

The Bafayun IoT platform adopts a front-end and back-end separation design philosophy, belonging to a lightweight and simplified IoT terminal server. It supports publish and subscribe modes, enabling one-to-many, many-to-one, or many-to-many message transmission.

Using the publish-subscribe model, the Esp8266 subscribes to a topic, and then the app written in App Inventor publishes messages to this topic. Since the Esp8266 subscribed to this topic, it can receive messages published by the app, thereby executing corresponding actions. The principle steps are as follows:

First, let the Esp8226 module subscribe to the topic of this server;

Second, read the feedback value from GP2D12;

Third, the internal data exchange can occur within the same subscribed topic, and the program on the mobile App Inventor must also subscribe to the same topic. Finally, all three can achieve message transmission.

1.2.4 Client Software Design

App Inventor is a software for developing Android smartphone applications using a graphical interface, allowing the creation of applications based on the Android operating system. It uses a graphical interface similar to Scratch language and Star Logo TNG user interface. Users can drag and drop graphical objects to create an application that runs on Android systems, which can operate on many mobile devices.

The software designed in this paper is mainly for detecting the remaining amount of feed, and it will save the data entered in the app in an internal database for easy viewing at any time. Additionally, the program design within the software enables communication with the Bafayun cloud server. The specific design steps are: (1) set the mobile client and Bafayun to subscribe to the same topic through program settings; (2) provide feedback and real-time display of the returned data. The feed residual feedback function part software demonstration is shown in Figure 4.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Figure 4 Example diagram of App Inventor completed product

2

Infrared Testing Frequency and Data Filtering Processing

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

3

Experimental Results

3.1 Data Processing

The data received from a single infrared sensor in the monitoring system fluctuates due to the instrument itself, especially during changes in feed. To accurately capture the feedback amount, a time interval of 20 ms is assumed, meaning that 50 tests per second are conducted for the same height of feed, taking 100 tests at the same time point to evaluate the actual filtering effect. Since the processed feedback distance values are integers, the distance values obtained are all whole numbers, and the first round of filtering results are shown in Table 1.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

3.2 Data Curve Fitting of Residual Feed

After linearizing the distance measurement of the infrared distance measurement module itself, it can be confirmed that the measurement results are close to linear. Subsequently, linear regression experiments can be conducted using the obtained data to fit the actual relationship between the remaining feed amount and distance.

Taking the starting point of the experiment as when the feed poured into the barrel no longer leaks out, 700 g of pig feed was poured each time as a gradient, with a total of 7 experiments conducted. Each experiment began by pouring feed along the instrument’s pipeline, causing the feed to pile up in the barrel. The data from the four different sensors were read at this time, and the average value was taken. To obtain the actual height, a tool was used to level the feed in the barrel, and then a long ruler was inserted vertically into the barrel to measure the distance from the surface of the feed to the top of the barrel. The data results are shown in Table 5.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

3.3 Error Degree of Height Measurement with a Single Sensor

For an actual measurement height of 271 mm, the experiment used a single infrared sensor to conduct 10 repeated experiments, obtaining 10 returned data (Table 7). The overall sample size is 10, which is less than 30, and the obtained random data showed normal distribution in the experiment, satisfying the conditions for using t-test. The obtained data were input into Excel for single-sample t-test, resulting in Table 8.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Substituting the data yields Table 9.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

3.4 Error Degree of Average Height Values from Multiple Sensors Compared to Actual Values

Using the experimental data above, the error degree between multiple sensors and actual values is compared. The above experiments also demonstrate that the data obtained from a single sensor measurement exhibits stability. The returned values obtained after ensuring the instrument’s stability are representative and can be compared with actual values.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed
Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

4

Conclusion

(1) For the issue of significant noise in the infrared sensing part, the Shouvine algorithm was utilized to control the data within a reasonable range. Finally, for the same height, 10 repeated measurements were conducted to obtain the repeated experimental results, measuring the error degree controlled by the algorithm. According to the above tables (Table 1-Table 14), the maximum relative error was 1.845%, and the coefficient of variation was 3.306%, indicating that the feedback accuracy of a single sensor is no less than 98%. The differences between the filtered data and actual values are minimal, demonstrating high stability.

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

This article is sourced from: “Swine Industry Science”, Volume 39, Issue 10, 2022

Research on Non-Contact Detection Technology of Residual Amount in Pig Granular Feed

Proofreading│Huang Haitao

Typesetting│Huang Haitao

Review│Zhen Mengying

Leave a Comment