![How to build a smart chicken coop with Particle B-SoM](https://i0.wp.com/blog.particle.io/wp-content/uploads/2024/07/smartcoop3.png?fit=920%2C610&ssl=1)
The Problem
Managing a flock of chickens presents significant challenges, including time-consuming feeding processes, inadequate environmental monitoring, and limited remote management capabilities. Traditional methods often result in inconsistent diets, suboptimal living conditions, and delayed responses to issues due to the inability to access real-time data. These inefficiencies affect the chickens’ health and productivity and increase the workload and stress for poultry farmers, both backyard enthusiasts and professionals alike. As a solution to this problem, Smart Chicken Coop is developed.
The Solution
Introducing the Smart Coop a game-changer for both backyard chicken enthusiasts and professional poultry farmers. Harnessing the power of cutting-edge cellular IoT technology, this innovative system transforms chicken care by allowing you to feed and monitor your flock from anywhere in the world.
Picture this: you can effortlessly manage your chickens remotely with just a few clicks on a sleek, user-friendly web dashboard. The Smart Chicken Cage utilizes the robust Particle IoT platform, which simplifies the process of building, deploying, and managing connected products. Thanks to Particle’s reliable connectivity solutions and powerful cloud services, your Smart Coop is always online and accessible.
One of the coop’s standout features is its dual feeder mechanism. This clever design lets you switch between different types of feed, ensuring your chickens receive a balanced diet with minimal effort. Plus, the coop is equipped with advanced temperature and humidity sensors, providing intelligent climate control to keep your chickens comfortable and well-cared for at all times.
The Smart Coop is a revolution in poultry management, offering convenience, reliability, and peace of mind. Whether you’re near or far, your chickens are just a click away from receiving the best care possible.
Bill of Materials
Hardware
- Particle B524 SoM
- B-Series Evaluation Board
- DHT11 temperature and humidity sensor
- SG90 continuous rotation servo
- Tungsten bulb
- Relay module
- Hi-Link power supply (1A at 5V)
- Cellular antenna (U.FL connector)
- Micro USB cable
- Silicon wires
- 3D-printed parts for the feeding and electronics unit
- Screw terminal block
- AC power supply and three-pin plug
- Chicken cage
Software
- Visual Studio Code with Particle Workbench extension
- Particle Web IDE or Particle Workbench
- Particle account (create one at setup.particle.io)
- Fusion 360 (for designing custom parts)
- HTML, JavaScript, and CSS (for the web dashboard)
Data Flow
Particle B524 SoM & Setup
The B-SoM powers this project. The B-SoM is our flagship IoT module for cellular-connected products. It runs on the Particle IoT Platform-as-a-Service — included for free for your first 100 devices — and includes a free global embedded SIM card and data plan. Optimized for mass production and scale, the B-SoM is designed to be integrated directly into your circuit board design, plugging an M.2 NGFF connector on your board, allowing the module to be changed or upgraded easily.
To use this module we should need to use the B-Series Eval board a simple breakout board for Particle’s B series of cellular IoT modules, to utilize module
Setting up the evaluation board is straightforward: plug the cellular antenna into the U.FL connector labeled CELL on the SoM, plug the module into the evaluation board, turn on the SoM power switch, and connect the evaluation board to the computer via the micro USB cable.
Setup B5 SoM
Head over to setup.particle.io and create an account if you don’t have one. This will allow you to configure your device and connect it to the Particle cloud.
When you follow the process correctly, you can see your device online in the Particle cloud.
Particle Workbench
We can code the Particle board in two ways: either through the Particle Web IDE or through the Particle Workbench. For the sake of simplicity, we are using the Particle Workbench. To install the Workbench, you need Visual Studio Code. It’s very easy—just have a look at this. Then we created a new project named “Smart Coop”.
Sensors and Actuators
- DHT11
The DHT11 sensor measures temperature and humidity, making it ideal for environmental monitoring. It has a temperature range of 0-50°C with an accuracy of ±2°C, and a humidity range of 20-90% RH with an accuracy of ±5% RH. The sensor operates on a power supply of 3.5-5.5V DC and communicates via a single-wire digital interface. It provides readings at a rate of one per second, ensuring timely data for controlling the environment.
- Relay Module
The relay module is used to control the power supply to the tungsten bulb based on temperature readings. It operates on a 5V trigger voltage and can switch higher voltages up to 250V AC or 30V DC, with a current handling capacity of up to 10A. The module has three main connections: VCC, GND, and an input signal from the microcontroller. When the temperature drops below a set threshold, the microcontroller sends a signal to the relay to close the circuit, turning on the bulb to provide heat. Once the desired temperature is reached, the microcontroller signals the relay to open the circuit, turning off the bulb.
- Continous Rotation Servo
The SG90 continuous rotation servo is used to dispense food at regular intervals. It operates on a voltage range of 4.8-6V, with a speed of approximately 110 RPM at 6V and a torque of 1.2 kg-cm at 4.8V. The servo is controlled by a Pulse Width Modulation (PWM) signal, where the pulse duration determines the speed and direction of rotation. It has three connection wires: VCC for power, GND for ground, and a signal wire for receiving control pulses from the microcontroller. By adjusting the PWM signal, the microcontroller can control the continuous rotation of the servo to dispense food as needed.
Testing
Before proceeding further, we finalized the code by connecting the components with jumper wires as per this schematic.
In testing we only connected one servo due to over-current draw, in the future we will also add another servo.
Essential Libraries
We are using three libraries for our project: Adafruit_Sensor and DHT for measurements from the DHT11 sensor, and ntp-time library for keeping time synced with the internet clock.
Website
The project website was developed using HTML, JavaScript, and CSS, providing a user-friendly interface to monitor and control the smart coop.
Case
We used Fusion 360 to design custom cases for the electronic and feeding units, ensuring they fit perfectly within the cage. An Archimedes screw mechanism, connected to the servo motor, is used to dispense the food efficiently. A dual-feeder setup is employed to increase food availability and minimize the risk of food shortages.
Here are the 3D-printed parts we produced. These components have been designed to fit seamlessly with the rest of the cage infrastructure. Now, we can begin the assembly.
Assembly
First, we attached the servo motor to the feeder unit, ensuring it is securely in place to handle the rotation needed for the Archimedes screw mechanism.
Then we connected the Archimedes screw to both the servo motors.
To power the evaluation board, we used a Hi-Link power supply, which provides 1 amp of current at 5V. This ensures a stable power supply for all electronic components.
This Hi-Link power supply is attached to the green dotted PCB with a screw terminal block, providing a secure and reliable connection.
Next, we placed the electronic components one by one and connected them according to the schematics. This includes the DHT11 sensor, relay, and other necessary components to ensure seamless operation.
After finishing the assembly, you will have four wires remaining: two for the AC power supply and two for the heating bulb.
The AC wires will be connected to a three-pin plug, providing the necessary power to the entire system.
A tungsten bulb is used here for heating, chosen for its reliability and efficiency in maintaining the desired temperature.
With all components assembled and connected, we can attach everything to our coop to make it smart.
Our smart chicken coop is now ready and equipped with automated feeding and temperature control systems to ensure the well-being of the chickens.
Smart Coop exemplifies our commitment to innovation in agriculture, offering a scalable solution that meets the needs of both backyard hobbyists and commercial farmers. The Smart Chicken Coop not only streamlines daily operations but also fosters a healthier and more productive environment for chickens, ultimately transforming how poultry farming is approached in the modern era.