$50 DIY AI Smart Coop
AI is making waves everywhere, but what excites us most is how effortlessly it can now be incorporated into everyday devices. In fact, why should your backyard farm miss out on this revolution? If you're passionate about raising chickens but want to streamline your daily chores with cutting-edge technology, a DIY Smart Coop powered by AI and IoT is the perfect project for that.
The Vision Behind the DIY Smart Coop
Backyard farming is all about sustainability and the joy of raising chickens for fresh eggs and natural pest control. However, managing a chicken coop can be a lot of work, from early morning door openings to late-night predator checks. The Smart Coop changes all that, using AI-driven automation to make chicken care easier. With features like SMS alerts for predators and an automated door that opens and closes on a schedule, you can rest easy knowing your chickens are well cared for.
AI and IoT take it further, allowing for full control over key aspects of the coop. The door opens and closes automatically in the morning and evening, and you can customize feeding schedules or trigger instant feeding when needed. It's not just about convenience—it’s about blending the best of technology with tradition to give you peace of mind.
Why Build the DIY Smart Coop?This project goes beyond simple automation. AI and IoT empower you to create a high-tech, self-sustaining coop that’s tailored to your unique needs. Here’s why it’s worth building:
- Reduce Your Workload: Automate key tasks like opening and closing the door, feeding your chickens, and monitoring for predators.
- Enhance Safety with AI: Receive SMS alerts when predators are detected, ensuring your flock is protected even when you're away.
- Stay in Control: Schedule the door to open and close, and take instant action from anywhere via your phone.
- Customize Feeding: Set feeding times according to your schedule, or use instant feeding options to give your chickens a treat at the push of a button.
- Adapt to Your Needs: Whether you're managing a large flock or a small coop, you can adjust the system to fit your specific requirements.
Supplies
- Arduino Uno R4 x 1
- Huskylens - An Easy-to-use AI Camera - Vision Sensor x 1
- Nema 17 Stepper Motor x 1
- L298 Motor Driver x 1
- Mini 360 Step-Down Buck Converter Power Module x 1
- LM10UU 10 MM Linear Motion Bearing x 4
- 500 MM long Chrome Plated Smooth Rod Diameter 10 MM x 1
- GT2 Aluminum Pulley (Without 20 teeth) 5mm Bore for 6mm Belt x 1
- 1M GT2 Width 6mm Black Open Timing Belt x 1
- GT2-6mm Belt Width 20 Teeth 5mm Bore Timing Pulley x 1
- SG90 Continuous Rotation 360 Degree Servo Motor x 2
- Standard 12V 5A 60W Power Supply x 1
- DC Power Female Plug Jack Adapter Connector x 1
- Silicon Wire
- Acrylic Sheet
- MDF 8 ft x 4 ft x 3/4 inch
- Assorted Screw Kit (M3, M4)
Video
Here is our DIY Smart Coop Video.
General Design
Our journey started with designing the coop in Fusion 360. This essential step involved carefully crafting a 3D model using accurate measurements, enabling us to visualize each component before construction. Using CAD software significantly reduces errors during the design process, allowing for precise measurements and modifications. This capability ensures that components fit together accurately and helps identify potential issues before construction, ultimately saving time and resources.
Housing
We constructed the housing using 3/4 inch MDF wood for the main structure, ensuring a strong and stable build. To achieve a precise fit, we used 1/2 inch MDF for the top section, which we tapered to give the project a retro aesthetic. The side panels were securely attached to the base with one-inch screws, while the door was fitted using 1/4 inch screws for the hinges. Before attaching the top portion, we primed the inner surface to streamline the finishing process, focusing on the outer surfaces for the final touch. The result is a durable, visually appealing housing that balances form and function.
Micro Controller
The controller used in the project is the Arduino UNO R4 WiFi. It is a powerful microcontroller board designed around the 32-bit RA4M1 microcontroller from Renesas, offering improved performance and processing power compared to its 8-bit predecessor. It features an ESP32 module that provides both Wi-Fi and Bluetooth connectivity, making it ideal for IoT applications. With increased memory, including 32 KB of SRAM and 512 KB of flash memory, it can handle larger programs and more data. The board also boasts more general-purpose input/output (GPIO) pins, enhancing its capability to connect with multiple sensors and actuators simultaneously.
Its built-in USB-C port allows for convenient power and programming, and the higher clock speed of up to 48 MHz ensures faster data processing and communication for real-time applications. Additionally, the R4 WiFi incorporates advanced power management features, hardware support for PWM, ADC, and DAC, and enhanced security for wireless communication. It can be powered via USB-C or an external battery, providing flexibility for deployment in various projects. Maintaining compatibility with existing Arduino libraries and shields, the R4 WiFi benefits from extensive community support, making it an excellent choice for both beginners and experienced developers looking to create advanced IoT solutions.
Split Door Mechanism
This split door system utilizes 10mm metal rods, a Nema 17 stepper motor, and a GT2 timing belt, pulley and all supported by linear ball bearings. The mechanism works by pushing one door while simultaneously pulling the other when the motor is engaged, allowing for smooth and synchronized movement. This design optimizes space while ensuring secure access, perfectly catering to the automated needs of the coop. We designed this mechanical system in Fusion 360 and 3D printed the required parts for building the system.
As the front door we used the 2mm orange acrylic sheet which is laser cut in the nearby laser cutting shop.
A single Nema 17 motor, driven by an L298 motor driver and controlled via the stepper.h library powers the entire mechanism.
First we tested the Nema 17 stepper motor with the L298 Motor driver by means of the below code.
Then we tested this mechanism on the waste wood to check whether it is working or not.
Feeder Mechanism & Electronic Enclosure
Creating an efficient and reliable feeder mechanism is crucial for maintaining a consistent feeding schedule for the chickens. We designed a dual-feeder setup using an Archimedes screw mechanism powered by a continuous servo motor, ensuring that food is dispensed smoothly and effectively.
Predator Detection With Husky Lens
HuskyLens is an AI-powered sensor that can recognize objects, faces, colors, lines, and tags, making it ideal for predator detection in a chicken coop.
Setting Up HuskyLens for Predator Detection:
- Training:
- Power on HuskyLens, select "object recognition" mode, and introduce it to predators (e.g., raccoons, foxes) via images or in a controlled setup.
- Use the "learn" button to record each predator’s features, varying angles and lighting for accuracy.
- Test it with both predators and non-threats (e.g., cats) and adjust settings as needed.
- Connecting to Arduino UNO R4:
- Connect HuskyLens to the Arduino UNO R4 via I2C for real-time alerts and deterrents, like lights or alarms, to keep your flock safe.
Remaining Electronics and Enclosure
12V 3A power supply is used here as the main power source. However, the Husky lens and the Sg90 servo motor work at 5V, so we used the Mini 360 Buck converter to solve the issue.
The Arduino UNO R4 WiFi is powered directly from the 12V through the Vin pin.
Additionally, we developed a protective case for the electronic components housed within the coop, ensuring they are secure and shielded from the elements.
Painting
Painting the smart coop added both style and durability, ensuring it stands up to the elements. We began by prepping the wood, cleaning and lightly sanding it to create a smooth surface for painting. Afterward, we applied a high-quality outdoor primer to seal and protect the wood, giving the topcoat a solid base. For the color, we mixed a custom gray by adding black stainers to a white base, testing a small patch first to confirm the shade. With our paint ready, we rolled on the first coat, let it dry fully, then applied a second coat for a smooth, even, and weather-resistant finish. The result was a professionally painted coop in our ideal color, offering both a polished look and lasting protection.
Final Assembly
Next, we began installing the electronic and mechanical components onto the main coop. We started with the door, carefully measuring its distance from the front face to ensure the door mechanism would operate smoothly. Then, we set up the feeder boxes, attaching servo motors to each and gradually placing the electronic components inside the box, threading wires out for the external parts. The HuskyLens was secured to the front with double-sided tape, while the two feeder sections were fixed to an adjacent side using drywall screws. Finally, we connected two long wires to a female DC power jack to provide power to the coop. All assets for replicating this setup can be found in the GitHub repository.
Companion App
The app’s interface is built with HTML, CSS, and JavaScript, offering a responsive and user-friendly experience. It integrates Firebase JS for communication, enabling real-time updates and synchronization with the smart coop’s operations.
Twilio for SMS Alert
Twilio is a cloud communications platform that provides a set of APIs (Application Programming Interfaces) for building and integrating communication services into applications. It allows developers to add messaging, voice, and video capabilities to their applications without having to build or maintain complex infrastructure.
Here we are using Twilio to send SMS alerts if there are any predators detected.
Follow these steps carefully for integrating Twilio
1) Signup for Twilio, if you don't have an account
2) Get a Twilio Phone number, this phone number will be used for sending the SMS alert to the concerned person.
3) Then note the account info such as the Account SID, Auth Token and the generated Twilio number, this should need to be added in the code.
Smart Coop Is Ready for Action
Simply plug in your smart coop, and it’s ready to handle all your chicken care needs. From automated feeding and secure door control to real-time predator detection, this fully finished smart coop has everything set up for you. Just sit back and let your coop do the work!