IOT based Dairy Data Management System using Raspberry PI

DOI : 10.17577/IJERTCONV8IS14006

Download Full-Text PDF Cite this Publication

Text Only Version

IOT based Dairy Data Management System using Raspberry PI

Swarnadas H V1*

Department of Electronics & Communication Engineering Malnad College of Engineering

Hassan. Karnataka

Dr. B R Sujatha2

Department of Electronics & Communication Engineering Malnad College of Engineering

Hassan. Karnataka

Abstract Milk is a supplement rich, white fluid food produced by the mammary organ of evolved creatures. The high calibre milk ought to have thickness and must be devoid of adulterants. The country milk makers expect fair price for the milk produced and the consumers expect good quality milk at a reasonable cost. So it is important to guarantee the quality of milk by estimating different parameters such as temperature and fat of milk. This work aims to build up an automated system to determine the milk parameters and also measure the weight or amount of milk. With the help of Internet of Things (IOT) this huge database can be maintained in the cloud platform which is safe and secure than the existing method. All these information can also be shared with the farmers as well as with the higher authorities of dairy farms and subsequently information transparency can be maintained. This work can also be used in several other applications where data management and online financial transactions are required.

KeywordsTkinter; Ubidots; Weight Sensor; IOT


    Dairy farming is one of the old-age businesses that are being practiced by Indian farmers along with agriculture. For millions of rural families, dairy farming has become a secondary source of income. India is one of the largest producers of milk in the world. During 1970s National Dairy Development Board initiated White revolution that transformed a milk deficient nation into worlds largest milk producers. Dairy cultivation involves raising and dealing with milk yielding cattle, collecting and processing of milk for different dairy items. The export of dairy products such as ghee, butter, cheese, ice creams etc. has increased significantly which is contributing to a greater extent in nations development. The major challenge in dairy farming is to maintain the large data related to all the farmers supplying milk. In the conventional method where the hardcopy of data is maintained, it is an inefficient way and the work is tedious. India has highest numbers of dairy farms that is about 75 million dairy farms and in each farm more than thousand farmers deposit the milk daily. We can imagine how big the data is and this big data needs to be maintained properly and accurately. The primary milk providers to the dairy farm are farmers. Since large numbers of farmers are depositing the milk in the dairy, it is a daily task of the dairy officers to check the quality of milk and verify the quality norms specified by the government and based on quality and quantity of milk, payments are issued accordingly. In many dairy farms, computer aided control has helped in elimination of some tedious workload but still requiring data management. Therefore, there is a need for automation to be introduced into

    dairy farming. Hence, an appropriate technology is to be developed to maintain the large amount of data and also the system should be user friendly which in turn should increase the profit of both end users. In this work the existing system used for dairy data management is upgraded by using Internet of things (IOT) to assimilate and store the data securely.

    IOT based systems are being designed and used in many fields. Also considerable amount of work is being done.

    Abhishek M. Aware [1] presents a detailed view of the development of low cost and efficient milk parameter detection and analysing system that allows the measurement of quantitative and qualitative parameters.

    Thejasvini. M. S [2] have shown that the implementation of IOT in dairy for data management leads to proper payment of the amount. Accurate information storage related to milk such as fat content, quantity, temperature etc. is automated. This system leads to transparency.

    K. Haribabu [3] in his survey paper presents a detailed view about how to develop a low cost system that consumes less power in measuring the milk parameters using the sensors and lactometer.

    Pranav Thanedar [4] has proposed a system that enables the farmers as well the milk collection centres to analyze the quality of milk. Also the graphical analysis of the data would enable the decision maker to fix prices dynamically thus enabling the end users with the benefits and the farmers will get proper response for their deposition.

    The rest of the paper is organised as follows, Section II provides the system description and design followed by Section III that details the implementation of the work. Section IV discusses the outcome of the work followed by conclusion.


    In this section we discuss about the block diagram of the whole proposed system and details of the individual components. Raspberry Pi is the main device used which is interfaced with other components as shown in Figure 1.

    1. Raspberry Pi

      Raspberry Pi is a low cost credit-card sized processor board which is capable of doing everything a desktop computer can do. The raspberry pi has the ability to interact with the outside world when connected to a network and hence it is more suitable for IOT applications.

      Fig. 1 Block diagram

      All models feature a Broadcom system on a chip with an integrated ARM-compatible central processing unit (CPU) and an on-chip graphics processing unit(GPU). It has an ARM1176JZF-S processor. The Broadcom SoC used in the Raspberry Pi is equivalent to a chip that is operating at 700 MHz by default. Processor speed and memory varies for different models of Pi. Secure Digital (SD) cards are used to store the operating system and also it is used as RAM. The boards have one to five USB ports. Lower-level output is provided by a number of GPIO pins, which support common protocols like SPI and I2C. The Pi Zero is the smallest, thinnest and most-affordable Pi ever.

    2. RFID card and reader

      RFID is an acronym for radio-frequency identification. RFID device refers to a tiny electronic gadget that comprise of a small chip and an antenna. This small chip is capable of accumulating approximately 2000 bytes of data or information. Radio waves are utilized to move information from the card or tag to a reader. RFID cards comprise of a RFID transceiver for transferring data from one system to another. The main advantage of RFID reader is easy interface to the computer serial terminal through DB9 connector or direct interface to microcontroller via onboard connectors.

    3. LDR Module

      Light dependent resistors (LDR) are light sensitive devices used to indicate the presence or absence of light or to measure the light intensity. An LDR mainly have a variable resistance that changes with the light intensity that falls upon it. The working principle of LDR is, when light fall on LDR the resistance decreases and more current can flow through it. When LDR is kept in the dark place, its resistance is high hence small amount of current can flow through it.

    4. Temperature sensor

      DS18B20 is a digital temperature sensor that works on a single wire-bus. It is a pre-wired and waterproofed version. It has 64-bit ROM with an inbuilt 12bit ADC. The DS18B20 powers-up in a low-power idle state; to initiate the temperature measurement and Analog to Digital conversion. The sensor is widely used in the fields such as HVAC

      environmental control, emperature detection of building, liquid temperature measurement and many more applications.

    5. Weight sensor (HX711)

    A load cell or weight sensor is one kind of sensor mostly used as weighing machine. Every weighing machine has a load cell as sensing element. A load cell is like a transducer that converts force into electrical signal. The signal can be a change in voltage, current, resistance or frequency based on the load as well as the circuit used or depending upon the application. But the performance of the weighing system can be influenced by several factors like vibration, temperature, environment, maintenance, and structural movement.


    1. Identification Phase

      RFID tags and RFID reader are used for the purpose of authentication. Individual RFID cards with unique ID will be distributed to the farmers and all the information related to the farmer can be accessed using it. If the farmer ID gets matched with one of the stored ID in the database then the identification process is done successfully.

    2. Fat Detection Phase

      LED light source with the LDR sensor is used to detect the presence of fat content in the milk. The fat globules present in the raw milk have the capacity to scatter a beam of light. The amount of light scattered by the milk sample is equal to the fat content in the milk. A beam of light from LED strip is made to pass through the milk sample. To ensure good nutrition level to the customer, government has set some standard range. For cow milk the fat range is 3.5%-4% and for buffalo milk it is 6%-7%.

    3. Temperature and Quantity measurement Phase

      The temperature measurement of milk is important to determine all the essential nutrients, so that it is good for consumption. The temperature of the milk should be within the specified range or else it leads to the development of bacteria and the milk may not be fit for consumption. For this DSB1820 temperature sensor is used. Once the quality testing is done, the quantity of the milk is measured by using a rectangular load cell and HX711 weight sensor. The measurement is done in terms of millilitres.

    4. Bill Generation Phase

      Based on the data collected after the qualitative and quantitative analyses of the milk, the price of milk is calculated. The billing is done automatically after cross- verifying the milk parameters with standard range specified by the government. All the data will be stored automatically in the cloud platform Ubidots using IOT. All the information related to individual farmer can be viewed on users mobile phone and the same copy can be forwarded to head office, milk collector and dairy manager by using the messaging service provided by Ubidots.

    5. Software design

    Initially the farmer should register by entering all his details in the application form that is created using Tkinter, a library function available in python. After successful registration the farmers will get the RFID cards with unique ID. VNC viewer is the software used to program Raspberry- Pi. By entering the IP address generated for the connected hotspot in VNC viewer, raspberry pi window can be accessed. Cloud application for data management is created using Ubidots platform where the entire data is stored.


    The overview of the system is as shown in Figure 2. Initially the farmers personal details are entered in the application form that is created using Tkinter library function and after successful registration RFID cards with unique ID will be issued to all the farmers. The RFID card is swiped by the farmer. The RFID reader will then read and search for the ID number. If the ID number gets matched with that of the farmer, details will be displayed on the LCD. First quality testing is done that includes determining the temperature value and fat content present in the milk.

    To measure the fat content, the milk sample is placed between LDR sensor and LED light source. The fat globule present in milk has the capacity to scatter the light. Poor quality milk contains more water and hence allows the light to pass through it. Hence, based on the light intensity sensed by the LDR sensor, the presence of fat content in the milk is detected. Milk has its own temperature criteria which should be maintained during storage. If the milk is mixed with water or with any toxic materials the temperature of the milk will not be in the normal range. The temperature of the milk is measured by using Temperature sensor DSB1820 which is measured in terms of degree Celsius. The temperature value and fat content of milk will be displayed on LCD. After quality testing, the quantity of milk is measured by using weight sensor HX711 and a rectangular load cell of 1kg capacity and the measurement is done in terms of millilitres. When the load cell amplifier is connected to the Raspberry Pi, changes in the resistance of the load cell will be read by the Raspberry Pi with some calibrations. This method gives accurate weight measurements.

    Fig. 2 Overview of the system

    Automated billing is done and the amount is calculated based on the quantity of milk collected after qualitative analysis. The customer details and payment details will be maintained in the Cloud platform Ubidots using IOT. After uploading the data to cloud all the details will be sent to the farmer through SMS. If any unauthorized user swipes the card then no match will be found for that ID and it is indicated on LCD as Invalid ID. All the above steps will be repeated for other farmers.


    This work results in the elimination of manual errors that occur while entering the data. The cloud data storage is an additional benefit. The milk parameters such as weight, temperature and fat which are measured using this system give good results, that is developed with low cost. Use of RFID cards to enter the daily transaction information of farmers makes it convenient for the dairy management and also it is beneficial to the farmers as well. Thus, the usage of this system will satisfy the both end users qualitatively and economically.

    1. Identification of farmer

      RFID cards are given to each farmer. In co-operative dairies RFID card is read by the RFID reader. If the card is valid the command valid card will be displayed on LCD and further process will be carried out, if not the output Invalid ID will be displayed on LCD

    2. Quality measurement

      This includes two section temperature measurement and fat detection phase.

      1. Temperature measurement:

        Fig. 3 Temperature sensor dipped in the milk

        To determine the temperature value of the milk temperature sensor DS18B20 is dipped in the milk sample as shown in Figure 3. The measured temperature value will be displayed on LCD as shown in Figure 4.

        Fig. 4 Temperature value displayed on LCD

      2. Fat measurement:

      A beam of light from LED is made to pass through the milk sample, LDR sensor is placed exactly on the opposite side of the test tube to detect the amount of light passing through the test tube as shown in Figure 5. To obtain maximum sensitivity the test tube is covered which has opening only for LED strip and LDR sensor. If the milk sample allows the light to pass through it then the milk contains low fat and if it doesnt allow the light then the milk contains high fat content. The fat range and the amount are displayed on LCD as shown in Figure 6.

      Fig. 5 Fat testing module

      Fig. 6 Fat range and amount displayed on LCD

    3. Quantity measurement

      Milk quantity is measured by using rectangular load cell and HX711 sensor module. The milk is weighed in terms of millilitres. The amount will be calculated based on the quantity of milk. The results obtained will be displayed on the LCD screen.

    4. Messaging

      All the information will be sent to farmer through the message service, it contains infrmation such as date, time, quantity, fat and total amount of daily transaction as shown in Figure 7.

      Fig. 7 Message received by farmers in mobile

    5. Database Storage

      Ubidots is a different platform that enables the users to easily capture sensor data and turn it into useful information. Data can be sent to the cloud from any Internet- enabled device. All the records of the dairy will be maintained in Ubidots, the cloud platform contains different fields such as user name, date, time, fat, quantity and total amount as shown in Figure 8. This data can be viewed in Ubidots using the data visualization tools.

      Fig. 8 Data related to dairy updated in Ubidots


We have developed a prototype module for smart dairy management system that will help the farmers and end users as there is lot of transparency in the system. In future, this model can be taken to the product level. Since dairy data needs to be updated regularly, this system makes the work easier than the traditional method of data management as data will be uploaded automatically. The time required for computing quantity and quality of milk will be reduced and the obtained data is also accurate.


I wish to express my deep sense of gratitude to Department of E&C Engineering, Malnad College of Engineering, Hassan and Loginware Softtec Pvt. Ltd., Hassan who gave me the opportunity to do this work.


    1. Abhishek M Aware, Ujwala A Kshirsagar Design of Milk Analysis System for Dairy Farmers using Embedded System, International Journal of Innovative Research in Electrical, Electronics,

      Instrumentation and Control Engineering, Vol. 5, Issue 5, May 2017

    2. Thejavini M S, S Jyothi Data Management of Milk Dairy using Cloud Applications, Journal of Engineering Research and Application, ISSN : 2248- 9622, Vol. 9, Issue 5, May 2019, pp 47-51

    3. K Haribabu An IoT Detection of Milk Parameters using Raspberry PI and GSM for Diary Farmers, International Journal of Innovative Technology and Exploring Engineering, ISSN: 2278- 3075,

      Volume-8, Issue-4, February 2019

    4. Pranav Thanedar Enhanced Automation of Milk Analyzer Using Internet of Things (IoT) and Data Mining, International Journal of Interdisciplinary Innovative Research & Development, ISSN: 2456- 236X, Vol. 03, Issue 01 | 2018

    5. M Sujatha Visible Spectroscopy Analysis of Fat Content in Milk using Lab VIEW, International Journal of Recent Technology and Engineering, ISSN: 2277-3878, Volume-7, Issue-5S4, February 2019

    6. Devesh Bhonge, Yashpal Gogia Design and Analysis of a Sensor for Measurement of Fat content in Milk using optical technique, International Journal of Engineering and Technical Research, ISSN: 2321-0869, Volume-4, Issue-4, April 2016

    7. Muthunoori Naresh, P Munaswamy Smart Agriculture System using IoT Technology, International Journal of Recent Technology and Engineering, ISSN: 2277-3878, Volume-7, Issue-5, January 2019

    8. K S Dar Eliassen Enhancing Dependability of Cloud-Based IoT Services through Virtualization, 2016 IEEE First International Conference on Internet-of-Things Design and Implementation (IoTDI), 2016, pp. 106-116

    9. Janggwan Im IoT Mashup as a Service: Cloud-based Mashup Service for the Internet of Things, 2013 IEEE 10th International Conference on Services Computing

    10. Cheah Wai Zhao Loon Exploring IOT Application Using Raspberry Pi, International Journal of Computer Networks and Applications, Volume 2, Issue 1, January – February (2015)

    11. Hany F Atlam Integration of Cloud Computing with Internet of Things: Challenges and Open Issues, 2017 IEEE International Conference on Internet of Things (iThings)

[12] N. Fathima, A. Ahammed, R. Banu, B.D. Parameshachari, and N.M. Naik, Optimized neighbor discovery in Internet of Things (IoT), In Proc. of International Conference on Electrical, Electronics, Communication, Computer, and Optimization Techniques (ICEECCOT), pp. 1-5, 2017

Leave a Reply