DIY Smart Chicken Door Project

DIY Smart Chicken Door Project

Hi everyone! I wanted to share a fun project I recently completed—a smart chicken door. It’s been a great way to automate my chicken coop while keeping things simple and cost-effective. I hope this might inspire others or provide some tips for similar projects!

The Problem

I’ve been keeping chickens for a while now, and every day I’d have to manually open and close their door. It got a bit tedious, especially in the early mornings or late evenings. Plus, I wanted something that could work reliably without needing internet connectivity, as my chickens don’t exactly have the best connection!

The Solution

I decided to build a smart door using an ESP32-CAM microcontroller, a DC motor, and an H-bridge. The idea was to have the door open at sunrise and close at sunset automatically. Here’s a quick breakdown of the components I used:

  • ESP32-CAM: For its built-in Wi-Fi and camera capabilities. I added an external antenna for better coverage.
  • DC Motor: To power the door mechanism.
  • H-bridge: To control the motor’s direction.
  • Limit Switches: To ensure the door stops at the right positions.
  • RTC Module: For accurate timekeeping in case of internet outages.

The Design

The design was kept intentionally simple to minimize costs and complexity. The motor is connected to a pulley system that lifts the door. The limit switches act as safety stops to prevent overextension. I also added a manual override switch in case of emergencies.

The Code

I used ESPHome for the firmware. The code is designed to read the RTC time, detect sunrise and sunset, and control the motor accordingly. I included some failsafe loops to handle cases where the limit switches might not trigger properly.

Here’s a snippet of the relevant code:
yaml
esphome:
name: chicken_door
on_boot:
then:
ds1307.read_time:

sun:
latitude: 42
longitude: -8
on_sunrise:
then:
switch.turn_on: open_door
on_sunset:
then:
switch.turn_on: close_door

The Results

The system has been running flawlessly for over two weeks now. The chickens love having their door open in the morning, and I don’t have to worry about forgetting to close it at night. Plus, it’s been a great learning experience in combining mechanical and electrical engineering!

If anyone has suggestions for improvements or wants more details, feel free to reach out. I’d love to hear how others tackle similar projects!

Happy building! :chicken::sparkles: