Skip to content
mstemmer edited this page Jan 18, 2021 · 34 revisions

Welcome to the hatchling!

Hatchling - brooding chicken eggs the fancy way

This DIY project started off with wanting to experiment with python and basic hardware control with a RaspberryPi and developed into a full blown chicken egg incubator. The idea was to build the controller as much as possible from scratch with cheap, but reliable parts. The python code should move the eggs periodically and control the temperature via a PID controller, report temperature, humidity and current duty cycle. On top, the controller should visually show the correct values via LEDs and warn acoustically, if there are problems arising.

Features:

  • works on any RaspberryPi & possibly other controllers
  • uses cheap off the shelf or recycled parts
  • PID controlled temperature
  • simple status reporting of correct temperature & humidity via LEDs
  • acoustic warning, when values are far off the set points
  • automatic turning of eggs
  • easy to use via CLI
  • flexible incubation programs for other species (e.g.: ducks, quails, ...)
  • creates log and data files
  • reports current values via plotly dash

Run hatchling

make sure you run python3 (>=3.7) (see Configuration )

python -m venv hatch_env
source hatch_env/bin/activate
pip install -r requirements.txt

Run hatchling with:
python hatchling.py

usage: hatchling [-h] [--init] [--species] [--silent] [--fixed_dc]

optional arguments:
  -h, --help   show this help message and exit
  --init       Start new incubation. Default: resume from last time point
  --species    Load species specific incubation program: chicken, quail,
               elephant. See inc_program.json
  --silent     Deactivate the alarm buzzer
  --fixed_dc   Ignores PID controller and sets heater to fixed duty cycle.

Run the data monitoring server (Optional)

Plotly dash provides an excellent platform to create simple UIs in the browser. This makes life so much easier! It looks great, is python based and running in the browser means that it can be accessed my all your devices in your network. With dash, you can monitor hatchling basically from everyhwere, if you setup an additional VPN.




Run the dash server with:
python monitor.py --input <data-folder/data-file.csv> The server is set up to run as local host. So in order access the page, type the IP of your RaspberryPi in your browser of your end device and use port 8050 (e.g.: 192.169.168:8050). See more info under the Software section.

Setup

Hardware & status modes

settings.json: here you find everything necessary to specify your GPIO pins (BCM format), LED/Buzzer modes, data output folder, PID parameters & number of steps for your stepper motor. See the Software section for more info.

Incubation program

inc_program.json: use this json file to specify your incubation program. You can adjust or add more programs here, callable by the --species flag.

Same values

If you just want to incubate with constant Temperature & Humidity, then just specify the default_phase field and set phases=1.

Changing values

For more phases, add them to next_phase and increase the phases number.
Then you also need to specify when these next phases should be activated. Use the phase_changes field for that. The values are in days. E.g.: for chicken eggs the Temperature has to changed after day 17 and the humidity after day 18 --> 3 phases in total.

Move eggs

Specify if you want the eggs to be moved at all with setting `activate_move_eggs` to either 1 or 0. `days_move_eggs`: How many days the eggs should be moved. `interval_move_eggs`: Move eggs every x hours.

Initiate and resume

The --init flag starts a new incubation. While the default mode is to resume from original time point, saved in time_init.json. This was setup as a precaution, in case something goes wrong during the long run time.

Silent mode

--silent deactivates the buzzer. This is great for testing the incubator and maybe also for the initial heat up. You can then just wait until the incubator reached the set point and then restart hatchling without the --silent flag to activate the alarm buzzer.

PID tuning

Use the --fixed_dc flag to specify a fixed duty cycle for your heater. This will be important when building a new incubator and tuning the PID parameters. See the PID section for more info.

Note

So far this has been running smoothly for me. Make sure though that everything is soldered and insulated correctly. Don't run hatchling when you are away! Keep an eye on the heating element!

What's next?

  • I might want to test faster temperature sensors to increase PID control accuracy
  • maybe add an infrared camera to the system to monitor hatching of the eggs
  • play with an ultrasound humidifier to actively adjust humidity levels instead of water surface solution