=Paper= {{Paper |id=Vol-1498/HAICTA_2015_paper73 |storemode=property |title=A Sensor Based Management and Monitoring System for the Identification of Lambs Focusing on Milk Productivity Upturns |pdfUrl=https://ceur-ws.org/Vol-1498/HAICTA_2015_paper73.pdf |volume=Vol-1498 |dblpUrl=https://dblp.org/rec/conf/haicta/GodasKTVL15 }} ==A Sensor Based Management and Monitoring System for the Identification of Lambs Focusing on Milk Productivity Upturns== https://ceur-ws.org/Vol-1498/HAICTA_2015_paper73.pdf
A Sensor Based Management and Monitoring System for
     the Identification of Lambs Focusing on Milk
                  Productivity Upturns

 Dimitrios Godas1, Sotirios Kontogiannis2, Markos Tsipouras3, Stavros Valsamidis4
                            and Themistoklis Lazaridis5
    1
       Department of Business Administration, Technological Educational Institute of West
            Macedonia, Grevena, 51100, Greece, e-mail: k4mikazi666@gmail.com
     2
       Department of Business Administration, Technological Educational Institute of West
               Macedonia, Grevena, 51100, Greece, e-mail: skontog@ee.duth.gr
     3
       Department of Business Administration, Technological Educational Institute of West
          Macedonia, Grevena, 51100, Greece, e-mail: markos.tsipouras@gmail.com
  4
    Department of Accounting, Technological Educational Institution of East Macedonia and
           Thrace, Ag. Silas, 65500 Kavala, Greece, e-mail: svalsam@teikav.edu.gr
     5
       Department of Business Administration, Technological Educational Institute of West
               Macedonia, Grevena, 51100, Greece, e-mail: themis@themis.gr



        Abstract. This paper presents a new system architecture and test bed
        application implementation called Sheep Manager. Sheep Manager system
        uses NFC technology for the identification of sheep inside a flock as well as
        sensors for the real-time measurements and recording of raw milk extraction
        per ewe. All recorded information are then stored into the cloud. Authors also
        propose an algorithm for sheep breed selection that uses feedback information
        from past successful breeds in order to increase milk productivity.

        Keywords: sheep management system, breed selection algorithm, sensor
        based system, NFC technology.



1 Introduction

The demand for animal traceability and identification follows a continuously
increasing curve. Nowadays tools that provide identification capabilities in
combination with animal attributes traceability that characterize each animal in a
flock are a necessity. Such necessity for livestock identification on the sheep
industry, may assist for the prevention of certain forms of transmissible spongiform
encephalopathy or other disease forms, increase the quantity and quality of products
such as milk, cheese or wheat and assure low cost but of a high standard nutritional
food for the stock.
   From the consumer’s part, animal traceability is a very important aspect.
Traceability nowadays does not cover only the ability to trace the product back to its
producer or production date or present information regarding products’ ingredients as
a result of chemical analysis. On the contrary, attributes regarding sheep’s nutritional




                                            651
habits, environmental growth conditions, herd grazing time, or other metrics
regarding flock hygiene are also of importance and need to be traced.
   From a technological point of view, RFID technology is set to be the key player
for animal identification in livestock. RFID technology shows advantages over
previous technologies such as barcodes or QR-codes. RFIDs do not require direct
line of sight and are not easily tore or worn. RFID tags have longer reading range.
There are tags that have writing capability (with the use of specific recording device
up to 4KB in passive and 1MB in active tags). Furthermore, there are RFID sensor
tags (active or semi-passive energy harvesting tags) that include sensors and may
transfer measurements of temperature, humidity, vibration, luminosity etc. up to 100
meters away (Ruiz-Garcia and Lunadei , 2011), (Hammer et al., 2015).
   Regarding feeding technologies and nutritional habits of ewes in the
Mediterranean environment for the purpose of improving milk quantity and quality,
sensors and sensor networks can play a very important role. Sensors may affect
animals’ nutritional habits and increase milk quantitative and qualitative
characteristics. Sensors that monitor confined lactating ewes’ environmental
conditions may lead to the reduction of ewes’ heat stress. Sensors that monitor and
coordinate irrigation of grazing fields, especially in summer seasons also affect
positively ewes’ nutrition. Moreover, since feeding value of crop residues especially
in summer is often low, a sensor based system that coordinates mixing of forage or
other forms of nutritional additives in silos increases milk productivity and
qualitative characteristics (Sitzia et al., 2015), (Gaja et al., 2005).
   Finally, passive injectable RFID transponders are used instead of ear tag based
ones or neck lace placed ones. Injectable identification transponders is a far better
technique in terms of safe-placement and accuracy (Gaja et al., 2005), (Collin et al.,
2002),but still receives susceptibility from producers and requires further research
and validation (Collin et al., 2002). In extent, RF energy harvesting techniques are
nowadays investigated for powering up passive injectable RFID transponders with
incorporated RF power up sensors.
   In this paper authors present an architecture and implementation of a sheep
identification and sensor management system called Sheep Manager. Sheep Manager
uses NFC close contact RFID technology for the identification of sheep and flow
sensors installed in the milking machine for the recording of ewe milk production.
Identification information of ewes’ daily milk production as well as per ewe
nutritional daily habits is recorded to an Information system set as the cloud. Sheep
manager system comes with an android Sheep Client application and a breeding
algorithm that selects the appropriate sheep to breed based on productivity trends and
incest avoidance.


2 Cloud and NFC Technologies Used by the Architecture

   RFID is the technology used for identifying items using radio waves. At a
minimum, an RFID system includes a tag, a reader, and an antenna. The reader sends
a request to the tag via the antenna, and the tag replies with its unique stored
information. RFID tags are either active or passive and use either: 1. Low




                                          652
Frequencies (LF) 125 -134 kHz, 2. High Frequencies (HF) 13.56MHz, 3. Ultra High
Frequencies (UHF) 433, 856-960ΜΗz and 4. Microwave Frequencies 2.4-3.1 GHz
for request reply data transmission (Ruiz-Garcia and Lunadei, 2011), (Voulodimos
et al., 2010), (Hammer et al., 2015). RFIDs can cover distances from 10cm to 300m
for UHF and microwave frequencies and from 10cm to 1m for MF and LF
frequencies (Ali et al., 2014), (Ruiz-Garcia and Lunadei, 2011).


2.1 NFC Identification Technology Used

   NFC is a close contact RFID technology that operates at 13.56 MHz. It uses
ISO/IEC 14443 standard for contact-less smart cards operating in close proximity
(~10cm) with a reader antenna, an extension of High Frequency (HF) RFID
standards. NFC therefore shares many similar physical properties with RFID such as
one way communication and the ability to communicate without a direct or clear line
of sight.
   There are however four key differences between RFIDs and NFC technologies
(Ali et al. , 2014): 1. NFC is capable of two way communication and can therefore be
used for more complex interactions such as card read-write operations performed
from the same device and peer-to-peer (P2P) sharing, 2. NFC devices are limited to
communication at close proximity, 3. Only a single NFC tag can be scanned at one
time of interaction while RFID enforces simultaneous scanning and 4. NFC
transponders are now included in a majority of mobile phones and this is perhaps the
most important difference between NFC and RFID. Table 1 presents the major
differences of both technologies.

Table 1. Comparison of NFC and RFID technologies.

       Characteristic       RFID technology-passive         NFC technology
       Operating
                                     LF/HF/UHF                 HF:13.56MHz
       Frequency:
       Communication:                                          Two way-(RW
                             One way (One device for read
                                                                  operations
                                  another for write)
                                                              simultaneously)
       Standards:              ISO 14443, 15693, 18000            ISO 14443
       Scan Tags                                            No. – Faster scanning
                                         Yes
       Simultaneously:                                               time
       Incorporated into                                     Yes for contactless
                                         No
       mobile phone:                                             transactions

   Concluding, based on NFC characteristics, it is obvious that NFC technology can
perform similar to RFID (with the exception of close contact) and provide vast
portability, easy to program and easy to use capabilities.




                                         653
2.2 Collection of Livestock Data

   Collection of livestock sensor data or NFC identification is performed by a simple
HTTP POST operation of a session upload protocol following the Representational
State Transfer (REST) architecture (Richardson and Ruby, 2007). That is, clients
send HTTP requests to an open service to the Information system application server
and the application service stores the request data to the database using prepared SQL
statements (transactions). The format that the data are being transmitted follows the
(REST) architecture for session protocols (Richardson and Ruby, 2007).
   REST session protocols are a simple way to organize interactions between
independent systems. REST allows you to interact with minimal overhead with
mobile phone clients and other websites. REST uses JSON (JavaScript Object
notation) and POST/GET HTTP requests for data transmission. In theory, REST is
not tied to the web and can be used wherever HTTP protocol is used.
   The alternatives of REST are complex implementations. That is, conventions on
top of HTTP with the form of a XML-based language notation. The most illustrious
example is SOAP. SOAP provides session level complexity with protocol conversion
mechanisms (XML encode- XML parse, service requirements and processing
capabilities), and thus not using HTTP to its fullest power. Because REST has been
inspired by HTTP and plays to its strengths, it is the best and simplest way to
transmit HTTP data in terms of `variable=value`.


3 Proposed System Architecture

   Authors propose a system called Sheep Manager for the identification and
recording of sheep productivity and characteristics. The proposed system uses NFC
tags and NFC capable mobile phones for the performance of read-write operations on
tags. Authors also propose a breeding selection mechanism that is included in the
system. All system information along with nutritional data and sheep attitude
characteristics are send into the cloud. That is, an application server equipped with a
MySQL database that records productivity and animal profile information.


3.1 The Sheep Manager System

The sheep manager system architecture is presented at Fig. 1 and includes the
following structural parts:
   S1: The Application server where the owner of each stockyard authenticates
himself with the Information system application service in order to gain access to its
private database, where recording of information regarding his herd takes place.
   S2: The main sheep yard of a closed establishment, where sheep milk gets
extracted with the use of an electrical milking machine (Fig. 1 rectangular dashed
line area), with coral or pen extensions where ewes wait for their milking process.
This area is equipped with Internet connectivity via appropriate DSL router and Wi-
Fi coverage (Wi-Fi access point-ADSL router). In the same area resides the modified




                                          654
milking machine and sheep owner’s mobile phone with the Sheep Manager NFC
client application. All sheep are equipped with their own NFC tags, previously
initialized with a unique id and places behind their ear.
   The sheep owner has the ability to:
          - Write a new tag with a new ID and add it to a newborn ship.
          - Update information regarding sheep’s gender, mother ID, father ID,
              mood or characteristics or nutritional habits and upload such
              information to the tag (sheep’s profile information) and therefore to the
              application server.
          - Perform an ID read and collect sheep’s profile information by placing
              his phone in close proximity to the sheep’s ear.
          - Perform a breed search between an ewe and a ram by placing his phone
              in close proximity of both sheep ears and ask the application server to
              check if such breeding is permissible.
          - Capture and upload data of milk extracted per sheep in liters (lt) with
              the use of two sensors located into the milking machine.




Fig. 1. Sheep Manager system high-level architecture. Figure shows the ewes’ permanent
closed yard where the milk is extracted and information between sensors and Application
server is exchanged via the Sheep-Manager Application

  The modified milking machine includes two sensors (see Fig. 1, Milk Flow #1 and
#2): A flow sensor M1, located at the milking machine hose and a liquid level sensor
M5, located inside the milk collection bottle of the machine. Both sensors are




                                         655
controlled by a microcontroller equipped with a Wi-Fi shield, in order to connect via
the access point to the application server and upload its measurements.
Measurements upload from microcontroller to the application server, are performed
upon request from the Sheep Manager client application (mobile phone of the sheep
owner) upon request and the collected data of milk quantity (in liters) is stored and
accumulated to the daily record of the sheep that was last identified by the owner’s
mobile phone. That is, daily total milk quantity sums are stored automatically by the
application server at the end of each day and statistical means of productivity are
updated.
   The use of two sensors instead of one in the milking machine for the calculation of
milk extraction per sheep is for calibration purposes of the flow sensor M1, since
milk’s density and viscosity changes from sheep to sheep area to area and time of
year and milking pumps of machines have different flow rates and technical
specifications (flow sensor is a cheap sensor to use but requires frequent calibration).
    In case of multiple milking machines, one flow sensor can be installed to only one
machine for other machines to calibrate. Finally, if the milking machine’s pump is
out of order and the milking process needs to be performed by hand, the
measurement of produced milk is not lost. The milkman can pour the milk with the
use of a funnel from the top of the collection bottle and measure its quantity without
the use of the flow sensor.
   Furthermore, all milk quantity measurements are performed in a differential real-
time manner: That is, time 0, is the time where an ewe is NFC identified. The milk in
the bottle at that time is considered as milk of 0 liters for that animal. When the
milking process of that animal is finished and another animal enters the milking area
and identifies itself with the NFC tag, then this is considered as time 1 for the
previously identified sheep. The (time 1– time 0) milk quantity is considered to be
the extracted milk quantity in liters of the previous sheep, as uploaded to the
application server.
   Authors’ proposed system architecture is close to the FARMA platform proposed
at (Voulodimos et al., 2010). The main differences between FARMA and authors’
implementation follow:
   1. Our architecture utilizes NFC instead of RFID technology for the sheep
        identification process. In fact our solution is portable to any Android mobile
        phone NFC capable, while FARMA solution requires an RDIF reader-writer
        embedded into a mobile device usually a small notebook or PC.
   2. Our architecture uses sensors to transmit data (milk quantity extracted per
        sheep and may include other sensors) and focuses only to sheep industry.
   3. Our architecture uses different implementation technologies. While FARMA
        utilizes C# for its client application and protocol and SQL database server and
        IIS-ASP for its Application services, our implementation uses Android Java
        for the client, a REST HTTP mechanism instead of an XML data transmission
        mechanism for data collection and PHP-MySQL-Apache for the database and
        Information system application services.




                                           656
3.2 Proposed Breeding Algorithm


   Authors proposed breeding algorithm uses two independent processes:
   Process 1: The pure breed selection algorithm, where a check for breed is
performed up to the depth of k generations set be the milk owner (default value of k
is set empirically to 7 generations). If there is a common ancestor between an ewe
and a ram for a depth of k then the breeding process is denied as a degenerated one
and appropriate alert message is displayed into the Sheep client application. If no
common ancestors found then process 2 takes place.
   Process 2: In this process the average yearly milk production by that ewe is
compared to that of the herd. That is, a percentage threshold set by the farm owner of
the milk quantity of the ewe that produced the maximum average yearly quantities in
the herd. If milk quantities of that ewe are bellow threshold then a warning message
is displayed to the Sheep client application for actions to be taken (The breed can be
performed).

   With mID being the potential ewe ID and fID being the potential ram ID in the
Information system’s database, the pure breed selection algorithm operates as
follows:
Pure_breed_selection_algorithm (mID, fID)
         P = [mID, fID]
         P = sort(P)
         prevP = P
         gen = 0
         common = 0
         while (gen<= k) and (common == 0)
                  tempP = ∅
                  foreachitem in prevP
                           [item_mID, item_fID] = search(item, database)
                           tempP = tempP∪[item_mID, item_fID]
                  end
                  tempP = sort(tempP)
                  P = merge(P, tempP)
                  gen = gen + 1
                  prevP = tempP
                  if check(P) common = gen
         end
         return common
end

where:
   • sort is a sorting function (quick sort).
   • search is a search function for an item ID in the database (binary search) and
       returns the item’s mother and father IDs (item_mID and item_fID).
   • merge is a function merging two sorted arrays.




                                         657
    •    check is a function that checks for common ancestor existence. Since P is a
         sorted array with IDs, a common ancestor will appear as two consecutive
         same IDs. Thus, check function returns 1 if there are at least two
         consecutive positions in the P array with the same value, and 0 otherwise.

   The algorithm returns the first generation with a common ancestor or 0 (if there is
no common ancestor in the last k generations).


4 Testbed Sheep Manager Client Application Implementation

   The Sheep Manager Client application is an Android application can be installed
into the sheep producer’s Android OS mobile phone (Godas and Kontogiannis,
2014). The application authenticates the farm owner into the information system and
the system’s database where the farm owner records information regarding its
livestock. The application’s main window and sub-activities are illustrated in the
following Fig. 2:




Fig. 2. Sheep Client application Main window and Dialogs-activities: A1. Farmer Application
Authentication Window, A2. Main Window, A3. Add sheep Activity then write NFC tag
activity and A4. Search sheep activity by hand or by NFC tag touch.

The Sheep Manager application has the following capabilities:
        A1. Authenticate to the Sheep Client Application server. The farm owner
            authenticates himself to the Sheep Manager system service with a




                                            658
             username and password via HTTPS protocol in order to acquire access
             to his flock database.
         A2. Sheep Client application Main Activity. This form shows the available
             application options of adding a sheep to the flock database and
             searching for a specific sheep. Delete and update operations have not
             been implemented and can be performed only by the Sheep Manager
             application and database server administrator.
         A3. Add NFC tag and overwrite identification activity. In this activity the
             farm owner fills out an ID for the NFC tag to be placed to a newly born
             sheep. He also fills out the sheep’s gender as well as its mother’s and
             father’s ids. Then by clicking Add sheep data button a Timer
             instantiates that gives time to the sheep owner to place his phone in
             touch proximity near the sheep’s ear. When the characteristic NFC
             found sound occurs a new activity called write NFC tag is instantiated
             and by pressing write the tag is overwritten.
         A4. The search Activity has dual operation. That is, read NFC tag ID
             automatically by placing the mobile phone in close contact to the NFC
             tag. Then sheep’s ID is revealed and searching information regarding
             the selected sheep from the Information system’s database (Mother ID,
             Father Id and gender) by clicking search button.




Fig. 3. Sheep Manager application check breed activity form with breed check algorithm


   Finally, in the preliminary Sheep Manager application a breed activity form (see
Fig. 3) is included, where the breeding search algorithm was incorporated. This
preliminary version of breeding algorithm has the ability to search for ewe’s sheep
ID in comparison to a ram’s ID in depth of k generation and check whether they can
breed or not. Generation search parameter k can be set by the sheep owner and by
default is initialized to the empirically set by sheep breeders value of seven
generations-level search.
   The breed selection is set to true only if both sheep ancestors have never breed
before in depth of seven generations. This is because from our preliminary studies
regarding breeding and milk production seven generations distance between ram and
ewe was mentioned by farm owners as a good start point for sheep race breeding in
order to avoid incest that affects milk quality.




                                            659
5 Conclusions

   In this paper authors propose a Sheep manager system that uses NFC technology
for sheep identification and breed selection purposes, accompanied by suitable
proposed breeding algorithm. Sheep management system is also capable for
monitoring ewes daily milk productivity, sheep nutritional habits and sheep race-
breed and character characteristics for traceability purposes.
   Authors implemented their proposed system NFC sheep identification and
selection part. This preliminary implementation includes a client application installed
into the sheep owner mobile phone in order to perform read-write NFC operations
and perform breed requests. Also authors propose a breeding algorithm that is also
implemented to the proposed system for the purpose of sheep breeding check and
validate.
   Authors set as future work the final implementation or their system into a live herd
where both milk sensor data as well as nutritional information per sheep shall be
recorded automatically to the Sheep manager application service.


References

1. Ali, A., Abdellatif, R., Tarrad, I., and Youssef, M. (2014) International Journal of
   Software Engineering and Its Application 8(2), 255–266.
2. Collin, C., Gaja, G., Nehring, R., and Ribo, O. (2002) J. Anim. Sci. 80(0), 919–
   925.
3. Gaja, G., Hernamdez-Jover, G., Conill, C., Garin, D., Alabern, X., Farriol, B., and
   Ghirardi, J. (2005) J. Anim. Sci. 83(0), 2215–2224.
4. Godas, D. and Kontogiannis, S. Sheep Manager: Livestock administration and
   management application (2014).
5. Hammer, N., Felix, A., Dagmar, J., Gallmann, E., and Jungbluth, T. (2015)
   Computers and Electronics in Agriculture 113(0), 81 – 92.
6. Richardson, L. and Ruby, S. (2007) Restful Web Services, O’Reilly, first edition.
7. Ruiz-Garcia, L. and Lunadei, L. (2011) Computers and Electronics in Agriculture
   79(1), 42–50.
8. Sitzia, M., Bonanno, A., Todaro, M., Cannas, A., Atzori, A., Francesconi, A., and
   Trabalza-Marinucci, M. (2015) Small Ruminant Research 126(0), 43 –58.
9. Voulodimos, A. S., Patrikakis, C. Z., Sideridis, A. B., Ntafis, V. A., and Xylouri,
   E. M. (2010) Computers and Electronics in Agriculture 70(2), 380–388.




                                          660