Final Project

.

Final Project Description:

Story behind project

When i took my first tour of Vigyan Ashram (FAB LAB 0) i noticed some students who are taking care of animals in shelter.The students i am talking about belongs to animal husbandary section of Vigyan Ashram.What i came to know about them that each students have an assigned duty to take care of the cattle's in shelter.That cattle shelter is simply just opposite my hostel where i stay.I can see all the activity from my room window.What i saw is completely heart touching.Since one cattle from the shelter is pregnant so that some students used to stay late at night to take care of cattles & other animals.Here their problem and source of motivation start....
After spending night in cattle shelter they used to took breakfast and got fresh and just few hours later they need to attend their theory classes.During day time when their classes is running students found very difficult to monitor health of the cattle.One day i was sitting to my window and what i saw that the cattle is shouting very loudly and i didnt understand why this so!.In the evening i got to know that she had a very high fever and the problem is that animal doctor who used to check the cattle is alredy leave the town and rest story you can understnd .The doctor come in the morning and check the cattle health and she had a very high fever .He give medicine to her and after two three days that cattle got normal.This whole thing i seen from my window and i suddenly start feeling that there is real need to monitor the health of animals regularly not even in special situation but also in normal situation as well.So then i decided to design a system which will monitor the helath of the cattle.

  • Project title:Cattle Health Monitoring System
  • Smiley face

    First Sketch

    Introduction

    As we all aware about the fact that day by day there is a drastic increase in pollution and effects of global warming creates a huge challenges infront of farmers. Exposure of cattle to these envirnomental changes produces reduction in the amount of feed intake and milk production.So looking to this i am planning to design a system that will monitor the body temperature, heartrate , weight of cattle etc and sent this information on loacl server.So by obeserving this data from local server doctor can take necessary preventive actions to keep the health pf cattle normal.
    In this project we will be focus on monitoring the health of cattle’s by using non-invasive, low cost sensors technology that detect sudden change in body parameter like temperature, blood pressure etc. The parameter that is taken by sensors are access by using wireless technology collect data use for early detection of dieases this things are going to develops by using IOT[1].

    Literature Survey:

    After finalising above idea i started working on it.For that i went through some of the well known researcher's paper who actually worked on that and tried to understands whats actually thet thoughts about this problem and how they solved it. I have mentioned below some of the authors papers and their works as well that actually helped me to shape of my idea in detailed.

    1) Anuj Kumar and Gerhard P. Hancke, Senior Member, IEEE presented a article on "A Zigbee-Based Animal Health Monitoring System" in Article in IEEE Sensors Journal · January 2014.They have design a Zigbee-Based animal health monitoring system.In which they have used Zigbee module-microcontroller-GUI.

    2) Sweta Jha along with co-authors presented a paper on "E-Cattle Health Monitoring System Using IOT".In this they have described how to monitor routinely the health of dairy cattle.In this system they talked about the sensors,wireless networks.

    3) D.Aswini, S.Santhya, T.Shri Nandheni , N.Sukirthini published a paper on "Cattle Health and Environment Monitoring System" in International Research Journal of Engineering and Technology (IRJET).
    In this paper they have nicely documented a few drawbacks of present system like Farmers are unaware when the cattle are affected by disease,time consuming etc.

    4) Myeong-Chul Park ,Hyon-Chel,Tae-Koon ,Ok-Kyoon presented a paper on "Design of cattle health monitoring system using wireless bio-sensor networks". In this paper, they have design a cattle health monitoring system to help prevent livestock diseases, such as foot-and-mouth disease using bio-sensors.

  • In this paper, author design a cattle health monitoring system to help prevent livestock diseases, such as foot-and-mouth disease, using bio-sensors.
  • Problem statement:

    Now a days, monitoring health of cattles is an challenging job for farmers.Catlles are facing several dieases which i discussed above.This result reduction in milk product .So the farmer's who run dairy farms used the different techniques to observe the animal health and provide the treatement accordingly but to monitor the large number of animals in dairy farms reallly challenging one for a single farmers/owner.So ultimetely farmers need to increase the quantity of labour to monitor the health of cattles and take care of them so that they cant get any dieases.Here is the problem for farmers which is increaseing the quantity of labour result into investment of large amount of money and again not sure properly monitoring of cattles by labour as farmers expected.Also availability of doctors on time is an issued in rural areas.I noticed this issued and decide to used the advantage of technology to make a system who will monitor the health of cattles as well as give accurate information about the dieases which results into providing proper treatement on time to prevent the animal/cattles from any dieases by the doctors/farmers.Above all farmers get benifited.

    Current challenge:

  • Increase the quantity of labour to monitor the health of cattles that cause investing large amount of money again which is not a good solutions.
  • Doctors cant come to farmers place/dairy farms regularly to monitor the health of cattles,availability doctors is an issued.
  • Monitoring the cattles all the time got enganged the Farmers at farms only.He cant do other stuffs.(Time consuming job)
  • Introduction:

    As i went through some literatures and site visits i start working on my plan and tried to put things in one .First i thought about the things i required to fullfill above requirments so i listed out some of them first.

    Initial Propsed idea:Small cattle shelter

  • Design a smart belt which consits of sets of sensors like Body temperature , heart rate sensors that will take the data from cattles body.
  • Consits of some of the Output devices like LCD display ,LEDS to indicate the read data.
  • Build a local server to send the data
  • Doctor/farmer can monitor the data from their place
  • Propsed Electronic system:

    Modified proposed idea:Big cattles shelters

    This is the final modified idea which i need to work on it.In this modified idea i proposed a system which is based on server - client based communication.Actually in earlier design we have planned to have single system having different sensors mount on it but disadvantage of this system is that if there ware a two or muliple cattle and you want to monitor the body temeprature of one cattle and herat rate of other one then you cant used single system simultaneously for both.This process will take more time to collect the data of differnt cattles and then provide the necessary treatment to cattles again time mangement is an critical issues to monitor the health of cattles.So we are planning to build a independant single sensor based "smart bell" system .The advantage of having individual smart bell is that we can used these multiple smart bell simultaneously on different cattles and read the respectve data from it.Once the used of perticular smart bell is over we can excahnge this with other cattle.This way we can utilised the time and prevent the cattle from causeing any dieases.

    Need to build:

  • Server - controller with output device such as OLED,LED
  • Client1 - controller with Body temperature sensor module
  • Estalblish server-client communication
  • Interface output device with server board
  • Iterface input device with client board
  • Making web application i.e.UI for showing sensor data
  • Making of Server:

    BOM

    Sr.No. Componant Quantity Price Brought from
    01 ESP 12E Wifi Module 01 1.89$ ElectronicsComp.com
    02 ESP 12E Wifi Development board 01 3.14$ ElectronicsComp.com
    03 OLED Display 01 5.33$ Amazon
    04 LM 35 Body temp sensor 01 2.54$ Amazon

    Electronics design & Electronic production:

    As i described above i have design server module.So i used ESP 12-E chip for wireless communication.Also ESP -12E having in built wi-fi.So i took this advantage for my server-client communiction.

    3D printer design:

    For server module i have decided to make 3D printed case.I have design sketch in solidwork software and later i on using fractal 3D printer i printed case.

    For detailed description of 3D printing please visit 3D scanning and printing assignments.

    Making of client:

    Laser cutter design:

    For client module i have decided to used laser cutter machine.Again i design the sketch in solidwork.

    What is LM35 temperature sensor?

    The LM35 series are precision integrated-circuit temperature devices with an output voltage linearly-proportional to the Centigrade temperature. ... The low-output impedance, linear output, and precise inherent calibration of the LM35 device makes interfacing to readout or control circuitry especially easy.

    Test my LM35 temperature sensor?:

  • 1.Test setup for LM34 sensor
  • 2.LM35 output shows the temperature is 74.2 °F.
  • 3.Sensor output goes up if you touch it with a finger (showing 81.4 °F)
  • Note:Always keep LM 35 sensor closed contact with part of body otherwise it will shows an ambient temperature.

    Programming to Estalblish server-client communication:

    Objective:

  • 1.Written a code for how to read the body temp of cattle using LM 35 sensor
  • 2.Written a code for how to sent body temp data to server side
  • programming:

    Here i written server code to received the data(LM35 body temp sensor) from client.

    Objective 1 :Server side program:

    
    #include <WiFiClient.h>
    #include <WiFiServer.h>
    #include <WiFiUdp.h>
    
    #include <ESP8266WiFi.h>
    #include <ESP8266WebServer.h>
    
    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    #include <Adafruit_Sensor.h>
    
    #define SCREEN_WIDTH 128 // OLED display width, in pixels
    #define SCREEN_HEIGHT 64 // OLED display height, in pixels
    
    
    Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
    
    char * ssid_ap = "Redmi";
    char * password_ap = "12345678";
    IPAddress ip(192,168,11,4);
    IPAddress gateway(192,168,11,1);
    IPAddress subnet(255,255,255,0);
    
    ESP8266WebServer server;
    
    float sensor_value1=0.0;
    float sensor_value2=0.0;
    void setup(){
      WiFi.mode(WIFI_AP);
      WiFi.softAPConfig(ip,gateway,subnet);
      WiFi.softAP(ssid_ap,password_ap);
      Serial.begin(115200);
      Serial.println();
      Serial.print("IP Address:");Serial.println(WiFi.localIP());
      server.on("/",handleIndex);
      server.on("/update",handleUpdate);
      server.begin();
    
    
      if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
        Serial.println(F("SSD1306 allocation failed"));
        for(;;);
      }
      delay(2000);
      display.clearDisplay();
      display.setTextColor(WHITE);
    }
    void loop(){
    server.handleClient();
    
    
    display.clearDisplay();
      
      // display temperature
      display.setTextSize(1);
      display.setCursor(0,0);
      display.print("Body Temp: ");
      display.setTextSize(2);
      display.setCursor(0,10);
      display.print(sensor_value1);
      display.print(" ");
      display.setTextSize(1);
      display.cp437(true);
      display.write(167);
      display.setTextSize(2);
      display.print("C");
      
     display.display(); 
    }
    void handleIndex(){
      
      //server.send(200,"text/plain",String(sensor_value));
     server.send(200, "text/html", SendHTML(sensor_value1,sensor_value2)); 
      //server.send(200, "text/html", SendHTML(sensor_value2)); 
    }
    
    void handleUpdate(){
      sensor_value1 = server.arg("value1").toFloat();
      Serial.println(sensor_value1);
     // server.send(200,"text/plain","Updated");
      sensor_value2 = server.arg("value2").toFloat();
      Serial.println(sensor_value2);
      server.send(200,"text/plain","Updated");
    }
    String SendHTML(float Temperaturestat){
      String ptr = 
     "<!DOCTYPE html> <html>\n";
      ptr +=
     "<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n";
      ptr +=
     " <meta http-equiv='refresh' content='2' >\n";
      ptr +=
     "<title>Vigyan Ashram </title>\n";
      ptr +=
     "<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n";
      ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;}\n";
      ptr +="p {font-size: 24px;color: #444444;margin-bottom: 10px;}\n";
      ptr +="
     .heart-rate { \n";
      ptr +="
     width: 150px;\n";
      ptr +="
     height: 73px; \n";
      ptr +="
     position: relative;\n";
      ptr +="margin: 20px \n";
      ptr +=" auto;}\n";
      ptr +=".fade-in {\n";
      ptr +="position: absolute;\n";
     ptr +=" 
     width: 100%;height:100%;\n";
     ptr +=" 
     background-color: #FFFFFF;\n";
     ptr +="
     top: 0;\n";
     ptr +="right: 0;\n";
     ptr +="
     animation: heartRateIn 2.5s linear infinite;}\n";
     ptr +="
     .fade-out {\n";
     ptr +=" 
     position: absolute; \n";
     ptr +="
     width: 120%; \n";
     ptr +=" height: 100%;\n"; 
     ptr +="top: 0;\n"; 
     ptr +="left: -120%;\n";
     ptr +=" 
     animation: heartRateOut 2.5s linear infinite;\n";
     ptr +="
     background: rgba(255, 255, 255, 1);\n";
     ptr +="
     background: -moz-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 50%,
     rgba(255, 255, 255, 0) 100%);\n";
     ptr +=" 
     background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 50%, 
     rgba(255, 255, 255, 0) 100%);\n";
     ptr +="
     background: -o-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 50%, 
     rgba(255, 255, 255, 0) 100%);\n";
     ptr +="
     background: -ms-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 50%, 
     rgba(255, 255, 255, 0) 100%);\n"; 
     ptr +=" 
     background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 1) 80%, 
     rgba(255, 255, 255, 0) 100%);}";
     ptr +="
     @keyframes heartRateIn { 0% { width: 100%; }50% { width: 0;  }100% { width: 0;}}";
     ptr +="
     @keyframes heartRateOut { 0% {left: -120%;}30% { left: -120%;} 100% { left: 0; }}";
     ptr +=".heart {\n";
     ptr +="fill: red;\n";
     ptr +="position: relative;\n";
     ptr +="top: 5px;\n";
     ptr +="width: 50px;\n";
     ptr +=" animation: pulse 1s ease infinite;}\n";
     ptr +="
     @keyframes pulse {0% { transform: scale(1); }50% { transform: scale(1.3); } 100% { transform: scale(1); }}\n"; 
     ptr +=".logo {\n";
      ptr +="display: block; \n";
       ptr +=" text-indent: -9999px;\n";
      ptr +=" width: 100px;\n";
       ptr +="height: 82px;\n";
       ptr +="background: url(kiwi.svg);\n";
       ptr +="background-size: 100px 82px;}\n";
      
      ptr +="</style>\n";
      ptr +="</head>\n";
      ptr +="<body>\n";
      ptr +="<div id=\"webpage\">\n";
      ptr +=
     "<h1><font color='red'>Cattle health monitoring system</font></h1>\n";
     
          
      ptr +="<div class='container'>";
      ptr +="<div class='data temperature'>";
      ptr +="<div class='side-by-side icon'>";
      ptr +="<svg enable-background='
     new 0 0 19.438 54.003'height=54.003px id=Layer_1 version=1.1 viewBox='0 0 19.438 54.003'
     width=19.438px x=0px xml:space=preserve xmlns=http://
     www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink y=0px>
     <g><path d='M11.976,8.82v-2h4.084V6.063C16.06,2.715,13.345,0,9.996,
     0H9.313C5.965,0,3.252,2.715,3.252,6.063v30.982";
      ptr +=
     "C1.261,38.825,0,41.403,0,44.286c0,5.367,4.351,9.718,9.719,9.718c5.368,0,9.719-4.351,9.719-9.718";
      ptr +=
     "c0-2.943-1.312-5.574-3.378-7.355V18.436h-3.914v-2h3.914v-2.808h-4.084v-2h4.084V8.82H11.976z M15.302,44.833";
      ptr +=
     "c0,3.083-2.5,5.583-5.583,5.583s-5.583-2.5-5.583-5.583c0-2.279,1.368-4.236,3.326-5.104V24.257C7.462,23.01,8.472,22,9.719,22";
      ptr +=
     "s2.257,1.01,2.257,2.257V39.73C13.934,40.597,15.302,42.554,15.302,44.833z'fill=#F29C21 /
     ></g></svg>";
      ptr +=
     "</div>";
      ptr +=
     "<div class='side-by-side text'>Temperature</div>";
      ptr +=
     "<div class='side-by-side reading'>";
     // ptr +="<p>sensor_value ";
      ptr +=(int)
     Temperaturestat;
      "<svg version='1.0' xmlns='http://www.w3.org/2000/svg'
     xmlns:xlink='http://www.w3.org/1999/ xlink' x='0px' y='0px' width='150px' height='73px' 
     viewBox='0 0 150 73'  enable-background='new 0 0 150 73'
     xml:space=preserve>";
      ptr +=
     "<polyline fill='none' stroke='#009B9E' stroke-width='3' stroke-miterlimit='10'
     points='0,45.486 38.514,45.486 44.595,33.324 50.676,45.486 57.771,45.486 62.838,55.622 71.959,9 80.067,63.729 84.122,
     45.486 97.297,45.486 103.379,40.419 110.473,45.486 150,45.486'/></
     svg>";
      ptr +=
     "<div class='fade-in'></div>";
      ptr +=
     "<div class='fade-out'></div>";
      ptr +="</div>";
      ptr +="<svg class='heart' 
     viewBox='0 0 32 29.6'>\n";
      ptr +=
     " <path d='M23.6,0c-3.4,0-6.3,2.7-7.6,5.6C14.7,2.7,11.8,0,8.4,0C3.8,0,
     0,3.8,0,8.4c0,9.4,9.5,11.9,16,21.2 c6.1-9.3,16-12.1,16-21.2C32,3.8,28.2,0,23.6,0z'
     /></svg>\n"; ptr +=
     "</div>";
            ptr +=
     "<span class='superscript'>    </span></div>"; 
      ptr +="</div>";
      ptr +="</div>";
      ptr +="</div>\n";
      ptr +="</body>\n";
      ptr +="</html>\n";
      return ptr;
    }
    
    

    Objective 2: client side program to sent the body temp of cattle using LM 35 to server:

    #include <ESP8266WiFi.h>
    float volts = 0.0,temperatureC = 0.0;
    const char* ssid = "Redmi";
    const char* password = "12345678";
    const char* host = "192.168.11.4";
    WiFiClient client;
    const int sleepTimeSeconds = 60;
    void setup() {
      pinMode(A0,INPUT);
      WiFi.begin(ssid,password);
      Serial.begin(115200);
      //Serial.println("Resp: ");
      while(WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
      }
      Serial.println();
      Serial.print("IP Address (AP): "); Serial.println(WiFi.localIP());
      
       volts = analogRead(A0)*3300/1024;
       temperatureC = volts/10;
      
     
      
      Serial.print("Temperature C:");Serial.println(temperatureC);
      if(client.connect(host,80)) {
       String url = "/update?value1=";
        url += String(temperatureC);
        client.print(String("GET ") +url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" +
                     "Connection: Keep-alive\r\n\r\n");
                     delay(10);
                     Serial.println("Response: ");
                     while(client.available()){
                      String line = client.readStringUntil('\r');
                      Serial.print(line);
                     }
      
      }
      Serial.println("ESP 8266 IN SLEEP MODE");
      ESP.deepSleep(sleepTimeSeconds * 1e6);
     }
    void loop() {
      
    }  
    
    

    Making web application i.e.UI for showing sensor data:

    Networking & communication:

    In Networking & communication i have designed a UI to show the sensor read data continuously with an interval of 60 sec.Once server module get on ,client module send the data to server module.Enter IP address in URL window then sensor value stsrt displaying on UI.

    Screenshot:Showing body temp of cattle on HTML web page on specified web address

    Assembling:

    After doing all above activities now time to assembled the part.I have assembled the server 3D printer case , Laser cutter Client module.

    Presentation video:

    Creative Commons License
    Cattle Health Monitoring System by Vikram Ingole is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.