Design of Information System for Milking Dairy Cattle and Detection of Mastitis

A novel information system for detecting mastitis in dairy cattle and managing their milking processes in the milking parlor is designed. The system comprises three major subsystems—the mastitis detection device, the information display device, and the cloud database. The mastitis detection device can detect and evaluate the degree of mastitis immediately before the milking operations are carried out.The information display device shows information on the health of the dairy cattle obtained from a cloud database tomanage themilk production of a dairy farm. Importantly, the proposed system utilizes a wireless sensor network (WSN) with low power consumption that connects the information display device with the remote management system. Experimental results reveal that our proposed system can reduce the risk ofmilking cattle withmastitis and improve efficiency ofmilk production.


Introduction
The management of the health of dairy cows is critical for farmers.In particular, when a farmer performs milking, the health of the cow must be monitored accurately.If the cow has mastitis in one or more udders, its milk cannot be drunk.During milking, milk that is produced by the cows is extracted to the milk tank.If even one cow suffers from mastitis and the farmers fail to notice the problem, then all the milk in the milk tank must be drained off and the farmer must disinfect the tank.When one or more cows suffer from mastitis, economic losses associated with the reduced production of milk occur.In recent years, automatic milking systems have been developed, but they are expensive, so farmers who have small farms cannot afford them.These farmers use a traditional method of tagging cows with mastitis tying colored belts to their legs.For example, in Figure 1, the two rear udders suffer from the mastitis, and the farmer ties two colored belts to the two hind legs to indicate the positions of these udders.The belts can easily fall off or become dirty causing the farmer not to notice them.
To solve the problem of tagging cows that suffer from mastitis, a radio frequency identification device is utilized herein.Whether the cow has mastitis is determined by checking a remote database.Information on the health of the cow is extracted from the database and transmitted to the information display board that is set up in front of the cow that is to be milked in the parlor.The farmer can monitor the health of the cow and milk udders without mastitis.The rapid response of the information technology to change in the health of the cow before milking can effectively reduce the risk of economic loss.The system also can be utilized to manage the health of cows by checking reports of statistical data that are based on the database.
The rest of this paper is organized as follows.Section 2 surveys previous studies for information and communication devices that can be utilized as part of the health-monitoring system for cows.Section 3 introduces the proposed system design.Section 4 summarizes the experimental results obtained using the proposed system.Section 5 draws conclusions and makes recommendations for future research.

Related Works
The following two subsections discuss the detection of mastitis by monitoring the electrical conductivity of the milk [1-5] and the information and communication technologies (ICTs) that are used to construct the health detection system [6][7][8][9][10][11][12].

Detection of Mastitis by Measuring the Electrical Conductivity of the Milk.
Mastitis in cow's udders is typically caused by infection by a pathogen.Mastitis is a common disease in dairy farms.Mastitis has two forms-clinical mastitis and nonclinical mastitis [2].An experienced farmer can observe clinical mastitis with the naked eye, but nonclinical mastitis cannot be easily observed, and its diagnosis requires laboratory equipment.Nonclinical mastitis causes more economic loss not only because it cannot be easily found but also because a cow that suffers from it cannot easily become pregnant.A cow that suffers from mastitis will produce approximately 5% to 25% less milk than one that does not [1].According to an American investigation, lack of production of milk by a cow that is being treated for mastitis causes losses of approximately US$180 annually.Color belts that are tied to the legs of the cow that correspond to the udders that suffer from mastitis can easily fall off or become dirty.If the belts are not seen and an udder with mastitis is milked, the polluted milk will be mixed with the normal milk in the milk tank.
Accordingly, tests for detecting mastitis include the California mastitis test (CMT), the alcohol test, the somatic cell test, and the milk conductivity test [3].The somatic cell count (SCC) test is an effective method for detecting mastitis.If the SCC of an udder is less than 200,000, then the udder is regarded as healthy.Otherwise, the udder is regarded as suffering from mastitis.Methods of determining the SCC include electrical cell counting and microscopic observation.
All such methods are expensive and time-consuming and can only be implemented by professionals.
In 1940, researchers proposed the detection of mastitis by monitoring electrical conductivity [2,4,6].Following decades of verification, conductivity is now used in mastitis detection.The conductivity of cow's udders can be determined by measuring the property of the milk.The electrical conductivity of an udder is measured using a portable device that is used to check the quality of the milk in each udder before milking.The concentrations of the sodium, potassium, chloride, and lactose in the milk dominate conductivity.In the initial phase of lactation, the concentration of sodium increases and the concentration of potassium declines.During lactation, the concentrations of both increase conductivity.A cow that suffers from mastitis has a lower SCC than the one that does not [5,11].Therefore, the measurement of conductivity is useful for identifying cows with mastitis.

Utilization of ICTs in Constructing Health Detection
System.A parlor is a moist, dirty, and metallic environment.Cows that enter the parlor bring soil and dung.They pollute the environment and the farmer spends substantial time to keep the parlor clean.When directing cows to the correct position in the parlor to wait for milking, the farmer uses metallic fences that prevent collision between cows as the cows walk.The metallic environment causes more electrical interference when the farmer uses electronic detection instruments.To protect the health of cows, an information system that emits only weak electromagnetic waves must be used.To identify automatically the cows that come to the parlor, radio frequency identification (RFID) technology is popularly used [6].The RFID tag is attached to the cow in a position of strong induction allowing an RFID reader to receive the identification (ID) number from the tag.To determine the position of the tag on the cow, the actions of the cow must be considered to prevent it from becoming dirty or being crushed.The ear of a cow is a good position for tying on such a tag.
The wireless sensor network (WSN) is another communication technology with low electromagnetic wave emission that can be used to transmit information on a farm [7][8][9][10].The Zigbee WSN is a low-cost technology that consumes little power.The communication range of Zigbee is between 100 m and 1.5 km; this WSN can be used in a moist environment without wires.A farmer needs only to transmit a small amount of data on the health of cows, minimizing the cost of communication.Zigbee is suitable for this purpose as it satisfies the requirements of a farm.

Proposed System Architecture
The proposed mastitis detection and health management system is for use with dairy cattle.The system is composed of three parts-the information transmission module, the information display, and the remote information database.3.1.Proposed System Architecture.The proposed system includes hardware and software.The hardware integrates an RFID system, the Zigbee WSN communication system, and the information display.The software integrates the remote database, the program for controlling the embedded system, and the mobile application program.Figure 2 presents the proposed system in a small parlor.Milking is carried out in many locations in the parlor.As shown in the figure, the cows with RFID tags come into the parlor in a line from the right side to the left.At the right of the parlor, before milking, two RFID readers ensure that the RFID tags on the cows' ears can be read.When one or both of the readers detect the RFID tag, the ID of the cow is transmitted to the remote information database by the data transfer board (DTB) over the Zigbee WSN.The database receives this ID, and the management program, running in the remote computer system, extracts from the database the information about the health of the cow.The information display board (IDB) receives this information from the management program via the DTB.The farmer can see this information before milking.Before the cow goes to the place of milking in the parlor, the IDB close to this location displays the health of its four udders.The farmer thus determines which udder(s) can be milked.
If the farmer wants to determine whether a cow has mastitis, he can use a detection device that is based on the proposed system to identify rapidly its health status.
The information that is measured using the detection device can also be transmitted to the information database by the DTB.The database of the system also can be used to generate statistics, which are displayed in the user interface of the remote computer.

Design of Mastitis Detection
Device. Figure 3 presents the standard mastitis detection processes in the proposed system.The conductivity measurement processes can be carried out using the detection device before milking.Information about health can also be obtained from the database of the remote computer.The proposed system initializes all of the hardware devices and software programs when the system is booted.The IDB obtains information about the health of the cow by checking the RFID through the Zigbee WSN.The farmer thus determines which cow needs to be checked for mastitis before milking.The detection begins to perform the measurement of electrical conductivity (EC) using a particular volume of milk from the cow.If the measured EC exceeds a threshold that is set by the farmer, an alert that the cow has mastitis will be generated.Information that a cow's udder suffers from mastitis is transmitted to the remote database by pushing the update button on the IDB.
Figure 4 presents the proposed mastitis detection device for checking the EC value of cow's udders.The device is wired with the IDB and transmits the measured results via the IDB that is connected with the DTB.To enable the device to be  immersed in milk to measure the EC value, the device must be coated with food-grade gum.The device has two major measurement units for measuring EC and the quantity of the milk.Two probes are put in contact with the milk and a backend circuit is utilized to translate the EC value.The circuit is used to measure the amount of water in milk.If the amount of milk exceeds the set threshold, then the detection device will measure the actual EC. Figure 4 presents the dimensions of the device.Following the detection, the IDB presents the EC.Each IDB is wired with a mastitis detection device to make measurements of the cow's milk.  is updated by the DTB.The design of the DTB is the same as that of the IDB, but the DTB has a Zigbee module that communicates with the remote management system.

Mechanism of Identity Recognition.
The RFID device adopts RF signals to transmit data, but the signals are easily interfered by a wet environment within the metal fences.
The parlor is such an environment.However, to monitor the health of a cow, a low-frequency (LF) RFID reader is utilized to identify the tags that are tied on the ear of the cow.The selected reader herein is the ROMAG G90A with 125 kHz frequency.The environment has a weaker effect on the lowfrequency reader.However, the disadvantage of such a reader is that it has a shorter sensing distance.A reader with a longer sensing distance requires a much higher transmission power.The sensing distance of the reader herein is between 90 cm and 130 cm.The width of the path of the animals through the parlor is around 100 cm.Therefore, two RFID readers are set up on both sides of the path to reduce the failure rate in the reading of tags. Figure 7 presents the process for recognizing a cow's ID.The two readers may read the same tag and transmit the same tag ID number to the remote database via the DTB.The remote management system will check whether these two numbers are the same.If the two numbers are the same, then the remote system will discard one, use the number to search the database, and transmit the obtained information about the health of the cow in question to the corresponding IDB.If the two numbers differ, then the management system will find the information associated with these two numbers and determine which information is correct.In the worst case, the correct information cannot be determined and the management system transmits an error message to the IDB in the parlor.The farmer and remote manager will see this message and try to solve the problem.
3.5.Remote Software System.The remote software system includes a graphic user interface (GUI) program, an online database program (MySQL), and an Android application program.The GUI program is written in the C/C++ language.The program is used to control the RS-232 serial transmission to the RFID readers, DTBs and IDBs.The program also searches and updates the database and deletes information concerning the cows.The manager can perform operations on the database using the computer in the management center or an Android-based mobile phone on which the designed application program is installed.
The remote management system receives the IDs in the tag(s) from the RFID readers through the DTB, and the system performs an analysis to check the IDs.The tag(s) are used to find health information about the cow in the database.
Then, these data are encoded, the checksum is added, and the information is sent to the corresponding IDB.If the information about the health of the cow cannot be found in the database, then a warning message is sent to the corresponding IDB in the parlor.When the messages come from the DTB, the remote system determines whether they are instructions.Such instructions include data retransmission and system reset.
Figure 8 presents the GUI-based management system.The upper half of the GUI presents the numbers of the milking positions in the parlor, the recognized ID of each cow, and the health status of its four udders.The numbers of the four udders in the GUI are their numbers in the IDB.The pink color of the number indicates that the udder suffers from mastitis.For instance, a cow in the first milking position has a mastitis infection in its right-rear udder.The cow in the second milking position has only its left-rear udder without mastitis.The lower half of the GUI presents detailed information on the temperature and EC of four udders of the cow.New data or historical data of the cow with a selected ID number can also be found in the system.The bottom of the GUI presents histograms of the historical values.Other  functions of the system include system initialization, the updating of health information, and database management.The system manager can set which farmer can access or update health information.The farmer with the right priority can also use a mobile phone to access or update information about the health of cows in the remote database using the mobile or WIFI network.

Experimental Results
An experiment is performed using the proposed system on a farm with approximately 200 cows.The system was deployed and used for one month on the farm.Milking was carried out approximately 3,000 times during this month.
The experiment included various tests, which evaluated the sensitivity and speed of RFID recognition, the transmission quality of the network, and the quality of the system.The parlor on the farm is an open environment, and the path through is a ring.In the parlor, ten cows can be milked simultaneously.Figure 9 presents the deployment of the system in the parlor.The cows enter the parlor through the right entrance.Two RFID readers are set up at the entrance of the parlor, and the IDBs are set in front of the cow as it would be in that position.These IDBs are connected together by twisted pairs of wires.One DTB is also connected with the IDBs and communicates with the remote management system via Zigbee WSN.
The experiment on the sensitivity of the RFID reader is performed by putting different numbers of the readers in different positions; each cow has an RFID tag on its right ear.About 3,000 tests were performed on the cows, yielding the results in Table 1.The experimental results reveal that a cow in the parlor typically adopts one of four postures: head forward, head pointing upward, head pointing downward, and head swinging.The RFID reader set up on the upper and left side relative to a cow yields a miss, because each tag is attached to the right ear of a cow, outside the range of the reader.When the head of the cow is held upward or downward, the larger angles between the cow and the reader may cause a miss to occur.In such cases a cow cannot be detected outside the range of the reader.Two readers have a success rate of 100% for all postures, because one reader is installed before the other but they are on both sides of the entrance.These positions of the readers prevent simultaneous misses by both readers.

Conclusions
The proposed management system utilizes RFID, WSN, embedded system, and cloud database designs.The system is a low-cost, high-efficiency management system that can prevent milking cows that suffer from mastitis; a detection device rapidly detects the cows with mastitis.The results of a check performed using this device are transmitted to a remote database and shown in the corresponding IDB before the cow is milked.The management software integrates a graphical user interface and a cloud database.A manager or farmer can easily search and update the information about the health of the cows through the network.The advantages of the system include reducing the risk of milking a cow with mastitis, the rapid testing for mastitis to update health information, and improving the quality of produced milk.Multiple systems can be set up in many farms and managed from a centralized management center.

Figure 1 :
Figure 1: Two color belts are tied to both hind legs of the cow.

Figure 2 :
Figure 2: Proposed mastitis detection and health management system.

Figure 3 :Figure 4 :
Figure 3: Detection of mastitis in proposed system.
Figure 5  presents the hardware architecture of the information display board (IDB).The ARM Cortex M3 controls the entire embedded system; it controls the LCD display, which displays information about the health of the cow, and uses LEDs to present control and warning messages.The control area network (CAN) bus connects all IDBs.The updated program reinitializes the MCU through the USB port.The mastitis detection device is connected to the MCU via the A/D connection port.Figure6presents the IDB device.The number of IDBs is determined by the number of positions for milking in the parlor.Near each position, an IDB is set up that displays information on the health of the cow that is waiting for milking.In detection mode, the IDB displays information concerning the four udders.Numbers 1 and 3 in the circles in the IDB indicate the left-front and left-rear udders.Numbers 2 and 4 indicate the right-front and right-rear udders.The button in the IDB can be used to choose the udder on which mastitis detection is carried out.When the detection device finishes the detection processes, the measured data, including temperature and EC values, are transmitted to the information display and presented at the position of the corresponding udder, and the old information in the database

Figure 7 :
Figure 7: ID recognition using two RFID readers.

Figure 8 :
Figure 8: User interface of the management system.

Figure 9 :
Figure 9: Proposed system set up in a parlor.

Table 1 :
Results of test of RFID sensitivity.