Build an ESP32 Automatic Egg Incubator: Temperature, Humidity, and Turning Control
- ESP32 Dev Board
SHT31 or SHT31-D Temperature and Humidity Sensor (I2C)
Solid State Relay (SSR), 5V input / 240V AC output, rated for your heat source
12V/24V Ceramic Heating Element or PTC Heater
Small 12V DC Computer/Blower Fan for air circulation
Ultrasonic Humidifier Module (mist maker disc) for active humidity control
28BYJ-48 Stepper Motor with ULN2003 Driver (for the turning mechanism)
Logic-Level MOSFET Module (for fan and humidifier switching)
5V/12V Dual-Rail Power Supply
Clear acrylic sheet or polycarbonate for the viewing window
Prices and availability as of Nov 22, 7:58 AM ET and subject to change. The price shown on Amazon at the time of purchase applies.
Commercial automatic incubators that hold stable temperature, manage humidity, and turn eggs on a schedule start well over $150 and still give you no insight into what's actually happening inside. An ESP32-based incubator gives you the same core functionality — PID-controlled heating, active humidity management, and scheduled egg turning — plus a web dashboard you can check from your phone, data logging so you can see exactly what happened during a failed hatch, and the ability to tune every parameter instead of trusting a sealed box. This project builds all three subsystems (heat, humidity, turning) around a single ESP32 and walks through the control logic for each.
Why Precision Matters Here More Than Most Projects
Unlike most ESP32 sensor projects, an incubator has genuinely high stakes for its payload: a few degrees of sustained temperature error, or a turning mechanism that jams for two days, can end a hatch. Build in redundancy and alerting from the start — this is not a project where "it mostly works" is good enough, and the extra effort on sensor calibration and failure alerting pays for itself the first time it saves a batch.
Temperature Control with PID
Target incubation temperature is species-specific and narrow — commonly around 37.5°C (99.5°F) for chicken eggs in a forced-air incubator, with different targets for other poultry — and the margin for sustained error is small; a couple of degrees off for an extended period measurably affects hatch rates and can cause developmental problems. A simple on/off thermostat relay causes temperature swings that are too wide for reliable hatching; use PID control instead, driving a solid-state relay that switches your ceramic or PTC heating element.
| Component | Role |
|---|---|
| SHT31 sensor | Reads temperature and humidity via I2C — far more stable and accurate than a cheap DHT22 for a multi-week continuous run |
| PID loop (ESP32 software) | Compares the SHT31 reading against setpoint and drives the SSR's duty cycle smoothly rather than hard on/off |
| Solid-state relay | Switches the heating element without the audible clicking and contact wear of a mechanical relay — important for a device that cycles constantly for 21+ days straight |
| Circulation fan | Keeps the chamber's temperature uniform; incubators without forced air circulation show meaningful temperature gradients from top to bottom |
Tune the PID constants empirically: start conservative (low proportional gain, modest integral, little to no derivative), log temperature over a few hours, and increase gain gradually until you see slight overshoot, then back off until the response is critically damped — the same tuning process covered in general PID control guides, just with a much longer acceptable settling time since you have weeks, not minutes, to dial it in before eggs go in.
Humidity Control
Target humidity needs to shift partway through incubation (typically higher in the final days before hatch to help with shell membrane softening), so build your control logic around a settable humidity target the ESP32 can automatically step up on a known schedule, not just a single fixed setpoint for the whole incubation period. Drive an ultrasonic mist maker module through a logic-level MOSFET for active humidification, and vent slightly via a small adjustable port for days when ambient humidity runs high and you need to shed moisture rather than add it. Log humidity alongside temperature — humidity swings are a far more common cause of failed hatches than people realize, and having the data lets you diagnose a problem after the fact instead of guessing.
Automatic Egg Turning
Eggs need turning several times a day during the bulk of incubation to prevent the embryo from sticking to the shell membrane. A 28BYJ-48 stepper with its ULN2003 driver board, geared down and connected to a tilting tray or roller rack, gives you precise, repeatable turning on a timer — rock the tray through roughly 45 degrees each direction, on a schedule of every 1–4 hours, stopping turning entirely for the final few days before expected hatch (eggs should lie still as the chick positions itself for hatching). Use a microswitch or optical endstop at each extreme of travel so a stall or skipped step doesn't leave the tray stuck at an extreme angle for hours.
Monitoring, Alerting, and Data Logging
Have the ESP32 serve a simple web dashboard over your local Wi-Fi showing live temperature, humidity, and turning status, and log readings to an SD card or push them to Home Assistant via MQTT if you're already running it. Critically, wire in an alert path — an email or push notification triggered if temperature drifts outside a safe band for more than a couple of minutes, or if the turning motor hasn't completed a cycle on schedule. A failure you catch within the hour is recoverable; one you discover three days later during a routine check usually isn't.
Enclosure and Insulation
Build the body from an insulated foam cooler or a 3D-printed/laser-cut double-wall enclosure with foam board insulation sandwiched between layers — insulation matters more than most builders expect, since a poorly insulated box makes your heater work much harder and amplifies the effect of any ambient temperature swings in the room it sits in. Include a clear acrylic viewing window so you can check on progress without opening the lid and disturbing the internal climate.
This project rewards the extra care put into sensor calibration, PID tuning, and failure alerting far more than a typical ESP32 build — the payoff for getting it right is a genuinely reliable, inspectable incubator that beats a sealed commercial unit on cost and gives you actual insight into what happened during every hatch.