Project tutorial
Automatic IoT Eggs Incubator

Automatic IoT Eggs Incubator © GPL3+

Observe automatic eggs incubation from any location.

  • 2,991 views
  • 0 comments
  • 3 respects

Components and supplies

About this project

Eggs Incubation is an interesting topic among the Arduino enthusiastic. Basically, it is similar to the type of incubator which can be used as a substitute of poultry chicken to incubate the chicken eggs automatically. It will be helpful for the farmers to incubate the eggs automatically without the need of human intervention, by keeping the physical quantities such as temperature and humidity at required level, so that the fetuses inside them will grow and incubates without the presence of mother.

Furthermore, egg incubator will not only improve the poultry production considerably but will also help in the regularity of income making, enabling the farmers to be able to get transition into possible rural entrepreneurship.

This project uses a CavyIoT-DevBoard (firmware) and CavyIoT platform as a service..

With the help of Control Panel from anywhere we can

  • Monitor live sensor data in Charts, Gauges.
  • Control all operations of incubator.
  • Set triggers to automate the incubator processing from remote location.
  • Record all operations of incubator for further analysis.
  • Convert a log file to PDF and JSON format.
  • Can select the AUTO and MANUAL mode of operation.

Prerequisite:

  • Registered account at CavyIoT developers site.
  • ESP8266 board installed in your Arduino IDE.

If not registered then register your account at https://www.developers.cavyiot.com with your valid email id, it is free.After successful registration, within five minute you will get email verification code at registered email address.Login with your registered username and password. and verify your email. Once the verification is done, you will get free Demo device with validity of one month.(You can see Demo device in your client area )

If ESP8266 board is not installed in your Arduino IDE follow this step.The ESP8266 community created an add-on for the Arduino IDE that allows you to program the ESP8266 using the Arduino IDE and its programming language.Start Arduino and open Preferences window.Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.Open Boards Manager from Tools > Board menu and find esp8266 platform. Select the version from a drop-down box. Click install button. Don’t forget to select your NodeMCU 1.0 (ESP-12E Module) board from Tools > Board menu after installation.

The project is explained in 4 steps.

First step

  • Is about how to flash CavyIoT firmware using Arduino IDE in NodeMCU to covert it into CavyIoT-DevBoard.

Second Step

Explains in details about, How to

  • connect CavyIoT-DevBoard with an Arduino.
  • send data from sensor DHT11 and servo angle to server via Dev-Board.

Third Step

  • Is for, how to control device from control panel and how to set triggers for automation.

Fourth Step

  • Finalize the project with enclosure arrangement.

OK! Let Start now !

Step 1: Flashing firmware overinternet using http-update.

  • In the Arduino IDE, navigate to Sketch > Include Library > Add.ZIP Library. At the top of the drop down list, select the option to Add.ZIP Library.
  • Then select downloaded ZIP file and click Open.
  • Return to the Sketch > Include Library menu. menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in your sketch. The zip file will have been expanded in the libraries folder in your Arduino sketches directory. The Library will be available to use in sketches, but with older IDE versions examples for the library will not be exposed in the File > Examples until after the IDE has restarted.
  • Upload ESP8266-httpupdate sketch In the Arduino IDE, navigate to File > Examples > CavyIoTdevelopmentBoard-master > ESP8266-httpupdate and open this example sketch.
  • Then select board and COM port properly. NodeMCU is selected in this example.

Don’t forget to select your 'NodeMCU 1.0 (ESP-12E Module)' board

  • After Done Uploading open serial monitor (Baudrate:9600, Both NL & CR) and Reset the NodeMCU and wait for 2 minutes to complete flashing. You will see output on serial monitor as shown below:

Flashing Done!

Congratulation now you have your own CavyIoT-DevBoard !

Step 2:Interfacing with Arduino

Make circuit arrangement as shown below.

IoT Incubator Circuit connection

Circuit description:

Arduino, DevBoard connection

  • Arduino Pin 10, 11, 13 connected to Tx, Rx, rst of Dev-Board.

Arduino, SensorandServoconnection

  • Arduino Pin 9 connected to the servo control.
  • Arduino Pin 8 is connected to Data pin of DHT11

DevBoard, Four channel relay connection

  • DevBoard Index pin 0 (D2 of NodeMCU) to IN1 of Relay Board
  • DevBoard Index pin 1 (D5 of NodeMCU) to IN2 of Relay Board
  • DevBoard Index pin 2 (D6 of NodeMCU) to IN3 of Relay Board
  • DevBoard Index pin 3 (D7 of NodeMCU) to IN4 of Relay Board

Relayconnections are arranged

Relay-1 to control Bulb 100 Watt (heat source)

Relay-2 to control Humidifier

Relay-3 to control In-fan

Relay-4 to control Ex-fan

Power supply

  • Arduino UNO (5 Volt via USB)
  • DevBoard (3.3 V )
  • Relay Board (5V)
  • Bulb 100 Watt (240 V AC mains) via Relay1
  • Humidifier (240 V AC mains )via Relay2 (assumed here is with inbuilt Adapter)
  • 2 PC fan (12 V DC 1 Amp)Via Relay3 & Relay4 one is for air inlet and another is for Exhaust.

Note:Power supply to NodeMCU and Realy Board In the schematic is shown as, is driven from Arduino for convenience. But I recommend to use separate power supply to avoid load on USB supply.

And upload incubator.ino sketch to Aruino UNO board. Don't forget to replace your Wi-Fi SSID and password along with CavyIoT credentials in the sketch.

Now open serial monitor and see the output.The device you made is working well if it is as below.(Reset Arduino UNO if needed).

Arduino Serial output

Now login to CavyIoT And operate it from control panel.Check all buttons weather working properly or not.

To check servo function, I suggest check servo router timer of one minute by removing comment of code line 23, 80 and 81.

Incubator control panel.

Control Panel

Owe Amazing ! done !

Step 3: Now we will see how to set triggers for automation.

Go to the client area.

Menu Appears After click on 'Set Triggers' Button

Select sensor, condition and enter value for desired action from the menu.you can set up to four triggers for automation. It is very easy.

Click on save button to save setting result will be as below within one minute.On the screen of client area.

Now switch to AUTO mode of working and sit back in chair and see how the controls are working automatically. Arrange DHT11 sensor near Bulb to heat if temperature rises Bulb will OFF automatically.This ensures CavyIoT triggers are working from server.

One Important feature of DevBoard we are going to know about is Log file of all operations ! And for this you have run the circuit for a hour or two for testing. After that remove all connections of DevBoard from Arduino. Unplug Arduino from USB.

Method to Download log file from CavyIoT DevBoard.

  • Connect B pin of DevBoard to ground ( D0 of NodeMCU).
  • Plug USB cable of DevBoard to computer.
  • And restart Nodemcu.
  • Open Serial monitor

DevBoard Local Server Started.

Now connect to the Hot-Spot password admin@123, created by CavyIoT DevBoard for serving Log File.

after connecting browse to url http://100.100.100.100

From the download link download log file and save it to your computer. This log file is in CSV format. You can print, can convert in JSON /PDF format for analysis and so on. Online tool CSV to PDF is available for this on your control panel.

Output of CSV to PDF converter looks like,

CSV to PDF/JSON

(For all information about control panel link is given at the bottom of project).

Up to this point covered about Dev-Boards are

  • how to download firmware
  • Interfacing with Arduino
  • How to download Log file.

Step 4:

And to finalize the project. Arrange the circuit as before download operation.and make an arrangement shown as as below in a wooden box.

In this arrangement two compartment are made, right one is for the 'Eggs tray router assembly,

  • Egg tray router mechanism is arranged with servo motor.
  • The exhaust fan is to control the excessive heat. This exhaust fan can be controlled via control panel.
  • DHT-11 Sensor.

and in the left side arrangement is as,

  • 100 watt bulb is used as a heat source.
  • Humidifier
  • PC fan (kept permanently ON) is to circulate air for the uniform distribution of temperature and humidity in the Eggs tray chamber. ( Note: not shown in the circuit)
  • To minimize the heat and humidity leakage from the incubator, there is a inlet for the fresh air at the bottom of the box.

Diagram below shows the principle of egg tray mechanism.

hatching eggs are placed in setter trays with the air cell up and turned regularly through angles of 90° or 45° on either side of eggs’ long axis. Historically, arguments for the need to turn eggs frequently were (1) poor temperature distribution in the albumen and yolk and/or (2) the risk of the embryo and extra-embryonic membranes sticking to the inner shell membrane.

Turning is therefore essential during days 0-10, when the early extra-embryonic yolk sac membrane and sub-embryonic fluid are being formed, and the recommended frequency for turning Eggs is 4 times in a day ( see how it is implemented in the code ).

Important links for reference.

know more about Control Panel

know more about CavyIoT-DevBoard

Code

IoT Incubator C/C++
In Arduino IDE for ESP8266 (Node MCU)
#include <Servo.h> 
#include <DHT.h> // library of DHT11 temperature and humidity sensor
#include <CavyIoTdevelopmentBoard.h>
//----------------------Servo Connection---------------------------------------------
#define SERVO 9
Servo myservo;
//----------------------DHT11 connection------------------------------------
DHT dht(8, DHT11);
//--------------------------------------------------------------------------

//---------------For communication with DevBoard ----------------------------
#define rx 10
#define tx 11
#define rst 13
//---------------------------------------------------------------------------
CavyIoT myIoTdevice;       //Create instance of CavyIoT Object.
//---------------------------------------------------------------------------
//----------------Timer and Scheme of Eggs Tray Router-----------------------
int routerScheme=1;
long int current_time;
long int start_time=millis();
long int Interval=6*60*60*1000;//Timer Six hour
//Interval=60000;//Uncomment for checking servo functions TimerOne minute.
//---------------------------------------------------------------------------
//--------------------- Sensor Variables ------------------------------------
float temp;
float hum;
int  angle;
//--------------------------------------------------------------------------
void setup()
  {
   Serial.begin(9600);
   myIoTdevice.SetPort(rx,tx,rst);
   dht.begin();
   myservo.write(45);
   myservo.attach(9);
    myservo.detach();
     
//--------------------- Button Labels----------------------------------------   
  Serial.println("Setting device buttons!.");             
   myIoTdevice.DefineButtonLables
               ( "Heat",   "on",  "off",
                 "Humid",  "on",  "off",
                 "E-Fan",  "on","  off",
                 "I-Fan",  "on",  "off"
                 );
  Serial.println("Wait for a while to connect!");
  /*------To start Device replace your own credentials here-----------------------------*/ 
  myIoTdevice.StartDevice
  /*Your Wi-Fi router->*/("WiFi-SSID","WiFi-password",
   /* CavyIoT------>*/"Username","password","Device");//
 //--------------------------------------------------------------------------
   }

void loop()
  {
    current_time=millis();                                   
    myIoTdevice.loop();  //Updates the Status variable.                           
   //--------------------------------------------------------------------- 
    /* Prints the current status of Buttons & working mode of device from          control panel on  Serial monitor.*/
   Serial.println("Device Status:-"+myIoTdevice.Status);
   
   //---------Read values from sensor and angle of servo---------------------
  
   temp=dht.readTemperature();
   hum=dht.readHumidity(); 
  
   //----------------Sending data to server----------------------------------
   myIoTdevice.UpdateSensorData
      ( "Temperature",String(temp),  "C",
         "humidity",  String(hum),   "Rh",
        "Tray-Angle", String(angle), "deg"
      );
 //-------------------Check timer for router scheme-------------------------
   if(current_time-start_time>Interval)
        { myservo.attach(9);
         rotateTray(routerScheme);
         start_time=current_time;
         //Uncomment for debug 
         //Serial.print("Servo is working ,router scheme :");
         //Serial.println(routerScheme);
         
        } 
 //-------------------------------------------------------------------------
 

}//End of loop
 //-----------------------------------------------------------------------  

/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////  
void rotateTray(int scheme)
{ int current_position=myservo.read();

  if (scheme==0)
  {     
    for(current_position;current_position <=45;current_position+= 1) 
     {  angle= current_position;                               
      myservo.write(current_position);  // tell servo to go to position                                              // variable 'current_position' 
     delay(50);                     // for smoother movement of Servo.
      
     }
     
  }
if (scheme==1)
  {
    for(current_position;current_position <=90;current_position+= 1) 
     {angle= current_position;                                    
      myservo.write(current_position);  // tell servo to go to position                                              // variable 'current_position'
     delay(50);                         // for smoother movement of Servo.
     
     }
  }
if (scheme==2)
  { 
    for(current_position;current_position >=45;current_position-= 1)
     { angle= current_position;                                  
      myservo.write(current_position);   // tell servo to go to position                                              // variable 'current_position' 
     delay(50);                          // for smoother movement of Servo.
     
     }
  }
 if (scheme==3)
  {
    
    for(current_position;current_position >=0;current_position-= 1) 
     {
      angle= current_position;                                   
      myservo.write(current_position); // tell servo to go to position                                              // variable 'current_position'
     delay(50);                        // for smoother movement of Servo.
     
     }
   }
   
  routerScheme=routerScheme+1;
  myservo.detach();
  if(routerScheme>3)routerScheme=0;  
}

Comments

Similar projects you might like

IoT Blink - Getting started with IoT

Project showcase by AppShed Support

  • 4,743 views
  • 1 comment
  • 22 respects

IoT Node with STM32F4 Discovery, MKR1000 and Azure IoT Hub

Project tutorial by vincent wong

  • 2,139 views
  • 0 comments
  • 6 respects

IoT Thermometer Using Python

Project tutorial by Luigi Francesco Cerfeda

  • 10,581 views
  • 4 comments
  • 28 respects

Mozilla IoT WoT Gateway and ESP8266

Project tutorial by Giovanni Gentile

  • 4,011 views
  • 0 comments
  • 7 respects

IoT IR Programmable Transcoder - TV Remote on Steroids

Project in progress by Team Trouble

  • 3,633 views
  • 3 comments
  • 10 respects
Add projectSign up / Login