$50 DIY AI Smart Coop

by CodersCafeTech in Circuits > Arduino

1073 Views, 9 Favorites, 0 Comments

$50 DIY AI Smart Coop

_91A0310.JPG

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:

  1. Reduce Your Workload: Automate key tasks like opening and closing the door, feeding your chickens, and monitoring for predators.
  2. Enhance Safety with AI: Receive SMS alerts when predators are detected, ensuring your flock is protected even when you're away.
  3. Stay in Control: Schedule the door to open and close, and take instant action from anywhere via your phone.
  4. 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.
  5. 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

Video

$50 DIY Smart Coop | AI Powered Smart Coop | Coders Cafe

Here is our DIY Smart Coop Video.

General Design

design.png
Design3.png

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

DSC08078.JPG
DSC08084.JPG
DSC08097.JPG
DSC08128.JPG
File Name Lost (6).jpg

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

DSC08432.JPG

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

C1751T01.JPG
C1738T01.JPG
DSC08457.JPG
DSC08462.JPG
C1758T01.JPG
C1759T01.JPG
C1757T01.JPG
C1761T01.JPG
C1762T01.JPG
Schematic_Chicken-Feeder_2024-10-09.png

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.

// Include the Arduino Stepper Library
#include <Stepper.h>
// Number of steps per output rotation
const int stepsPerRevolution = 200;
// Create Instance of Stepper library
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup()
{
// set the speed at 60 rpm:
myStepper.setSpeed(40);
// initialize the serial port:
Serial.begin(9600);
}
void loop()
{
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(4000);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(4000);
}

Then we tested this mechanism on the waste wood to check whether it is working or not.

Feeder Mechanism & Electronic Enclosure

DSC08497.JPG
DSC08517.JPG
DSC08540.JPG

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

DSC08484.JPG
DSC08182.JPG
DSC08186.JPG
DSC08189.JPG
DSC08198.JPG

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:

  1. Training:
  2. Power on HuskyLens, select "object recognition" mode, and introduce it to predators (e.g., raccoons, foxes) via images or in a controlled setup.
  3. Use the "learn" button to record each predator’s features, varying angles and lighting for accuracy.
  4. Test it with both predators and non-threats (e.g., cats) and adjust settings as needed.
  5. Connecting to Arduino UNO R4:
  6. 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

DSC08526.JPG
DSC08530.JPG
DSC08540.JPG

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

DSC08544.JPG
File Name Lost (7).jpg
DSC08177.JPG

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

DSC08547.JPG
DSC08557.JPG
DSC08560.JPG
DSC08561.JPG
DSC08572.JPG
DSC08573.JPG
DSC08577.JPG

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

IMG_5209.jpg
IMG_5210.jpg
IMG_5211.jpg
IMG_5212.jpg

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

sms.jpg
twilio.jpg

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

DSC08624.JPG
DSC08665.JPG

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!