Is an arduino controlled incubator for chicken's eggs. It's purpose is to keep temperature and humidity at defined values, so that the eggs are incubated and the chicks finally hatch after some days.
It might as well be used to incubate other things than chicken's egg like other kinds of eggs (ducks, turtles, alligators, ...), or cultures of bacteria or fungus i.e. to make yoghurt or to leaven yeast/sour dough or to make Tempeh.
Chicken's eggs are incubated for 21 days under temperature and humidity conditions as shown in the table.
Day | Temperature [°C] | Humidity [%] |
---|---|---|
1-17 | 37.8 | 55-50 |
18-19 | 37.5 | 55-60 |
20-21 | 37.5 | 70 |
Turn the eggs 3 times per day on days 3-17.
The eggs are checked by "x-raying" them with a flashlight on day 7 and 15 (german schieren). Dead or unfertilized eggs are sorted out.
The arduino constantly measures temperature and humidity. The raw measurements are smoothed using Holt-Winters double exponential smoothing. The smoothed values are then fed into a PID control loop.
The temperature is maintained by turning the heating element on and off in a 2 seconds cycle. The duty cycle of the heater is determined by the temperature PID loop. Using a low frequency pulse width modulation turns a bang-bang controlled heating element into a fully modulated element.
As heating element I highly recommed Kanthal wire (used for styrofoam cutting). 10-15 watts are enough! This is much better than a light bulb. It can be operated with low voltage (safer than 220V bulb), does not emit light and does not burn out. Use a MOSFET to turn it on and off (no heatsink needed due to PWM and no clicking and wearing of a relay).
The humidity is maintained by opening and closing an air vent on the incubator using a servo. The servo angle is determined by the humidity PID loop. Inside the incubator is a water filled jar. The water warms up and evaporates, the humidity rises, the vent is opened and the humid air can escape letting dryer air in. The air vent is also needed also to allow fresh air and oxygen to get into the incubator. You have to experiment with the size (water surface) of the jar to reach the humidty setpoint and have the air vent (half) open.
The fan does not need to be controlled, it is constantly running and distributes heat and humidity equally in the incubator. I used a 12cm 12V PC fan operated at 5V, so it runs slowly. The Arduino monitors the fan using it's rpm signal and sets of an alarm if it fails. The fan also cools the heating wire, the heating is turned off, if the fan fails.
Using the select button, you can cycle through the different modes of the display.
The first line always displays currently measured values or an alarm message. The second line displays information depending on the selected display mode. To silent the alarm, press any button (select).
Changed values are stored permanently in the EEPROM.
Have a look into the code for the pin numers, starting at line 10.
The LCD uses the pins 8, 9, 4, 5, 6, 7 and 10 for the background light and A0 for the input keys.
The fan tacho signal is connected to pin 2 and it is powered with 5V from the 7805 regulator.
The heating wire is powered with 12V, the MOSFET is used as switch with it's gate on pin A1.
The DHT22 T/H probe has it's data pin connected on pin 3, a 10k pullup resistor might be neccessary.
The air vent servo is connected to pin 11.
The buzzer is connected between ground and A2.
The PID coefficients in the code are those I used in my setup. They are probably not appropiate for you setup. You have to tune them.
Ziegler-Nichols does very well for this machine.
Set the the I and D coefficients to 0 and increase the P gain until the controlled values starts oscillating. You can monitor them using the Adruino Plotter. To this ultimate gain apply Ziegler-Nichols formulas to get the P, I and D coefficients.
There is a T_OFFSET
in line 11. Set it to 0 and let the system get into a stable state (standard deviation of temperature < 0.5 and decreasing). Now drop a mercury fever thermometer into the incubator and let it settle for a couple of minutes. Compare the temperatures measured by the incubator and measured by the fever thermometer and calculate the offset.
Use a mercury fever thermometer because it cheap, more accurate than an electronic one and it comes calibrated because it's a medical device meant to be used on humans. Be aware the it is a maximum thermometer.
Arduino with LCD shield, below 5V regulator with heatsink and the MOSFET
air vent made from clear plastic, the servo turns the disk of the vent to open/close it
fan with heating wire in the back, T/H on the left
close up of fan with heating wire