Egg Incubator Using DHT11 and Android App.

Introduction: Egg Incubator Using DHT11 and Android App.

About: I am Professional Engineer and Part timely hobbyist in Arduino, NodeMCU, IoT Cloud,AI ,Robotic, College & School student projects.

Incubating eggs is a fun, 21-day project that can be successful with careful attention and a few special pieces of equipment. With care, vigilance and planning, you will be able to hatch baby chicks that grow up to become part of your backyard flock.

Hatching eggs at home can be a fun project for those looking to grow their backyard flocks. Incubating chicken eggs is a 21-day process and requires an egg incubator to help control temperature, humidity and egg turning.

A step-by-step guide to hatching eggs: For hatching to occur, the eggs must be fertile. Prior to incubation, a fertilized egg can be stored for a maximum of 7 days in a cool room kept at a steady 55-60 degrees Fahrenheit (not in the refrigerator – it’s too cold!). Once the fertilized eggs are placed in the warm incubator, they may develop over the course of 21 days, with the proper incubator set-up and care. How to set up the egg incubator Fertile eggs can be hatched by using an egg incubator. An incubator is an enclosed structure with a fan and heater to keep eggs warm during the 21-day incubation period. Here developed using an incubator with some automatic features, such as egg turning (which is critical to chick development and to keep the chick from sticking to the inside surface of the shell) and a circulation fan to facilitate even heat distribution. Temperature and humidity inside the incubator are critical factors for successfully hatching eggs. Suggested guidelines are as follows: Optimum temperature: 38 degrees Celsius. Temperature range: 37-39 degrees Celsius Don’t let temperature drop below 37 degrees Celsius Do not allow temps of 40 degrees Celsius to last more than a few hours Double-check the incubator’s thermometer with a medical thermometer placed nearby to ensure the gauge is working properly. Relative humidity, day 1-17: 50-55 percent Equivalent to a wet bulb temperature of 29-30 degrees Celsius. Keep water channels in the incubator full to facilitate proper humidity Relative humidity, day 18-21: On day 18, raise the relative humidity to 70 percent Use a hygrometer to ensure humidity levels are correct throughout the incubation period Only open the incubator when necessary – doing so can let heat and humidity escape and can affect the success of the hatch. Increase ventilation as embryos grow bigger, especially from days 18-21. Keep in mind these are recommendations for hatching chicken eggs Days 7-10: Candling eggs Towards the middle of the incubation period at 7 to 10 days, eggs can be candled to determine if the embryos are growing properly. If you notice broken or leaking eggs, remove them from the incubator as they are not likely to be viable and may contaminate the incubator. After candling, return eggs to the incubator and return to the day 1-24 turning schedule. Day 1-18: Turning the eggs After setting the eggs, the incubation process begins. An important part of this process is turning, or rotating, the eggs. Days 18-21: Pre-hatching By day 18, the embryo has developed into a chick and will take up most of the space in the egg. The chick is preparing to hatch. You can do a few things to best help the baby chick prepare: Stop egg-turning at day 18 with the larger end of the egg facing up. At this point, the chick will position itself for hatching inside the egg. Maintain a temperature of 38 degrees Celsius but increase humidity to 70 percent. Day 21: Baby chicks start hatching Chicks will typically hatch at day 21. If the fertilized eggs were cooled prior to incubation, the process might take a little longer. If you are at day 21 with no hatch, give the eggs a few more days.

Component Required:
1. Arduino UNO R3

2. LCD 20x4

3. Bluetooth HC-05

4. Push Button - 4 nos

5.Dip switch 2

6. relay 230V/10a - 2 nos

7. Fan - 2nos

8. Servo

9. DHT11

10.LED

11. Buzzer

Connections:
The SW1 dip switch 1 selector in 5V position is Temperature Cursor selection and DIP switch GND position for Humidity Cursor selection, after selecting the mode the Push button S3 & S4 for Low value setting increment & Decrement, Push button S1 & S2 for High value setting increment & Decrement for Temperature or Humidity depends on the SW1 dip position.

The SW1 dip switch 2 Position in 5V is Egg Tray Turn on Position and Dip switch GND position is Egg tray Turn Off position. The Tray Rotation is made for every one hour and is start initially from position 0° to 90° after a minute and start to rotation mode. First Position from 90°,135°,90°,45° repeatedly for every one hour for each angle position servo motor rotates.

Timer function After the 21 days the times comes to day = 0, H = 0, M =0, S = 0 and then Buzzer alert.

//Define and adding library

#include

#include

#include

LiquidCrystal_I2C lcd(0x27,20,4);

#include

#include

Servo myservo; // create servo object to control a servo

int pos; // variable to store the servo position

// eeprom value

byte eeprom_value;

// timer for sensor and delay

long last_read_from_sensor = 0;

const long sensor_read_delay = 1000;

// sensor pin

#define DHT_PIN A0

// sensor setup

dht DHT;

// maximum and minimum

const int TempMin = 15;

const int TempMax = 50;

const int HumiMin = 20;

const int HumiMax = 99;

//Set to humidity/temp

const int THsetbutton = 7;

const int Traybutton = 2;

int Eggtray = 12;

int Buzzer = 11;

// first value

const int LowRange_UPButton = 3;

const int LowRange_DownButton = 4;

int T1setpoint = 25;

const int eeprom_address_TempLowValue = 0;

int H1setpoint = 40;

const int eeprom_address_HumiLowValue = 2;

// second value

const int HighRange_UPButton = 5;

const int HighRange_DownButton = 6;

int T2setpoint = 32;

const int eeprom_address_TempHighValue = 1;

int H2setpoint = 80;

const int eeprom_address_HumiHighValue = 3;

// outputs

const int Heater = 8;

//int heaterstatus;

const int Humidifier = 9;

//int humudifierstatus;

int S = 59; // downcount seconds

int M = 59; // downcount minutes

int H = 23; // downcount hours

int day = 21; // downcount day

// buttons setup

EasyButton button_first_up(LowRange_UPButton);

EasyButton button_first_down(LowRange_DownButton);

EasyButton button_second_up(HighRange_UPButton);

EasyButton button_second_down(HighRange_DownButton);

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

/ temperature setup

double current_temperature;

double current_humidity;

//

byte angle[] = {

B00000,

B00000,

B00100,

B00100,

B00100,

B11111,

B00000,

B00000

};

byte Humidity[] = {

B00100,

B00100,

B01010,

B01010,

B10001,

B10001,

B01010,

B00100

};

byte Thermometer[8]

{

B00100,

B01010,

B01010,

B01110,

B01110,

B11111,

B11111,

B01110

};

byte Indicator[8] = { //icon for sun

0b00000,

0b00100,

0b10101,

0b01110,

0b11111,

0b01110,

0b10101,

0b00100

};

byte Rarrow[] = {

B00000,

B00000,

B00100,

B00010,

B11111,

B00010,

B00100,

B00000

};

byte Larrow[] = {

B00000,

B00000,

B00100,

B01000,

B11111,

B01000,

B00100,

B00000

};

byte to[] = {

B00000,

B00000,

B11100,

B01000,

B01000,

B01011,

B01011,

B00000

}; In setup

void setup()

{

// write boot message on lcd

lcd.init(); // initialize the lcd

// Print a message to the LCD.

lcd.backlight();

// write boot message on lcd

lcd.begin(20, 4);

// set the two outputs as high

pinMode(THsetbutton, INPUT);

pinMode(Traybutton, INPUT);

pinMode(Eggtray, OUTPUT);

pinMode(Buzzer, OUTPUT);

pinMode(Heater, OUTPUT);

digitalWrite(Heater, LOW);

pinMode(Humidifier, OUTPUT);

digitalWrite(Humidifier, LOW);

myservo.attach(10); // attaches the servo on pin 9 to the servo object

// initialize serial

Serial.begin(9600);

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

// load first value from eeprom

eeprom_value = EEPROM.read(eeprom_address_TempLowValue);

if(eeprom_value != 255)

{

T1setpoint = eeprom_value;

}

// load second value from eeprom

eeprom_value = EEPROM.read(eeprom_address_TempHighValue);

if(eeprom_value != 255)

{

T2setpoint = eeprom_value;

}

In Loop

void loop()

{

// read buttons

button_first_up.update();

button_first_down.update();

button_second_up.update();

button_second_down.update();

int buttonState = digitalRead(Traybutton); //read the state of the button input

if (buttonState == HIGH) { //pressing the button will produce a LOW state 0V

digitalWrite(Eggtray,HIGH); //the led with turn on

{

lcd.setCursor(0,2);

lcd.print("EGG TURN:ON ");

}

} else{

digitalWrite(Eggtray,LOW); //the led with turn off

lcd.setCursor(0,2);

lcd.print("EGG TURN:OFF");

}

lcd.createChar(0, angle);

lcd.setCursor(15,2);

lcd.write(0);

///////////

lcd.createChar(1, Thermometer);

lcd.setCursor(18,0);

lcd.write(1);

lcd.createChar(2, Humidity);

lcd.setCursor(18,1);

lcd.write(2);

// increase value if it is high, if it is less than the maximum value, and the first value is less than the second one and also similar that all code apply for Humidification

if(button_first_up.IsPushed() && T1setpoint < TempMax && T1setpoint < (T2setpoint - 1))

{

// increase first_value

if(digitalRead(THsetbutton) == HIGH)

T1setpoint++;

// write on eeprom

EEPROM.write(eeprom_address_TempLowValue, T1setpoint);

}

// decrease value if it is high and if the value is more than the minimum value

if(button_first_down.IsPushed() && T1setpoint > TempMin)

{

// decrease first_value

if(digitalRead(THsetbutton) == HIGH)

T1setpoint--;

// write on eeprom

EEPROM.write(eeprom_address_TempLowValue, T1setpoint);

}

// increase value if it is high and if it is less than the maximum value

if(button_second_up.IsPushed() == HIGH && T2setpoint < TempMax)

{

// increase second_value

if(digitalRead(THsetbutton) == HIGH)

T2setpoint++;

// write on eeprom

EEPROM.write(eeprom_address_TempHighValue, T2setpoint);

}

// decrease value if it is high, if the value is more than the minimum value and if the first value is less than the second one

if(button_second_down.IsPushed() && T2setpoint > TempMin && T1setpoint < (T2setpoint - 1))

{

// decrease second_value

if(digitalRead(THsetbutton) == HIGH)

T2setpoint--;

// write on eeprom

EEPROM.write(eeprom_address_TempHighValue, T2setpoint);

}

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

// sampling of temperature and humidity after delay

if((millis() - last_read_from_sensor) > sensor_read_delay)

{

// read the temperature

int chk = DHT.read11(DHT_PIN);

switch (chk)

{

case DHTLIB_OK:

current_temperature = DHT.temperature;

current_humidity = DHT.humidity;

// turn outputs on/off according to logic

if(current_temperature <= T1setpoint)

{

// full speed

digitalWrite(Heater, HIGH);

lcd.createChar(3, Indicator);

lcd.setCursor(19,0);

lcd.write(3);

}

else if(current_temperature > T1setpoint && current_temperature < T2setpoint)

{

// half speed

digitalWrite(Heater, HIGH);

lcd.createChar(3, Indicator);

lcd.setCursor(19,0);

lcd.write(3);

}

else

{

// off

digitalWrite(Heater, LOW);

lcd.setCursor(19,0);

lcd.print(" ");

}

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

//////

if(current_humidity <= H1setpoint)

{

// full speed

digitalWrite(Humidifier, HIGH);

lcd.createChar(3, Indicator);

lcd.setCursor(19,1);

lcd.write(3);

}

else if(current_humidity > H1setpoint && current_humidity < H2setpoint)

{

digitalWrite(Humidifier, HIGH);

lcd.createChar(3, Indicator);

lcd.setCursor(19,1);

lcd.write(3);

}

else

{

digitalWrite(Humidifier, LOW);

lcd.setCursor(19,1);

lcd.print(" ");

}

break;

case DHTLIB_ERROR_CHECKSUM:

break;

case DHTLIB_ERROR_TIMEOUT:

break;

default:

break;

}

// set the last read as now...

last_read_from_sensor = millis();

}

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

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

lcd.setCursor(0, 0);

lcd.print("T:");

lcd.print(DHT.temperature);

lcd.print((char)223);

lcd.print("C");

// lcd.print(" ");

lcd.setCursor(10,0);

lcd.print(T1setpoint);

lcd.print((char)223);

lcd.print("-");

lcd.print(T2setpoint);

lcd.print((char)223);

//lcd.print("");

lcd.setCursor(0, 1);

lcd.print("H:");

lcd.print(DHT.humidity);

lcd.print("%");

// lcd.print(" ");

lcd.setCursor(10,1);

lcd.print(H1setpoint);

lcd.print("%");

lcd.print("-");

lcd.print(H2setpoint);

lcd.print("%");

// lcd.print("");

// lcd.print(Humidifier););

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

/TIMER

S--;

delay(1000);

if(S<0)

{

M--;

S=59;

}

if(M<0)

{

H--;

M=59;

}

if (H < 0)

{

H = 23;

day--;

}

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

if (day>1 && H == 23 && M == 59 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 22 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 21 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 20 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 134; pos += 1) {

myservo.write(pos);

delay(15);

}

}

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

if (day>1 && H == 19 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 18 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 17 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 16 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 134; pos += 1) {

myservo.write(pos);

delay(15);

}

}

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

if (day>1 && H == 15 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 14 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 13 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 12 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 134; pos += 1) {

myservo.write(pos);

delay(15);

}

}

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

if (day>1 && H == 11 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 10 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 9 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 8 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 7 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 6 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 134; pos += 1) {

myservo.write(pos);

delay(15);

}

}

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

if (day>1 && H == 5 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 4 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 3 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 2 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 134; pos += 1) {

myservo.write(pos);

delay(15);

}

}

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

if (day>1 && H == 1 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 89; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

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

if (day>1 && H == 0 && M == 0 && S == 0 && (digitalRead(Traybutton) == HIGH))

{

for (pos = 0; pos <= 44; pos += 1) {

myservo.write(pos);

delay(15);

}

lcd.setCursor(19,2);

lcd.print(" ");

}

if (day>0 && H == 0 && M == 0 && S == 0)

{

// Timer completed

digitalWrite(Buzzer, HIGH);

}

else

{

// Buzzer off

digitalWrite(Buzzer, LOW);

}

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

lcd.setCursor(0,3);

lcd.print("Day:");

lcd.print(day);

lcd.setCursor(9,3);

lcd.print(":");

lcd.setCursor(12,3);

lcd.print(":");

lcd.setCursor(16,3);

lcd.print("LEFT");

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

if(H<0) { H=23; M=59; S=59; } if(M>9)

{

lcd.setCursor(10,3);

lcd.print(M);

}

else

{

lcd.setCursor(10,3);

lcd.print("0");

lcd.setCursor(11,3);

lcd.print(M);

lcd.setCursor(12,3);

lcd.print(":");

}

if(S>9)

{

lcd.setCursor(13,3);

lcd.print(S);

}

else

{

lcd.setCursor(13,3);

lcd.print("0");

lcd.setCursor(14,3);

lcd.print(S);

lcd.setCursor(15,3);

lcd.print(" ");

}

if(H>9)

{

lcd.setCursor(7,3);

lcd.print (H);

}

else

{

lcd.setCursor(7,3);

lcd.print("0");

lcd.setCursor(8,3);

lcd.print(H);

lcd.setCursor(9,3);

lcd.print(":");

}

lcd.setCursor(16,2);

lcd.print(pos);

lcd.print((char)223);

Serial.print(DHT.temperature);

Serial.print("|");

Serial.print(DHT.humidity);

Serial.print("|");

Serial.print(T1setpoint);

Serial.print("|");

Serial.print(T2setpoint);

Serial.print("|");

Serial.print(H1setpoint);

Serial.print("|");

Serial.print(H2setpoint);

Serial.print("|");

Serial.print(pos);

//Serial.print("°");

Serial.print("|");

Serial.print(digitalRead(Heater));

Serial.print("|");

Serial.print(digitalRead(Humidifier));

Serial.print("|");

Serial.print(digitalRead(Eggtray));

Serial.print("\n");

}

Code download:

https://www.dofbot.com/post/egg-incubator-using-dht11and-bluetooth-for-android-app

App Download: https://drive.google.com/file/d/1Jr72x9Pygm5_FnRp8wPG4ldM4gaRqXn0/view?usp=sharing

Step 1:

Be the First to Share

    Recommendations

    • New Year, New Skill Student Design Challenge

      New Year, New Skill Student Design Challenge
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • Fix It Speed Challenge

      Fix It Speed Challenge

    4 Comments

    0
    parvazno
    parvazno

    10 months ago

    this is not working .I could not set temp and humid by bottom at all.

    0
    gada888
    gada888

    1 year ago

    links not available.pls fix

    0
    RameshDofbot
    RameshDofbot

    Reply 1 year ago

    Link updated now, let me know if any. Thanks for finding