In this post I will show how to construct an incubator using Arduino which can self-regulate its temperature and humidity. This project was suggested by Mr. Imran yousaf who is an avid reader of this website.
Introduction
This project was designed as per the suggestions from Mr. Imran, but some additional modification is done to make this project universally suitable for all.
You may use your creativity and imagination to get this project done.
So let’s understand what an incubator is? (For noobs)
Incubator is an enclosed apparatus whose internal environmental is isolated from ambient environment.
This is to create favourable environment for the specimen under care. For example incubators are used to grow microbial organism in laboratories, incubators are used in hospitals to take care of prematurely born infants.
The kind of incubator we are going to build in this project is for hatching chicken eggs or any other bird eggs.
All incubators have one thing in common; it regulates the temperature, humidity and provides adequate oxygen supply.
You can set temperature and humidity by pressing the provided buttons and also it shows the internal temperature and humidity in real time. Once both parameters set it automatically controls the heating element (bulb) and vaporizer (humidifier) to meet the set point.
Now let’s understand the apparatus and design of the incubator.
The chassis of the incubator may be of Styrofoam / thermocol box or acrylic glass which can provide good thermal insulation. I would recommend Styrofoam / thermocol box which will be easier to work with.
Apparatus design:

A 25 watt bulb acts as heat source; higher wattage may hurt the eggs in a small container. The humidity is provided by vaporizer, you may use the vaporizer something similar as shown below.

It produces thick stream of steam which will be inlet to incubator. The steam can be carried via any flexible tube.
The flexible tube can be something similar as shown below:

The steam may be inlet from top of the Styrofoam / thermocol box as shown in the apparatus design, so that excess heat will escape though the humidity control holes and less hurting the eggs.
There is a cylinder carrying eggs with several holes around it, connected to a servo motor. The servo motor rotates the cylinder 180 degree every 8 hours thus rotates the eggs.
The rotation of the eggs prevents the embryo sticking to the shell membrane and also provides contact with the food material in the egg, especially at early stage of incubation.
The rotating cylinder must have several numbers of holes so that proper air circulation will be present and also the cylinder must be hollow on both sides.
The rotating cylinder can be PVC tube or cardboard cylinder.
Paste an ice cream stick on both end of the hollow cylinder such that the ice cream stick makes two equal semi circles. Paste the arm of the servo motor at middle of the ice cream stick. On the other side poke a hole and paste a tooth pick firmly.
Insert the tooth pick inside box and paste the servo on opposite wall inside the box. The cylinder must stay horizontal as possible, now the cylinder can rotate as the servo motor rotates.
And yes, use your creativity to make the things better.
If you want to accommodate more eggs make more such cylinders and multiple servo motor can be connected on same control line pin.
The humidity control holes can be made by poking a pencil through the Styrofoam / thermocol box at the top. If you made lot of unnecessary holes or if humidity or temperature is escaping too fast you may cover some of the holes using electrical or duct tape.
The DHT11 sensor is heart of the project which may be placed at the middle of any four sides of incubator (inside) but away from the bulb or humidity inlet tube.
CPU fans can be placed as shown in the apparatus design for air circulation. For proper air circulation use at-least two fans pushing the air in opposite direction, for example: one of the CPU fan pushing downwards and another CPU fan pushing upwards.
Most CPU fan works on 12V but at 9V works just fine.
That’s all about the apparatus. Now let’s discuss on the circuit.
Schematic Diagarm:

The above circuit is for Arduino to LCD connection. Adjust 10K potentiometer for adjusting LCD contrast.

The Arduino is the brain of the project. There are 3 push buttons for setting temperature and humidity. The pin A5 controls the relay for vaporizer and A4 for the bulb. The DHT11 sensor is connected to pin A0. The pins A1, A2 and A3 used for push buttons.
The pin #7 (non-PWM pin) is connected to servo motor’s control wire; multiple servo motors can be connected to pin #7. There is misconception that servo motors works only with PWM pins of Arduino, which is not true. It works happily on non PWM pins too.
Connect a diode 1N4007 across the relay coil in reverse bias to eliminate high voltage spikes while switching on and off.
Power Supply:

The above power supply can provide 9 V and 5 V supply for relay, Arduino, Servo motor (SG90) and CPU fans. The DC jack is provided for powering the Arduino.
Use heat sinks for the voltage regulators.
That concludes the power supply.
Download the library DHT sensor:
https://arduino-info.wikispaces.com/file/detail/DHT-lib.zip
Program Code:
//------------------Program Developed by R.GIRISH (Improved Version)-------------------//
#include <LiquidCrystal.h>
#include <Servo.h>
#include <dht.h>
// ---------------- PIN DEFINITIONS ----------------
#define DHT11 A0
const int ok = A1;
const int UP = A2;
const int DOWN = A3;
const int bulb = A4;
const int vap = A5;
const int rs = 12;
const int en = 11;
const int d4 = 5;
const int d5 = 4;
const int d6 = 3;
const int d7 = 2;
// ---------------- VARIABLES ----------------
int T_threshold = 25;
int H_threshold = 35;
bool T_condition = true;
bool H_condition = true;
unsigned long lastTurnTime = 0; // for egg turning
unsigned long turnInterval1 = 8UL * 3600UL * 1000UL; // 8 hours
unsigned long turnInterval2 = 16UL * 3600UL * 1000UL; // 16 hours
int pos = 0;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
Servo motor;
dht DHT;
// ---------------------------------------------------
void setup() {
pinMode(ok, INPUT_PULLUP);
pinMode(UP, INPUT_PULLUP);
pinMode(DOWN, INPUT_PULLUP);
pinMode(bulb, OUTPUT);
pinMode(vap, OUTPUT);
digitalWrite(bulb, LOW);
digitalWrite(vap, LOW);
motor.attach(7);
motor.write(0);
lcd.begin(16, 2);
Serial.begin(9600);
lcd.setCursor(4, 0);
lcd.print("Digital");
lcd.setCursor(3, 1);
lcd.print("Incubator");
delay(1500);
lastTurnTime = millis();
}
// ---------------------------------------------------
void loop() {
// ---------------- SET TEMPERATURE ----------------
if (T_condition) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Set Temp:");
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" C");
while (T_condition) {
if (digitalRead(UP) == LOW) {
T_threshold++;
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" C ");
delay(200);
}
if (digitalRead(DOWN) == LOW) {
T_threshold--;
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" C ");
delay(200);
}
if (digitalRead(ok) == LOW) {
delay(200);
T_condition = false;
}
}
}
// ---------------- SET HUMIDITY ----------------
if (H_condition) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Set Humidity:");
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("%");
while (H_condition) {
if (digitalRead(UP) == LOW) {
H_threshold++;
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("% ");
delay(200);
}
if (digitalRead(DOWN) == LOW) {
H_threshold--;
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("% ");
delay(200);
}
if (digitalRead(ok) == LOW) {
delay(200);
H_condition = false;
}
}
}
// ---------------- READ SENSOR ----------------
int chk = DHT.read11(DHT11);
if (chk != DHTLIB_OK) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Sensor Error");
lcd.setCursor(0, 1);
lcd.print("Retrying...");
digitalWrite(bulb, LOW);
digitalWrite(vap, LOW);
delay(1000);
return;
}
float T = DHT.temperature;
float H = DHT.humidity;
// ---------------- DISPLAY ----------------
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.print(T);
lcd.setCursor(0, 1);
lcd.print("Humidity:");
lcd.print(H);
// ---------------- TEMPERATURE CONTROL ----------------
if (T >= T_threshold) {
digitalWrite(bulb, LOW);
}
else {
digitalWrite(bulb, HIGH);
}
// ---------------- HUMIDITY CONTROL ----------------
if (H >= H_threshold) {
digitalWrite(vap, LOW);
}
else {
digitalWrite(vap, HIGH);
}
// ---------------- EGG TURNING ----------------
unsigned long now = millis();
// Turn at 8 hrs
if (now - lastTurnTime >= turnInterval1 && now - lastTurnTime < turnInterval2) {
for (pos = 0; pos <= 180; pos++) {
motor.write(pos);
delay(25);
}
}
// Turn back at 16 hrs
if (now - lastTurnTime >= turnInterval2) {
for (pos = 180; pos >= 0; pos--) {
motor.write(pos);
delay(25);
}
lastTurnTime = millis(); // Reset cycle
}
delay(1000);
}
//-------------- END OF IMPROVED PROGRAM ----------------//
How to operate the Circuit:
· With completed hardware and apparatus setup, power the circuit ON.
· The display shows “set temperature” press up or down button to get the desire temperature and press “set button”.
· Now the display shows “set Humidity” press up or down buttons to get desire humidity and press “set button”.
· It begins the functioning of the incubator.
Please refer internet or get advice from a professional for temperature and humidity level for the eggs.
If you have any specific question regarding this Arduino automatic incubator temperature and humidity control circuit, feel free to express in the comment section. You may receive a quick reply.
How to Setup (Detailed Instructions)
So in the setup function, we initialize the LCD, we attach the Servo to pin 7, we put the bulb and vap pins as OUTPUT, and we make sure they start LOW. Now we show “Digital Incubator” on LCD for some time. So we do this slowly so that user knows the machine is working.
We also store the starting time using millis so that we can later check when we need to rotate the eggs. This is better because we do not manually count seconds inside the loop. That becomes wrong over time.
Setting Temperature
Now we come to the T_condition section. So here we show “Set Temp” on the LCD. Now we want you to press UP or DOWN to increase or decrease the Temperature setpoint.
So we say like this:
- When we press UP then we increase T_threshold by 1.
- When we press DOWN then we decrease T_threshold by 1.
- When we press OK then we stop modifying Temperature and we exit T_condition loop.
We always put delay(200) so that button does not bounce crudely.
So we let user finalize the Temperature first, then after that we go to Humidity.
Setting Humidity
Now we come to H_condition section. So here we show “Set Humidity” on the LCD. We again use UP, DOWN, OK to set H_threshold.
When user presses UP then humidity increases.
When user presses DOWN then humidity decreases.
When user presses OK then humidity setting finishes.
So now we have both Temperature and Humidity thresholds stored inside the program.
Reading Sensor
So after setting, now we start the main loop part where we read DHT11 sensor continuously.
Since DHT11 is slow and sometimes gives errors, so when we read the sensor and then the DHT returns DHTLIB_OK, then we continue normally.
But since there is chance of error, then when DHTLIB_ERROR occurs then system prints “Sensor Error” and stops the outputs temporarily, so bulb and vap remain LOW to avoid overheating.
So we retry again after one second.
Displaying Temperature and Humidity
Now we show the Temperature value on first line and Humidity value on second line. So we do this in every loop so user can see real time values.
Temperature Control Logic
Now we apply our improved temperature control logic:
When DHT.temperature >= T_threshold then bulb is OFF.
When DHT.temperature < T_threshold then bulb is ON.
We do not use big delays like before because those delays used to freeze the system. Now we use simple non-blocking logic, so system responds immediately.
This makes the incubator more reliable and stable.
Humidity Control Logic
Now we apply same style:
When DHT.humidity >= H_threshold then vap is OFF.
When DHT.humidity < H_threshold then vap is ON.
So we keep humidity in the correct range.
Egg Turning System
Now we come to the Servo rotation part. This is the egg turning system.
In the previous old code we manually counted hrs, Min, sec. But now we use millis which is more stable and more correct.
So we do like this:
We store lastTurnTime when setup starts.
We check two intervals: 8 hours and 16 hours.
When now - lastTurnTime >= 8 hours then servo rotates from 0 to 180 slowly.
When now - lastTurnTime >= 16 hours then servo rotates back from 180 to 0.
After rotating back, we reset lastTurnTime so the cycle repeats forever.
So eggs rotate two times every 16 hours cycle.
This is more correct, since using millis gives smooth and stable timing.
Final Loop
Now after all this is finished, we give delay(1000) so loop repeats once per second. This keeps overall system responsive but not too fast.
So entire program works continuously.




Comments
can i use arduino uno for lcd display on the incubater
how many volts the bulbs get
mains input voltage