Research on a Low-Cost, Open-Source, and Remote Monitoring Data Collector to Predict Livestock’s Habits Based on Location and Auditory Information: A Case Study from Vietnam

: The supervision and feeding of grazing livestock are always di ﬃ cult missions. Since animals act based on habits, the real-time monitoring data logger has become an indispensable instrument to assist farmers in recognizing the status of livestock. Position-tracked and acoustic monitoring have become commonplace as two of the best methods to characterize feeding performance in ruminants. Previously, the existing methods were limited to desktop computers and lacked a sound-collecting function. These restrictions impacted the late interventions from feeders and required a large-sized data memory. In this work, an open-source framework for a data collector that autonomously captures the health information of farm animals is introduced. In this portable hardware, a Wireless Location Acoustic Sensing System (WiLASS) is integrated to infer the health status through the activities and abnormal phenomena of farming livestock via chew–bite sound identiﬁcation.


Introduction
The Internet of Things (IoT) is one of the characteristics of the fourth industrial revolution. The agents (e.g., machines, devices, and so on) are associated with the Internet in order to share information for different applications. This technology allows the activation of data acquisition, fusion and processing, intelligent identification, and management. IoT broadly appears in smart cities [1], intelligent manufacturing [2], healthcare [3], transportation [4], logistics management [5], air pollution [6], robot path-planning [7], product traceability [8], and parking systems [9]. Thanks to these important achievements, human beings can enjoy high-quality and comfortable daily lives.
Recent advances in the techniques of sensing devices, measuring instruments, and transceivers have led to significant progress in both industry and agriculture. Most of the common issues revolve around the industrial fields, which output many solid wastes and destroy environmental conditions. However, there is a lack of research focusing on breeding or farming. In the past, farming primarily relied on human observations and natural habits; as such, data collection from farms might not have been done carefully, or else was done imprecisely by hand-writing. The growth of animals is conditional on climate change, food resources, farm facilities, and the intelligence of the farmers themselves-but there is no definitive understanding of animals' growth cycles or breeding plans. However, in light of the introduction of online data gathering techniques, this situation can be altered by utilizing IoT-based systems. Indeed, in many ways, it is recognized that there is a great potential for transformation by applying IoT concepts to rustic districts in order to both gain a better acknowledgement of the native atmosphere and to intervene in such environments via artificial actions. Employing such technology poses new challenges, offers potential opportunities, and indicates a bright future ahead.
Even with the progress achieved in electronics, the use of wireless networks and integrated sensors in small-scale data acquisition still requires more attention from researchers. In particular, data on the surrounding parameters or living habits need to be gathered in order to anticipate future requirements in agriculture. Different datasets have been built and fused in conjunction with information from cameras, Light Detection And Ranging (LiDAR), Inertial Measurement Unit (IMU), Global Navigation Satellite System (GNSS), and radar to detect an object in the field [10], with double collector solar devices to improve agricultural products [11], with AgriLogger in areas lacking networks [12], and with the integration of farming data and statistical modeling to interpret field-scale productivity [13]. The popular characteristics of previous developments include keeping under surveillance the static target in a fixed location and involving a technical expert. The fusion of complex techniques is only well-qualified for academic research. Additionally, the absence of appropriate attention on breeding could harm the security of the food chain. Thankfully, there exists numerous investigations on farm animals to protect the breeding process. For instance, Long Range (LoRa) based IoT architecture with collision avoidance for continuous livestock monitoring has been implemented [14]. Owing to its resilient transmission, wide coverage, and long-lasting battery lifespan, the use of this architecture makes it possible to manage a large number of clients with a single gateway, as well as to reduce the number of necessary data retransmissions and the power consumption. Related not to animal but to location technology, tracking solutions are typical for precision livestock farming. A low-cost IoT-based system to identify the position of a whole herd has been enabled [15]. The collar/tag ratio that defines the cost per animal should be low for a whole sheep herd and high for beef cows, and the results are valuable for the initial finance to select the tracking method. Above all, data collection plays a principal role in real-time supervisory work. In huge grassland, signal transmission and analysis accommodate the gathering activities and status information of livestock. A momentum data collector to gain and transfer information regarding the ecological status and situations during grazing has been newly Agriculture 2020, 10, 180 3 of 26 suggested [16]. However, using this collector, only one parameter-e.g., location-is transmitted for one target cow.
In some nations, the application of these technologies is usually limited, although some solutions are available on the market. Since their investments are high and they require frequent maintenance, small-and medium-sized farms do not have the necessary capabilities; in such contexts, open-source hardware could be an alternative selection. Such open-source software offers a novel platform in agronomy for open farms because of their small and marginal investments. The most common hardware include Raspberry Pi (RPi) and Arduino. While Arduino permits the user to program C/C++ language for interactive design, RPi promotes Python and Scratch as the main languages. RPi pays particular attention to basic computer science, education, home automation, or industrial automation, whilst it reserves restricted support in agriculture [17]. Reversely, Arduino has been utilized for great ranges of open applications, for instance, collecting environmental parameters [18], data mining [19], automated watering systems [20], IoT-based platforms [21,22], or information monitoring systems [23]. Therefore, the implementation of open hardware has become an inevitable trend and a crucial responsibility for the developing market.
The main aims of this paper are to (i) introduce a do-it-yourself hardware of supervisory system, (ii) guide farmers to design by open software, (iii) experiment on cattle under North Vietnam's conditions, and (iv) provide a good look at data collection methods with some valuable discussions. The rest of this paper is structured as follows. Section 2 synthesizes previous works to address the key points in open-source farming systems. Section 3 introduces our ideas to overcome the existing drawbacks in both hardware and software design. From the proposed development, Section 4 describes the experimental results to validate the feasibility, effectiveness, and correctness of our design. In Section 5, discussions about practical experiences in open platforms, as well as acoustic feature extraction, are demonstrated. Finally, Section 6 presents some conclusions.

Literature Review
Precise agriculture or smart farming is one of the key terms in our era. This method provides higher productivity and better usage of natural resources compared to previous methods. Research groups and scientific institutions, as well as industry, race to deliver more and more IoT products to agricultural business stakeholders. Cloud Computing and Fog Computing afford sufficient resources and solutions to sustain, store, and examine the vast amount of data generated by IoT devices [24,25]. The management and synthesis of IoT data can be used to automate processes, to guess situations, and to improve many activities. Moreover, the concept of interoperability among various devices has inspired the creation of the right tools, which allow new applications and services to be developed, as well as give an added value to data flows. The agricultural field is likely to be highly affected by wireless sensor network (WSN) technologies, which are expected to be significantly benefited by IoT [26]. It was discovered that most of research [25] is still concentrated on monitoring applications (62%), while there is a growing interest in closing control loops (25%), and the rest is focused on logistics and supply chains (13%).

IoT Node-Based Scheme
In the milieu of smart cities, a novel typology of IoT-based sensor nodes, based on the usage of low-cost and low-power components, was illustrated in [27]. This node was supplied with a single-chip that is able to measure the filling level of trash bins. A minimal network architecture of LoRa low-power wide-area network (LPWAN) technology focused on energy-saving technologies and policies. Reversely, the adaptive protocols modified the sampling rate according to the variation rate of the filling level of the trash bin, as well as the transmission policies. The energy consumption of wearable sensor nodes has become a crucial issue for fall detection system [28]. Falls can cause serious trauma, such as brain injuries and bone fractures, especially among elderly people. The design of tiny, lightweight, flexible, and power-efficient devices has been denoted, together with a comprehensive investigation of energy Agriculture 2020, 10, 180 4 of 26 saving, in different configurations. Associated with medical guidelines, this report did not indicate the medicinal constraints along with the tests of reliability. In livestock building, the environmental parameters also involve the product quality and the welfare of the animals [29]. A list of the parameters, i.e., temperature, humidity, light, carbon dioxide concentration, ammonia concentration, and hydrogen sulfide, is monitored to save labor costs and energy consumption. Nonetheless, to record in real-time, these six parameters need more Random Access Memory (RAM) memory and thus burden the computation to process.
Recently, advances in the IoT paradigm have promoted the use of wireless sensor networks for precision farming. Many technological developments suggest that the use of nanotechnology has immense potential to further improve farming productivity. In [30], the conceptualization of IoT was firstly discussed for use in applications of dairy farming. Four aspects, i.e., grass monitoring, animal health, field conditions, and reducing resistance to antibiotics, meet a lot of challenges. For instance, the troubles in the design of nano-devices, the communication inside nano-networks, and the interfaces with current internet protocols may collar our efforts. Not for whole networks, but rather for specific sensing units, an energy-saving method utilizing sensor nodes has been introduced [31]. Instead of frequent data transmission, an event-driven communication protocol for lessening the battery consumption issue has been demonstrated. At certain intervals, data collection is only completed to diminish traffic communication if an event happens. Otherwise, the sleep intervals should be variably attuned. This result was individually simulated in MATLAB, and has not yet undergone experimentation. In terms of a more academic approach, a vector-based spring network model to localize nodes has been described [32]. A sub-three accuracy meter for a three-dimensional positioning environment has been established to evaluate the behavior of tracked animals based on positioning information. With a large number of livestock animals, the difficulties in mass production of these instruments should be taken into account.

Livestock Monitoring
Farming is a vigorous part of the national economy, and it is likely to remain as such, since nutrition needs continue to rise dramatically with the growth of the world population. In order to expand profitability and efficiency, connected solutions for livestock monitoring are flooding the market. Nonetheless, some important challenges still remain to be addressed before widespread adoption can take place. According to the United Nations [33], the global population represents approximately 7.6 billion people and is projected to grow to 8.6 billion people in 2030, and 9.8 billion people in 2050. Not only do food needs keep growing, but so does the per capita consumption of dairy products. To accommodate future needs, securing the productivity and cost-effectiveness of existing farms is required. Currently, key differences in productivity occur between food producers around the globe. Therefore, it is a well-known solution to improve animals' health and productivity, rather than to increase animal numbers. To help workers face these trials, connected solutions in their farms might play a vital role. Comparable in many other verticals, IoT has initially spread into the agriculture and dairy farming industry, and mainly aims to supervise the well-being of animals, thus enhancing the profitability of farms by increasing productivity. The huge majority of connected livestock solutions are investigated for cattle, especially cows, which is reasonable because of the valuable price of such animals. The connected progress of livestock, as well as that of humans, depends on the miniaturization of battery-consumed technology, network communication, and data analysis. In recent years, an open trend of electronics skeletons brings the many advantages of smaller, cheaper, and more precise devices [18]. These techniques do not require professional skills or experts to be deployed.

of 26
A platform of real-time data collection in [16,34] was developed for large grassland or mountainous areas. Although data of the ecological status and situations of livestock during grazing have been transferred, some limitations still exist in this system. Covering signals cannot be certified if the power of the solar panels is not enough or is empty. Especially, in the bad weather or at sunset, data might be lagged while cattle continue their regular activities. Furthermore, the platform of this system needs a specialized operator and has high maintenance costs. With the adoption of LoRa LPWAN technology, IoT hardware and software architecture can continuously track an animal's position [14,35]. Hardware (HW) implementation without a listen-before-talk mechanism provides a custom Media Access Control (MAC) layer with Listen-Before-Talk (LBT)-based carrier-sense multiple access with collision avoidance. However, the closed-source architecture of this system may have trouble when it is applied to a large-scale area. The owners of farms must invest more whilst positioning data only are obtained. Using the same idea but different communication, an IoT-based system can be connected to a Sigfox network and the rest to Bluetooth tags [15,36]. Due to its expensive price, although a low collar/tag ratio enables the monitoring of animals, each animal cannot be fitted with a Global Positioning System (GPS) collar. However, if some cattle that are not attached tags have diseases, then a herd may be widely affected.
Investigations on the behavioral responses or living habits of cattle turn into deep phase in agricultural studies. With an animal-centered approach, if changes in usual activities or adaptations in life can be managed, then it is possible to obtain benefits for farmers in terms of finance, labor costs and productivity. In [37], animals' reactions to pasture availability were the aim of academic study. The researchers wanted to determine the favorite grazing sites by utilizing Global Navigation Satellite System (GNSS) technology. The traveling distance and location in the paddock were fused to derive the Normalized Difference Vegetation Index (NDVI). When considering a decrease in NDVI and an increase in moving displacement, cattle presented a partial preference for areas of higher pasture biomass/NDVI. This finding can assist producers to better manage cattle, as well as to manipulate grassland intensity and paddock utilization.
For the technical details of monitoring loggers, there are numerous producers in the commercial market, such as Vectronic Aerospace GmbH, Lotek, or Holohil Systems Ltd. Vectronic Aerospace GmbH [38] is located in Berlin, Germany and provides electrical equipment for the industrial sector. This famous branch name produces GPS collars, sensors, and accessories; the collar is equipped with one dual-axis accelerator and horizontal and vertical sensors. Any motion in space generates an x-value and a y-value. Tracking data are continuously recorded and averaged between two successive action fixes, and the mean activity estimations are put on a linear scale from 0 to 255. Furthermore, Lotek [39], based in Seattle, U.S., is a designer and manufacturer of fish and wildlife monitoring systems. This business delivers radio, acoustic, archival, and satellite monitoring systems to permit users to follow animals, birds, and fish in dissimilar atmospheres and regions. For terrestrial data loggers, the drop-off mechanism for Lotek's collar is designed to cut the cost associated with recapture, as well as the stress placed on livestock. From Ontario, Canada, Holohil [40] serves the wildlife research community with state-of-the-art Very high frequency (VHF) transmitters. In general terms, these collars allow insight into animal actions by unceasingly reporting x-and y-values on a scale from 0 to 255 [41]. In contrast, the sensing values that are measured by these collars provide information on the degree of activity only on a broader scale, whilst different active behaviors fail.

Network Communication
Industrial IoT, which entails the Internet connection of as many industrial devices as possible, has become a hot trend in Industry 4.0. In the real-time concept, its short latency is one of the most interesting things. The impact of the quality of the service parameters on the communication delay from the production line to the Cloud has been experimented on [42]. However, only the testing method of Open Platform Communications Unified Architecture (OPC UA) usage has been presented for IoT gateways. Some of the successful experiences that overcame unexpected problems were not mentioned when the Agriculture 2020, 10, 180 6 of 26 topic of the performance of the service parameters was raised. Related to positioned technology via identification, Radio Frequency Identification (RFID)-based IoT systems for commercial applications was investigated [43], in which a novel methodology that eases the detection and mitigation of such flaws was represented. Its security tools were analyzed and a validation method was suggested. Under different scenarios, the effect of this method may fluctuate, such that the durability of the tag should be considered under climate changes. In the small distance between tags or in overlapped tags, the accuracy of this approach still needs to be confirmed. To understand IoT utilization and to provide reliable guidelines for potential IoT adopters, the value configuration of IoT technologies and the specific attributes of IoT in particular business contexts were researched [44]. Focusing on five representative value configurations of RFID and sensors, a holistic view for understanding IoT utilization in various business areas, as well as the value configuration framework approach, provides a more elaborate frame to acknowledge the diffusion trends of new technology. However, some boundaries in the data collection process and in advanced sensing devices, such as bio-acoustic or micro-electromechanical systems, have yet to be determined via further experimentation.

Bio-Acoustic Approach
At present, many advanced technologies are explored to supervise the status of cattle in-depth. For instance, a wireless acoustic system for ambient assistant was invented in [45]. To infer hazardous situations via environmental sound identification, it was found that satisfactory sensor solutions have not been considered in terms of both low cost and high performance. This examination divulges that the care of animals lacks the necessary information. Acoustic data alone are not enough to determine the current status of animals, because it is essential to discover the physical relationship between the location, the sound of the bite, and the movement of the jaw. To distinguish grazing activities, the authors in [46] tested a novel analysis system to detect and classify the ingestive events of grazing cattle. The core of this method is to measure the shape, amplitude, duration, and energy of sound signals. Performance and validation are determined by using two databases of grazing signals, which encompass dairy cows in natural pastures and in indoor controlled environments. In contrast, iterative detection and big data processing might become challenges if this system is applied in farming. In the same academic approach, the hidden Markov model was utilized to segment and classify acoustic signals [47]. The findings related to the spectral content of the acoustic signals, as well as a novel language model for their recognition, were presented. Obviously, the recorded sound needs to be decoded automatically for practical use, and the operator of this system must be a professional expert who works in a laboratory. After classifying the ingestive events, they did not link to any data (location, time, or behavior set) in order to conclude the health status of the animals.
In more detail, the sound-based algorithm was developed to sense coughing symptoms [48], as bovine respiratory disease is a major animal health challenge in calf rearing. Any outbreak would lead to severe economic losses if widespread. The sounds were stored in four adjacent compartments of one calf house over two time periods, and these data contained 664 different cough references, which were labeled by a human expert. The results indicated that the algorithm works well in some cases, but in others, its precision was less; therefore, this method highlights the difficulties in reality. An offline approach could support data processing because of the burden the calculation. Late detection results in the infection of numerous calves, and treatment becomes more problematic. In [49], most of the sensors that were reviewed in research were primarily designed to monitor cattle, and it was not concluded that the co-operation between sensors would solve a problem or that the analysis result was learned from experiences. Additionally, the listed sensors were expensive and required finding the most appropriate location for their attachment.

Proposed Solutions
There is a need to design an open platform for precision livestock farming. Yet, most of the research is focused on the development of academic algorithms for specific species [50], which entails more time to investigate before application in farming, while food security must be the top priority. The platform should also be able to individually gather separated data, such as location or sound only, as well as their habitats unfold in mouth's motion, the duration in a day, and body temperature. The electronic components should be easily found in the market, should be easy to maintain, and should be self-made works.

Methodology
The overall purpose of this paper is to create an inexpensive data collector based on an open-source framework in order to observe the living style of livestock. Via monitoring parameters (i.e., tracking location, temperature, pose of motion, and vocal data of chewing or biting actions), farm managers are able to anticipate sudden phenomena in daily activities and to determine livestock pasture preference, and hence, enhance grazing management. On account of species, we only represent the experimental studies on Bos taurus indicus, which is well-known in Vietnam.
Following requirements analysis, we built a conceptual prototype so that workers could operate the proposed device on their farms. From non-specialist electronic components, this solution offers the benefits of ease-of-use, extendable ability, and reasonable performance to the farm industry. To facilitate farmers to employ this device, user interface software that necessitates low-level programming only is installed on their pocket devices. Data exchange between the slaves and the host has three set-up requirements: First, it can be set-up on the farm computer; second, it can be set-up in the slave tools; and third, the declarations and set-up configuration of the database are stored in Firebase.

Do-It-Yourself Hardware
In this section, the design hardware for the open platform is demonstrated, such that the network tool warrants non-stop communication and a reliable protocol. The electronic modules should be readily available in the market so that they are easy to replace, and they should have easy wiring and be of low cost. All parts are placed into the compact unit and should be of small size and durable material, and should support signal strength.

Network Protocol
MQTT (Message Queuing Telemetry Transport) is a publish/subscribe protocol in IoT devices, which has low bandwidth, high reliability, and two directions, and is compatible with almost operating systems. The network communication was built as in [51], in which numerous clients can be associated to the server-named as MQTT broker in Figure 1. Every client registers their individual channel and publishes information; subscribed activity is considered as registration. The database is categorized into messages: Control and feedback. The server transmits a control command, received from external units, to the slave nodes. The feedback frame, including the node status and the acknowledge response, is transmitted back to server from the slave nodes. Using this protocol network, the system can prevent data loss during message transmission.
To interface with the host, it is necessary for the central processor unit (CPU) in the slave nodes to program, as shown Figure 2. Depending on the performance of each CPU, the interrupt service routine (ISR) must ensure the communication process. In the first instance, the system parameters, cyber address, and network specifications are set; then, data from the sensing modules are collected after the connection to the server is confirmed. The feedback of information to the host and receiving the control messages to proceed complete a communication cycle. Otherwise, an error message is activated in the system. be associated to the server-named as MQTT broker in Figure 1. Every client registers their individual channel and publishes information; subscribed activity is considered as registration. The database is categorized into messages: Control and feedback. The server transmits a control command, received from external units, to the slave nodes. The feedback frame, including the node status and the acknowledge response, is transmitted back to server from the slave nodes. Using this protocol network, the system can prevent data loss during message transmission.  To interface with the host, it is necessary for the central processor unit (CPU) in the slave nodes to program, as shown Figure 2. Depending on the performance of each CPU, the interrupt service routine (ISR) must ensure the communication process. In the first instance, the system parameters, cyber address, and network specifications are set; then, data from the sensing modules are collected after the connection to the server is confirmed. The feedback of information to the host and receiving the control messages to proceed complete a communication cycle. Otherwise, an error message is activated in the system.

Electronic Components
One of the indispensable functions for the monitoring system is tracing movements. In order to support this purpose, a GPS receiver, such as GPS NEO-6M V2 (Figure 3), obtains information from satellites in the form of radio signals toward the Earth. Unlike other GPS modules, it can update a maximum of five locations per second with 2.5 m horizontal position accuracy. Especially, the power-saving mode of this chip features a reduction in system power consumption. With a compact design, the antenna-which has a -161 dBm sensitivity-is attached behind the module. This receiver-type provides up to 50 channels with an update rate of 5 Hz, a horizontal position accuracy of 2.5 m, and serial communication to the main CPU.

Electronic Components
One of the indispensable functions for the monitoring system is tracing movements. In order to support this purpose, a GPS receiver, such as GPS NEO-6M V2 (Figure 3), obtains information from satellites in the form of radio signals toward the Earth. Unlike other GPS modules, it can update a maximum of five locations per second with 2.5 m horizontal position accuracy. Especially, the power-saving mode of this chip features a reduction in system power consumption. With a compact design, the antenna-which has a -161 dBm sensitivity-is attached behind the module. This receiver-type provides up to 50 channels with an update rate of 5 Hz, a horizontal position accuracy of 2.5 m, and serial communication to the main CPU. ESP32-based communication-named Ethernet Thing [54]-is exploited for receiving, processing, and parsing data from the sensors. In Figure 4a, it is a wireless compatible micro-processor, which provides low-energy Bluetooth and plenty of general purpose input/output pins. This module is beneficial in terms of its low cost (approximately 14USD) and low power (approximately 0.5 W). With its wide range from 2.2 to 3.6 V, the ESP32 board can be turned on by a USB power supply or an external battery. It is commonly employed in IoT applications and updated version of ESP8266. Ethernet Thing offers several libraries of different functions, simple compiler and example codes. To display the body temperature of cattle, a reasonable module of temperature humidity DHT11 (as shown in Figure 4b) was designed. Its maximum sampling frequency of 1 Hz aids the supervisory system to obtain enough data, while it does not cost much in terms of its hardware. With acceptable precision of temperature and humidity measurements, this sensor is a great tool for farmers to implement in their IoT devices. The jaw motion of livestock is saved owing to MPU-6050 (Figure 4c), which has ability to measure the motion in three-dimensional (3D) space and to return analog signals back to the main CPU. Although it is highly sensitive, incorrect evaluations of the yaw angle are unavoidable, and it tends to vibrate when external forces appear. Thus, filters-for example, a complementary filter or a Kalman filter-should be embedded to prevent drift phenomena.
Acoustic data are chronicled by a microphone amplifier GY-MAX4466, as shown in Figure 5. This is micro-power op-amp that can be used as a microphone. It delivers an ideal combination of an ESP32-based communication-named Ethernet Thing [54]-is exploited for receiving, processing, and parsing data from the sensors. In Figure 4a, it is a wireless compatible micro-processor, which provides low-energy Bluetooth and plenty of general purpose input/output pins. This module is beneficial in terms of its low cost (approximately 14USD) and low power (approximately 0.5 W). With its wide range from 2.2 to 3.6 V, the ESP32 board can be turned on by a USB power supply or an external battery. It is commonly employed in IoT applications and updated version of ESP8266. Ethernet Thing offers several libraries of different functions, simple compiler and example codes. ESP32-based communication-named Ethernet Thing [54]-is exploited for receiving, processing, and parsing data from the sensors. In Figure 4a, it is a wireless compatible micro-processor, which provides low-energy Bluetooth and plenty of general purpose input/output pins. This module is beneficial in terms of its low cost (approximately 14USD) and low power (approximately 0.5 W). With its wide range from 2.2 to 3.6 V, the ESP32 board can be turned on by a USB power supply or an external battery. It is commonly employed in IoT applications and updated version of ESP8266. Ethernet Thing offers several libraries of different functions, simple compiler and example codes. To display the body temperature of cattle, a reasonable module of temperature humidity DHT11 (as shown in Figure 4b) was designed. Its maximum sampling frequency of 1 Hz aids the supervisory system to obtain enough data, while it does not cost much in terms of its hardware. With acceptable precision of temperature and humidity measurements, this sensor is a great tool for farmers to implement in their IoT devices. The jaw motion of livestock is saved owing to MPU-6050 (Figure 4c), which has ability to measure the motion in three-dimensional (3D) space and to return analog signals back to the main CPU. Although it is highly sensitive, incorrect evaluations of the yaw angle are unavoidable, and it tends to vibrate when external forces appear. Thus, filters-for example, a complementary filter or a Kalman filter-should be embedded to prevent drift phenomena.
Acoustic data are chronicled by a microphone amplifier GY-MAX4466, as shown in Figure 5. This is micro-power op-amp that can be used as a microphone. It delivers an ideal combination of an optimized gain bandwidth product with supply current, and low-voltage operation in an ultra-small To display the body temperature of cattle, a reasonable module of temperature humidity DHT11 (as shown in Figure 4b) was designed. Its maximum sampling frequency of 1 Hz aids the supervisory system to obtain enough data, while it does not cost much in terms of its hardware. With acceptable precision of temperature and humidity measurements, this sensor is a great tool for farmers to implement in their IoT devices. The jaw motion of livestock is saved owing to MPU-6050 (Figure 4c), which has ability to measure the motion in three-dimensional (3D) space and to return analog signals back to the main CPU. Although it is highly sensitive, incorrect evaluations of the yaw angle are unavoidable, and it tends to vibrate when external forces appear. Thus, filters-for example, a complementary filter or a Kalman filter-should be embedded to prevent drift phenomena. Acoustic data are chronicled by a microphone amplifier GY-MAX4466, as shown in Figure 5. This is micro-power op-amp that can be used as a microphone. It delivers an ideal combination of an optimized gain bandwidth product with supply current, and low-voltage operation in an ultra-small dimension. In shutdown, the amplifier's supply current is lessened to 5 nA and the bias current to the external microphone is cut-off for ultimate power saving. It is wired to the amplifier as shown in Figure 6 to reject external disturbances. Additionally, the installation location of GY-MAX4466 should be near the voice source to decline noises and far from the power supply to attain the best signals.
Agriculture 2020, 10, x FOR PEER REVIEW 10 of 27 the external microphone is cut-off for ultimate power saving. It is wired to the amplifier as shown in Figure 6 to reject external disturbances. Additionally, the installation location of GY-MAX4466 should be near the voice source to decline noises and far from the power supply to attain the best signals.  All of the electronic components are positioned in the basement module. The operating voltage of the sensors is from 3.3 to 5 V, while 5 V voltages is supplied from the battery. Unfortunately, the Ethernet Thing module works from 0 to 3.3 V voltages, which does not match the sensor feedback pins. To overcome this issue, the voltage level is shifted by using a pull-down resistor array, as shown in Figure 7. This connection serves to enhance the sensing value measurement. Generally, a Printed Circuit Board (PCB) design is compulsory since animals can move at dissimilar speeds. Inside, the electronic components are fixed to either the upper or lower part. Some positions are a must, such that the temperature sensor should be placed to derm vis-à-vis, while the microphone module should be situated at head. The accelerometer should stay at the center of the box to stabilize the measuring values. While moving, unexpected vibration or collision may happen, and such impact may cause broken connections. In farming, without professional PCB design skills, a worker is able to exploit a copper board and soldering to fix such connections. the external microphone is cut-off for ultimate power saving. It is wired to the amplifier as shown in Figure 6 to reject external disturbances. Additionally, the installation location of GY-MAX4466 should be near the voice source to decline noises and far from the power supply to attain the best signals.  All of the electronic components are positioned in the basement module. The operating voltage of the sensors is from 3.3 to 5 V, while 5 V voltages is supplied from the battery. Unfortunately, the Ethernet Thing module works from 0 to 3.3 V voltages, which does not match the sensor feedback pins. To overcome this issue, the voltage level is shifted by using a pull-down resistor array, as shown in Figure 7. This connection serves to enhance the sensing value measurement. Generally, a Printed Circuit Board (PCB) design is compulsory since animals can move at dissimilar speeds. Inside, the electronic components are fixed to either the upper or lower part. Some positions are a must, such that the temperature sensor should be placed to derm vis-à-vis, while the microphone module should be situated at head. The accelerometer should stay at the center of the box to stabilize the measuring values. While moving, unexpected vibration or collision may happen, and such impact may cause broken connections. In farming, without professional PCB design skills, a worker is able to exploit a copper board and soldering to fix such connections. All of the electronic components are positioned in the basement module. The operating voltage of the sensors is from 3.3 to 5 V, while 5 V voltages is supplied from the battery. Unfortunately, the Ethernet Thing module works from 0 to 3.3 V voltages, which does not match the sensor feedback pins. To overcome this issue, the voltage level is shifted by using a pull-down resistor array, as shown in Figure 7. This connection serves to enhance the sensing value measurement. Generally, a Printed Circuit Board (PCB) design is compulsory since animals can move at dissimilar speeds. Inside, the electronic components are fixed to either the upper or lower part. Some positions are a must, such that the temperature sensor should be placed to derm vis-à-vis, while the microphone module should be situated at head. The accelerometer should stay at the center of the box to stabilize the measuring values. While moving, unexpected vibration or collision may happen, and such impact may cause broken connections. In farming, without professional PCB design skills, a worker is able to exploit a copper board and soldering to fix such connections. To protect the electric components entirely, a cover box manufactured by 3D printing technology is necessary, as illustrated in Figure 8. ABS (Acrylonitrile Butadiene Styrene) plastic material is very popular thanks to its low cost and its better mechanical properties. In addition, the external surface of the box should be scabrous for drainage, and it should be comfortable for livestock to wear it for the whole day. For measurement of jaw motions, this plastic box should be hung close to mouth using a nylon rope.   To protect the electric components entirely, a cover box manufactured by 3D printing technology is necessary, as illustrated in Figure 8. ABS (Acrylonitrile Butadiene Styrene) plastic material is very popular thanks to its low cost and its better mechanical properties. In addition, the external surface of the box should be scabrous for drainage, and it should be comfortable for livestock to wear it for the whole day. For measurement of jaw motions, this plastic box should be hung close to mouth using a nylon rope. To protect the electric components entirely, a cover box manufactured by 3D printing technology is necessary, as illustrated in Figure 8. ABS (Acrylonitrile Butadiene Styrene) plastic material is very popular thanks to its low cost and its better mechanical properties. In addition, the external surface of the box should be scabrous for drainage, and it should be comfortable for livestock to wear it for the whole day. For measurement of jaw motions, this plastic box should be hung close to mouth using a nylon rope.   The hardware set-up on the forehead of cattle is illustrated in Figure 9. First and foremost, the equipment is placed near the animal's mouth to acquire better information. For the animal's comfort, a knot helps farmers to tie the device appropriately at various dimensions. The material of the belt should be soft, easy to disassemble, and, especially, evaporative for water to come out. In this position, the motion of the jaw can be documented exactly and effectively.

The Open Software
Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, later acquired by Google in 2014 [59]. Several services-for instance, develop, grow, or earn-have been introduced, as shown in Figure 10. Several noticed functions of Google Firebase are explained below.
Real-time database: The database provides application developers an Application Programming Interface (API) that allows application data to be synchronized across clients and stored on Firebase's cloud. The company offers client libraries that enable integration with Android, iOS, or Node.js applications. Firebase authentication: Firebase can authenticate users using only client-side code. It supports social login providers Facebook, GitHub, Twitter, and Google, as well as other service providers such as Apple or Microsoft. Firebase hosting: Firebase is a static and dynamic web hosting service that launched on May 13, 2014. It supports hosting static files such as Cascading Style Sheets (CSS), Hypertext Markup Language (HTML), or JavaScript. The service delivers files over a content delivery network through HTTP Secure and Secure Socket Layer encryption. Cloud messaging: This is a cross-platform solution for messages and notifications for Android, iOS, and web applications. livestock to wear it for the whole day. For measurement of jaw motions, this plastic box should be hung close to mouth using a nylon rope.   The hardware set-up on the forehead of cattle is illustrated in Figure 9. First and foremost, the equipment is placed near the animal's mouth to acquire better information. For the animal's comfort, a knot helps farmers to tie the device appropriately at various dimensions. The material of the belt should be soft, easy to disassemble, and, especially, evaporative for water to come out. In this position, the motion of the jaw can be documented exactly and effectively.

The Open Software
Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, later acquired by Google in 2014 [59]. Several services-for instance, develop, grow, or earn-have been introduced, as shown in Figure 10. Several noticed functions of Google Firebase are explained below.


Real-time database: The database provides application developers an Application Programming Interface (API) that allows application data to be synchronized across clients and stored on Firebase's cloud.   A rich layout editor that allows users to drag-and-drop User Interface (UI) components and offers the option to preview layouts on multiple screen configurations. Built-in support for the Google Cloud platform, enabling integration with Firebase Cloud Messaging and Google App Engine. Android Virtual Device (Emulator) to run and debug apps in the Android Studio. Template-based wizards to create common Android designs and components.

Architecture of the Open Control Platform
Firstly, the firmware (as shown in Figure 11) is programmed in micro-controller CPU by Arduino IDE. In the main loop, a series of commands that read values from the sensor block are written before interfacing with the wireless communication. API functions in the libraries are provided for hardware access. Note that the pin mode has to register correctly in order to match the configurations. As the battery often reduces the voltage capacity according to time, a voltage regulator is used to preserve the power level, which, for Firebase, plays the role of cloud server to store data via the wireless network. A large amount of data (i.e., position, motion, sound, temperature) requires rapid transmission and reliable storage in the host server. On pocket devices, the Android-based application, developed by Android Studio, displays the monitoring data; the illustration comprises graphical data and recent records that reflect most outdoor activities. On personal computers, a web page is also established to visualize the data. The mobile development tool is based on Android Studio 3.0 [61]. It is the official integrated development environment for Google's Android operating system and supports all of the same programming languages (Java, C++, etc.). The following features are provided in the current version.


A rich layout editor that allows users to drag-and-drop User Interface (UI) components and offers the option to preview layouts on multiple screen configurations.  Built-in support for the Google Cloud platform, enabling integration with Firebase Cloud Messaging and Google App Engine.  Android Virtual Device (Emulator) to run and debug apps in the Android Studio.  Template-based wizards to create common Android designs and components.

Architecture of the Open Control Platform
Firstly, the firmware (as shown in Figure 11) is programmed in micro-controller CPU by Arduino IDE. In the main loop, a series of commands that read values from the sensor block are written before interfacing with the wireless communication. API functions in the libraries are provided for hardware access. Note that the pin mode has to register correctly in order to match the configurations. As the battery often reduces the voltage capacity according to time, a voltage regulator is used to preserve the power level, which, for Firebase, plays the role of cloud server to store data via the wireless network. A large amount of data (i.e., position, motion, sound, temperature) requires rapid transmission and reliable storage in the host server. On pocket devices, the Android-based application, developed by Android Studio, displays the monitoring data; the illustration comprises graphical data and recent records that reflect most outdoor activities. On personal computers, a web page is also established to visualize the data.

Validated Performance from Practical Scenario
As described above, the proposed low-cost, open-source data collector was set-up on a farm in North Vietnam to acquire practical evaluation data, and to parse the acquired data to the IoT server through Ethernet Thing for remote supervision and monitoring control. A real platform was accomplished and the test case was exemplified, as shown in Figure 12. During daylight, the livestock move around the farming area while wearing the data collector. During the main mealtimes, quantitative food is brought to feeder and the eating action is observed in order to classify the movements of the jaw. The data collector is then detached at night in order for the cattle to relax properly. During this time, the alkaline battery is checked in order to recharge or replace as appropriate.

Validated Performance from Practical Scenario
As described above, the proposed low-cost, open-source data collector was set-up on a farm in North Vietnam to acquire practical evaluation data, and to parse the acquired data to the IoT server through Ethernet Thing for remote supervision and monitoring control. A real platform was accomplished and the test case was exemplified, as shown in Figure 12. During daylight, the livestock move around the farming area while wearing the data collector. During the main mealtimes, quantitative food is brought to feeder and the eating action is observed in order to classify the movements of the jaw. The data collector is then detached at night in order for the cattle to relax properly. During this time, the alkaline battery is checked in order to recharge or replace as appropriate. After attaching the device to the animal, an operator can view the received data directly on a mobile phone. This allows configuring the network constraints, enabling machine and filling in the IP address of the server, and inserting the appropriate password (if the user is authorized to do so), after which, the well-being parameters shortly appear on the main Graphical User Interface (GUI), as shown in Figure 13a. Once received from the cloud console, the data are automatically logged to both the dashboards and the data buckets for remote management and automated control via electronic consumer devices. On the main screen, general information is briefly displayed for the user. Each category of received data has an average value, and maximum and minimum thresholds. In the case that the current rate fluctuates far from these thresholds, the fitness status (i.e., the "conclusion") changes to abnormal to alert the farmer. Otherwise, a normal message is returned to the user. In the second configuration (Figure 13b), the temperature information is updated every ten minutes and its graph helps farmers to visualize temperature variations. When the system was being tested, a digital sensing meter was connected to each of the points of interest to measure the actual values. After attaching the device to the animal, an operator can view the received data directly on a mobile phone. This allows configuring the network constraints, enabling machine and filling in the IP address of the server, and inserting the appropriate password (if the user is authorized to do so), after which, the well-being parameters shortly appear on the main Graphical User Interface (GUI), as shown in Figure 13a. Once received from the cloud console, the data are automatically logged to both the dashboards and the data buckets for remote management and automated control via electronic consumer devices. On the main screen, general information is briefly displayed for the user. Each category of received data has an average value, and maximum and minimum thresholds. In the case that the current rate fluctuates far from these thresholds, the fitness status (i.e., the "conclusion") changes to abnormal to alert the farmer. Otherwise, a normal message is returned to the user. In the second configuration (Figure 13b), the temperature information is updated every ten minutes and its graph helps farmers to visualize temperature variations. When the system was being tested, a digital sensing meter was connected to each of the points of interest to measure the actual values.

Implementation of Integrated Filter
The motion in the three axes Ox, Oy, and Oz was recorded by MPU-6050, as shown in Figure 14.
Since it is situated near to the jaw, it is considered that 80% of the motion of the mouth can be noted accurately. In order to use MPU6050, it must be calibrated to the center of gravity (CoG) of the system [62]. The rotation matrix of the system is described by: where Φ, θ, and Ψ are the roll, pitch, and yaw angles, respectively. Assume that R 1 is fastened to the earth inertial coordinate, R 2 is parallel to R 1 and is located at the the CoG of the system, and that R 3 is tied to the body of the system and is also located at its CoG. Due to the small Euler angle, the angular velocity of system in the R 3 coordinate is as follows:

Implementation of Integrated Filter
The motion in the three axes Ox, Oy, and Oz was recorded by MPU-6050, as shown in Figure 14. Since it is situated near to the jaw, it is considered that 80% of the motion of the mouth can be noted accurately. In order to use MPU6050, it must be calibrated to the center of gravity (CoG) of the system [62]. The rotation matrix of the system is described by: where Φ, θ, and Ψ are the roll, pitch, and yaw angles, respectively. Assume that R1 is fastened to the earth inertial coordinate, R2 is parallel to R1 and is located at the the CoG of the system, and that R3 is tied to the body of the system and is also located at its CoG. Due to the small Euler angle, the angular velocity of system in the R3 coordinate is as follows: Assume that the system is performed by a linear acceleration a r and put into gravitational acceleration. Assume that the linear acceleration is very small (a r ≈ 0) and that MPU6050 is placed its z axis, along with the gravitational acceleration. We named R the rotation matrix: Hence, Euler angles can be evaluated from the roll, pitch, and yaw values of the sensor: As a result, the rotation matrix is written as follows: The values of the roll and pitch angles can be estimated: To lessen high-frequency noise from the accelerometer, a complementary filter (as shown in Figure 15) is recommended to estimate the angle θ estimate based on the variation of the speed from the gyroscope. Then, it is added to with the angles θ accel from the accelerometer. Consider that with small values, the estimation of the roll value Φ and the pitch value θ are known, respectively.
The values of the roll and pitch angles can be estimated: = arctan( − To lessen high-frequency noise from the accelerometer, a complementary filter (as shown in Figure 15) is recommended to estimate the angle based on the variation of the speed from the gyroscope. Then, it is added to with the angles from the accelerometer. Consider that with small values, the estimation of the roll value Ф and the pitch value θ are known, respectively.
The superiority of a complementary filter mainly concentrates on parameter γ. In this filter, a delay time occurs in the output signal (regularly, because of the low-pass filter of the accelerometer and the high-pass filter of the gyroscope). The closer the γ value is to 1, the better the quality of the filter. However, values of the sensor that vary quickly result in longer convergent times. It is impossible to estimate directly the yaw angle from the accelerometer, so at present, we still apply values inferred from the gyroscope and accept the drift phenomenon. By using more magnetic sensors, this problem can be solved.

1
To visualize the current audio processing, the performance of sound wave analysis is described The superiority of a complementary filter mainly concentrates on parameter γ. In this filter, a delay time occurs in the output signal (regularly, because of the low-pass filter of the accelerometer and the high-pass filter of the gyroscope). The closer the γ value is to 1, the better the quality of the filter. However, values of the sensor that vary quickly result in longer convergent times. It is impossible to estimate directly the yaw angle from the accelerometer, so at present, we still apply values inferred from the gyroscope and accept the drift phenomenon. By using more magnetic sensors, this problem can be solved. θ(n) = γθ estimate (n) + (1 − γ)θ accel (n) (13) 0.5 ≤ γ ≤ 1 To visualize the current audio processing, the performance of sound wave analysis is described as Figure 16. In pocket monitoring devices, a breeder can determine remotely how cattle is fed. In more detail, some experts are able to examine the cattle's habits, the kind of grass, and so on via the interpretation of online or offline data.

Discussion
Agriculture is a field that could considerably profit from IoT technology. Interestingly, this research constructs an open platform using wireless communication and a mobile monitor for determining the habits of livestock. The key sections, such as the low-cost hardware, the programming software, and the algorithm implementation, were designated. Nevertheless, some typical habitats in North Vietnam were discussed to clarify inappropriate farming, which highlights the need to employ the proposed device accurately into the farming industry.

Battery Lifetime Estimation
It is important to estimate a battery's lifetime to manage power effectively. In actual application, the power consumed by our logger relies on each component's usage. We consider that for an electronic component , and are the current and the time spent in active mode, respectively, while and are the current and the time consumed in stand-by

Discussion
Agriculture is a field that could considerably profit from IoT technology. Interestingly, this research constructs an open platform using wireless communication and a mobile monitor for determining the habits of livestock. The key sections, such as the low-cost hardware, the programming software, and the algorithm implementation, were designated. Nevertheless, some typical habitats in North Vietnam were discussed to clarify inappropriate farming, which highlights the need to employ the proposed device accurately into the farming industry.

Battery Lifetime Estimation
It is important to estimate a battery's lifetime to manage power effectively. In actual application, the power consumed by our logger relies on each component's usage. We consider that for an electronic component i th , I awake i and T awake i are the current and the time spent in active mode, respectively, while Then, I av is the time-averaged power consumption, and the total time of the estimation period is T period . The following is the formula to compute I av : with T period = n T awake i + n T sleep i Since the main loop in the Interrupt Service Routine (ISR) manipulates the whole operation in the device, the time durations in both the working mode and the sleep mode are the same in every component module. We estimate that the updated period is 10 s, and that the time for the ISR is 200 milliseconds. The specifications in the currents of each electronic component are shown in Table 1. As a result, the time-averaged power consumption I av equals 36, 618149 mA. For convenient usage, the batteries used in this research were AA-sized 1.5 V alkaline batteries, which are readily available in the market. The sum of the power capacities W is evaluated as 6100 mAh. The total battery lifetime T work is calculated as: Therefore, the battery lifetime is roughly 21 days if the proposed data logger runs 8 h per day. Whenever the power source is nearly empty, farm managers can replace the batteries without experiencing any difficulties. To extend the battery lifetime, AA batteries with larger capacities can be used, or the number of frequent updates can be decreased.

Hardware
Both the memory and the flash on-board of the current mirco-processor are sufficient for upgrades within the same family of Arduino in order to keep an open platform. The collected data must be implemented in MATLAB using an Intel Core i7 processor (3 M cache, 2.4 GHz). With powerful computation, the analyzed results are more rapid, well-founded, and extendable. Reducing the sampling frequency does not lower the present one in the accelerometer, but it subtilizes the amount of data handling in the mirco-processor. It is possible to stimulate a lower sampling frequency to only every third sample. This also impacts on segmentation time, and the sensitivity, precision, and accumulated rumination time varies with various segmentation times.
In terms of cost-effective hardware, Table 2 outlines the approximate cost of the materials individually. In the case of retail, the price of each item is noted from a commercial market perspective. To minimize the cost, hundreds of proposed instruments could be mass-produced.

Software
In the graphical user interface, the main language is English; thus, Vietnamese farmers find it hard to interact with the device. The arrangement of the buttons, charts, or numbers ought to be simpler for elder persons. The filtering process is a crucial step for getting clear numbers from the raw data. In a complementary filter, the first-order filtering process can return low-level limit cycles. This leads to oscillation of the output signal after filtering, or else the output value remains stuck at a non-zero value, even though input does not exist. This issue can be overcome by minimizing the steady-state error to a reasonable value. In detail, scaling up the signal before filtering and scaling it down after filtering might assist in achieving better results.

Configuration of the Proposed Approach
From the experimental results in the previous section, it is indispensable to collate output performance between our data logger and a business product. In [63], biologists selected collars from Vectronic to obtain continuous activity data on the ecology of a species. The results were analyzed to determine daily activity patterns and seasonal changes, and it was concluded that VERTEX Lite is well-suited to monitor farming livestock, and thus is considered a comparable product. Table 3 illustrates the contrasting parameters for comparative performance results. In Figure 17, a successful experiment was conducted under a practical scenario in grassland. A total of nine cows with nine collars took part in the experiment, which lasted four weeks in order to obtain full breeding data. Most of the examples took place in an outdoor environment to visualize the output performance. The observations were time-consuming, as data were collected non-stop. Depending on each test, collars were attached to some livestock animals, while the others remained collar-free. No loss of generalizability occurred, as the farmers regularly took care of their cattle in formation of a group and fed them simultaneously. During the first use, breeders may feel very strange and sometimes uncomfortable, for the reason that they rarely use pocket devices and that they lack the fundamental skills to manipulate the screen. Gradually, it will become commonly applied as the farmers recognize its multiple benefits. Previously, they paid attention to supervising their livestock throughout the whole day, and as such, the labor cost was very high. Yet, this device can offer a method to remotely manage cattle; for instance, changes in eating habitats, sudden events, or outdoor environments can trigger warning messages on the mobile device carried by farmers.

Acoustic Feature Extraction
Information on outdoor events is not enough to determine an animal's health status. A novel data collector, including vocal materials from feeding activities, is necessary to ensure accurate monitoring. From the data obtained using an open-source data collector, stockbreeders can (a) recognize which grass is suitable for their livestock, (b) determine the eating habits of their cattle via advanced analysis, and (c) classify ingestive behaviors. The data resource in the records from the proposed instrument is available online in [64]. In this test, we tried to analyze this sample to verify the correctness and feasibility of our approach. It is considered that our signals correspond to the chew, composite chew-bite, and a bite actions of livestock [27]. For implementation targets, the completion of feature extractions can be done as a set of five successive stages, as shown in Figure  18. During the first use, breeders may feel very strange and sometimes uncomfortable, for the reason that they rarely use pocket devices and that they lack the fundamental skills to manipulate the screen. Gradually, it will become commonly applied as the farmers recognize its multiple benefits. Previously, they paid attention to supervising their livestock throughout the whole day, and as such, the labor cost was very high. Yet, this device can offer a method to remotely manage cattle; for instance, changes in eating habitats, sudden events, or outdoor environments can trigger warning messages on the mobile device carried by farmers.

Acoustic Feature Extraction
Information on outdoor events is not enough to determine an animal's health status. A novel data collector, including vocal materials from feeding activities, is necessary to ensure accurate monitoring. From the data obtained using an open-source data collector, stockbreeders can (a) recognize which grass is suitable for their livestock, (b) determine the eating habits of their cattle via advanced analysis, and (c) classify ingestive behaviors. The data resource in the records from the proposed instrument is available online in [64]. In this test, we tried to analyze this sample to verify the correctness and feasibility of our approach. It is considered that our signals correspond to the chew, composite chew-bite, and a bite actions of livestock [27]. For implementation targets, the completion of feature extractions can be done as a set of five successive stages, as shown in Figure 18.
Envelope intensity: This is the first task of sound analysis. The envelope of a sound signal can indicate actions and periodicities. During the process, low-frequency signals are retained, while high-frequency ones that do not relate to regular actions are discarded. Initially, the absolute value of a sampling signal is calculated. Then, the sound signal passes through a low-pass filter to produce sound magnitude. Then, the low-frequency envelope signal is re-sampled to pick up several sampling signals, since there are much sound data recorded per second. Without compromising the performance of the original sound data, the output values are transmitted to the next step. Envelope intensity: This is the first task of sound analysis. The envelope of a sound signal can indicate actions and periodicities. During the process, low-frequency signals are retained, while high-frequency ones that do not relate to regular actions are discarded. Initially, the absolute value of a sampling signal is calculated. Then, the sound signal passes through a low-pass filter to produce sound magnitude. Then, the low-frequency envelope signal is re-sampled to pick up several sampling signals, since there are much sound data recorded per second. Without compromising the performance of the original sound data, the output values are transmitted to the next step.
Segmentation: Long data are divided into segments. Short segments require lower calculation resources; hence, they are easier to handle and better facilitate the treatment of unexpected events. The capacity of segments depends on the computational ability that is available for implementation. Normally, an embedded platform with lower computational resources should select smaller-sized segments. Segments that had a minimum size of several seconds were able to be processed in our test.
Detection of grazing action: In the present shape of sound envelope intensity, fluctuations in the slope occur continuously and may peak at in some places. Each maximum/minimum value is identified as a change in the derivative of the envelope. To ensure the peaks, experience-based thresholds can be compared. Breeders can collect a sound library of actions as threshold resources based on their experiences, at which time, the potential target actions must be revealed. The output results of this stage contain sound information with respective timestamps to indicate the location of the identified peaks.
Analysis of sound properties: Special attention should be paid to the shape, maximum intensity, and duration of the candidate actions identified in the previous step. The shape of an action is estimated as the number of turn changes in the sign of the envelope intensity slope. The maximum intensity in the envelope data is calculated from the absolute value of the sound signal over a window time. The duration of an action is computed as the time period if the envelope intensity is higher.
Classification of grazing action: To distinguish between the various activities of livestock, a set of rules is recommended to be employed heuristically. For example, rule 1: If the change in the sign of the slope in the envelope intensity is larger than 2, the maximum intensity at that time is greater Segmentation: Long data are divided into segments. Short segments require lower calculation resources; hence, they are easier to handle and better facilitate the treatment of unexpected events. The capacity of segments depends on the computational ability that is available for implementation. Normally, an embedded platform with lower computational resources should select smaller-sized segments. Segments that had a minimum size of several seconds were able to be processed in our test.
Detection of grazing action: In the present shape of sound envelope intensity, fluctuations in the slope occur continuously and may peak at in some places. Each maximum/minimum value is identified as a change in the derivative of the envelope. To ensure the peaks, experience-based thresholds can be compared. Breeders can collect a sound library of actions as threshold resources based on their experiences, at which time, the potential target actions must be revealed. The output results of this stage contain sound information with respective timestamps to indicate the location of the identified peaks.
Analysis of sound properties: Special attention should be paid to the shape, maximum intensity, and duration of the candidate actions identified in the previous step. The shape of an action is estimated as the number of turn changes in the sign of the envelope intensity slope. The maximum intensity in the envelope data is calculated from the absolute value of the sound signal over a window time. The duration of an action is computed as the time period if the envelope intensity is higher.
Classification of grazing action: To distinguish between the various activities of livestock, a set of rules is recommended to be employed heuristically. For example, rule 1: If the change in the sign of the slope in the envelope intensity is larger than 2, the maximum intensity at that time is greater than the environmental noise, and duration of the action is greater than 0.3 s, then the action is a composite chew-bite; rule 2: If the change in the sign of the slope in the envelope intensity is less than or equal to 2, the maximum intensity at that time is greater than or equal to half of the expected peak value, and the duration of the action is less than 0.3 s, then action is a bite; rule 3: If the change in the sign of the slope in the envelope intensity is less than or equal to 2, the maximum intensity at that time is both greater than the environmental noise and less than or equal to half of the expected peak value, and the duration of the action is less than 0.3 s, then the action is a chew.
To verify our approach, the input of the system was the digitalized sound (.wav) in [37]. These samples are too large to synthesize on an embedded processor. Hence, the sound signal was down-sampled into smaller segments to reduce the amount of data, as shown in Figure 19. In the remaining stages, we introduced the experimental results based on this segment. Within the signal processing step, the numerical values of the digitalized vocal data were normalized and harmonized with our computational CPU. The raw signals may have contained unexpected noises, especially in outdoor environments. Using a linear time-invariant filter, the signal was synchronously demodulated to obtain the sound envelope. Moreover, this signal was checked to determine the maximum amplitude, named the maximum checker. As the sound envelope was of low frequency, the signal was compared with the experience-based threshold to recognize the animal's actions. Conventionally, the time frame to scan is about a second in duration. However, in our test, although there was a trade-off in terms of time processing, half a second was chosen to smooth and prevent loss of action. The output results of this step are presented in Figure 20.
Agriculture 2020, 10, x FOR PEER REVIEW 23 of 27 composite chew-bite; rule 2: If the change in the sign of the slope in the envelope intensity is less than or equal to 2, the maximum intensity at that time is greater than or equal to half of the expected peak value, and the duration of the action is less than 0.3 s, then action is a bite; rule 3: If the change in the sign of the slope in the envelope intensity is less than or equal to 2, the maximum intensity at that time is both greater than the environmental noise and less than or equal to half of the expected peak value, and the duration of the action is less than 0.3 s, then the action is a chew. To verify our approach, the input of the system was the digitalized sound (.wav) in [37]. These samples are too large to synthesize on an embedded processor. Hence, the sound signal was down-sampled into smaller segments to reduce the amount of data, as shown in Figure 19. In the remaining stages, we introduced the experimental results based on this segment. Within the signal processing step, the numerical values of the digitalized vocal data were normalized and harmonized with our computational CPU. The raw signals may have contained unexpected noises, especially in outdoor environments. Using a linear time-invariant filter, the signal was synchronously demodulated to obtain the sound envelope. Moreover, this signal was checked to determine the maximum amplitude, named the maximum checker. As the sound envelope was of low frequency, the signal was compared with the experience-based threshold to recognize the animal's actions. Conventionally, the time frame to scan is about a second in duration. However, in our test, although there was a trade-off in terms of time processing, half a second was chosen to smooth and prevent loss of action. The output results of this step are presented in Figure 20.

Conclusions
The open platform developed in this study provides complete implementation of a monitoring data collector using wireless communication and sensors that gather data from physical outdoor activities to determine the best method of feeding and breeding during grazing. The performance of

Conclusions
The open platform developed in this study provides complete implementation of a monitoring data collector using wireless communication and sensors that gather data from physical outdoor activities to determine the best method of feeding and breeding during grazing. The performance of the proposed data collector and its effectiveness were examined via experiments. The platform and its system were validated in a countryside farm, namely, Cat Ba National Park, Vietnam. The useful purposes for farmers and livestock are briefly outlined as follows: -This paper might offer solutions to avoid the unknown issues of changing environments of the livestock industry using different kinds of modern technologies. The collected data of the physical actions of animals can be used to alert farmers of diseases and breeding work. - The comfortable living conditions of the device help livestock to relax, and thus promote their good health and physical well-being. Moreover, large numbers of animals can be taken care with minimal investment. -With its compact size, its lightweight feature, and its easy maintenance, the proposed device can be mass-produced in a short period of time. Furthermore, the multi-functions and extendable ability are also benefits of this low-cost instrument.
However, future research is a must. The platform ought to be fully automatic in its operation, incorporating other bio-sensors and some advanced Information Technology. Once the hardware system works stably, a data processing strategy-for instance, Big Data, Artificial Intelligence, or expert-knowledge technology-should be considered to inspect diseases, insemination, or climate change.