My project: Small Chicken coop automation

Hello everyone! Wanted to share a chicken coop automation project I’ve been working on. The core idea was simple — I didn’t want the coop to become a second job. I wanted something that actually takes care of itself and only bothers me when something really needs my attention. It started as a simple idea but grew into a full system with custom hardware, edge AI for real-time bird detection, automated hatch control with safety systems, smart lighting based on poultry research, and self-healing automation that only notifies you when it actually matters. Most of this runs on Home Assistant. Still a work in progress but here’s where it’s at so far and when it progresses I’ll add more pics :slight_smile:
English isn’t my native language, so I hope nobody minds spelling mistakes :slight_smile:

Feature list:

  • Edge AI real-time bird detection & counting.
  • Predator/anomaly detection (fox shows up → hatch closes automatically) - phone notification
  • Automated hatch control with linear actuator, multiple speed profiles, auto-calibrating
  • IEC 61131-3 safety logic, dual-channel safety curtain, overcurrent protection
  • Smart lighting tuned per bird type (laying hens / growing / incubation)
  • CO₂-driven ventilation, sunrise/sunset-based day/night cycle - compensating light levels inside the coop according to the actual need.
  • Self-healing system — recovers on its own, only alerts you when human intervention is needed - hybrid approach to the modules - meaning if one is down or vice versa something is down the system can operate in “limp” mode.
  • Custom carrier board
  • Tamper detection of modules, remote control, real-time diagnostics

*Edge AI — Real-Time Detections
*The image shows a camera feed from a chicken coop with AI-object detection. Each bird identified with a bounding box, assigned a unique ID (“Lind ID:7” means “Bird ID:7”), and given a confidence score percentage.

*Edge AI Features:
Local on-device model for real-time bird detection and counting
Secondary validation using a second AI model to analyze the scene and interpret it in a human-readable format - also gets us much higher failsafe % so we dont get false positive readings :).

*Anomaly detection: identifies predators, foreign animals theres alot of options possible but mostly for me the case was predators and other animals, counting.

*Bird count monitoring: detects if any birds have been left outside

*Species recognition capability

*Automatic summary reports in Estonian sent.

Diagnostics:
*Every module status in real time
*One human-readable status info
*Fault events
*Three levels: auto-recovery / manual reset / permanently locked

IoT Connectivity:
*WiFi + MQTT, TLS, Ethernet
*Home Assistant auto-discovery and detection.
*Real-time monitoring (position, consumption, diagnostics, faults)
*Remote control: open / close / stop
*Remote profile switching
*Remote reset and configuration
*Time-based access EET/EEST + daylight saving support

Network Architecture:
*Dual broker MQTT :slight_smile:
*Validation between brokers to detect man-in-the-middle attacks, fake commands, connections, duplicate modules

Lighting:

  • For laying hens:
  • For growing birds
  • For incubation

"This is a prototype showcasing a work in progress - the idea is to show what’s possible with Home Assistant and IOT. Many of the solutions are being tested and improved, more added as time and budget allows. There’s no commercial interest or monetary benefit behind this project — just my own time and investment, trying to build something good on a reasonable budget.

Big thanks to:
*Home Assistant for the open source platform
*Espressif for microcontrollers
*Hailo for edge AI
*DFRobot for sensors
*Seeed Studio for hardware
*Shelly for smart modules
*Nabu Casa for HA cloud access
*Node-RED for data manipulation.
Countless more i can´t probably remember :slight_smile:

If anyone’s interested in the full tech stack or how any of it works, feel free to ask — I’m happy to share!"

I will post below about the different parts of the project.

Gate/Hatch Controller for the chickens:

The hatch is controlled by a linear actuator with multiple speed profiles, each individually calibrated. Position tracking keeps tabs on where the hatch is at all times.

Auto-Calibration: One button press creates speed profiles (slow, medium, fast) and saves them to internal memory. The system measures travel time, startup current, and normal operating current — then derives all safety thresholds automatically. Everything is stored on EEPROM and swaps on profile change.

Safety Systems:

  • IEC 61131-3 logic verification from protected chip memory that can’t be overwritten
  • Dual-channel safety curtain
  • Wiring fault detection
  • 100ms noise filtering, 500ms pulse filtering, 15s delay on error
  • Overcurrent detection based on calibration — if the hatch jams or draws too much current, movement stops immediately
  • End position verified with magnetic switches
  • Hardware and software watchdogs
  • Tamper detection — if someone opens the enclosure, the chip locks down and sends a notification to the phone app. Service technician has their own unique code to unlock it.

Sensor Inputs:

  • 2x safety curtain channels (digital, cross-checked)
  • 2x limit switches (digital, noise filtered)
  • 2x tamper inputs (latching)
  • 4x current sensors (analog, differential)
  • Expansion modules for temperature, humidity, light, etc.

Certifications for the modules:

  • EU DoC — Directive 2014/30/EU (EMC) + RoHS 2011/65/EU
  • UK DoC — UK equivalent
  • RoHS 10 compliant
  • Tested to EN 61000-6-3:2007+A1:2011, EN IEC 61000-6-1:2019, EN IEC 63000:2018

Mqtt integrations to HA:

Custom carrier board:

Will add the actual hatch later also.

Notifications & Monitoring

The whole point was to not get spammed with alerts. Constant notifications just make you turn them off — then you miss the one that actually matters. So the system is built to handle things on its own and only bother you when it really can’t.

Three types of alerts:

1. Informational — how system handled it, quick overview: Coop dimmer overheated → lighting automatically switches to backup mode, recovers on its own. You get a notification saying “no on-site response needed.”

2. Warning — something’s down but system is coping: Sensor module goes offline → automation keeps running in limp mode. You get notified and the system tells you when it recovers or does not incase of constant failure.

3. Action needed — human has to step in: Sensor and hatch module both offline → system can’t guarantee the hatch will close on schedule. You get a notification telling you to check it.

Automation solution:

  • Core principle: nature leads, the system compensates
  • Sunrise/sunset determines day and night — not a schedule
  • CO₂ level drives ventilation — fresh air matters more than temperature
  • Heat exchanger saves energy but doesn’t block air exchange
  • Lighting compensation based on lux sensor readings
  • Spectrum tuning capability: young birds / laying hens / incubation
  • Temperature monitoring of dimmers and power blocks to detect overheating and fire risk
  • Logic validation (stop/trigger) — wrong time, too cold, fault → system intervenes

Lighting:

  • For laying hens: Red-dominant (600–700 nm, peak ~630–650 nm), warm-white 2700–3000 K color temperature + UVA (315–400 nm)
  • For growing birds: Blue (450–495 nm, peak ~455–480 nm) + Green (495–570 nm, peak ~510–560 nm). Cool-white (4000–5000 K)
  • For incubation: Green LED (~520–560 nm) or red (~600–650 nm), 12L:12D cycle, ~150–250 lux

PS: Some of the info and screenshots are auto-translated since the native language of the system is not English