Introduction: Easy Automatic Chicken Door

The cold months has arrived in Utah and the temperature can drop below freezing. I wanted keep the chickens warm so they don't freeze to death. This is the solution that I think will help them in these cold months. This took me about a week to make, but that was with mistakes and school. You probably could finish this within less then 3 days if you have some free time.


1. saw to cut the material that will be used for the door(I used a skill saw)

2. Arduino Mega

3. Wires

4. stepper motor

5. pulley

6. 3d printer(can be optional)

7. if you don't have access to a printer you will need to get 2 hinges and a pulley for the stepper motor you will be using

8. string

9. fabric

10. wood for the door and sides.

11. some kind of source of power for the Arduino

12. photocell

13. two leds (optional)

14. hot glue gun and glue sticks

15. soldering iron with solder

16 screws

17. tape measure and a pencil or pen

Step 1: Cutting the Door

I found some scrap wood from another project from a while ago. I cut out the size of the door that matched the size of the opening of the chicken coop(8 13/16" by 9 11/16" by 1/2"). There was some cracks and some holes in the wood, so I filled them up with some wood glue. Then I cut out two notches one each side of the door for the hinges (8/16" by 1 1/2"). If you want your door to be painted this would be the time to do it since the next step is adding the hinges.

Step 2: Adding the Hinges

I didn't have any hinges on hand so I went to thingiverse and found some hinges so I printed them on my Ender 3 pro. It only took a few hours to print and they worked right off the bed. I then aligned them with the grooves that I cut out. Then measuring the screws I had then I drilled some holes that was smaller then the screws. This helps so the wood doesn't crack when you screw the screw in. Then I screwed on the hinges. My screws were longer then width of the wood so I used a dremel and cut the end of the screws off and added some wood glue onto the cut screws so they weren't sharp.

Step 3: Making the Motor Mount

I found a skinny scrap piece of wood and then I cut it to my desired length(5 5/16" by 1 1/2" by 6/16) . Next was cutting only half of the piece of wood in half so I could mount the stepper motor onto it. I then drilled a hole in the middle of the half that was cut so the motor shaft can stick out enough to put the pulley on. I then mounted the stepper motor with some random screws from a CD drive that I took apart. The stepper motor I am using is a 28BYJ-48 that you can buy in bulk for cheap.

Step 4: Extra Things That Would Be Good to Print If You Got a Printer

The pulley for the stepper motor was designed by me for this project and does not need support to be printed . I also 3d printed a case for the Arduino mega to help protect it from elements and the chickens.

Step 5: Wiring With and Code

I used a tiny bread board to save space and make it easier to mess with things. I stuck the bread board on top of the Arduino case and then began to wire it. The picture may look confusing put it's really simple. The wiring is just hooked up to some resistors, led, and limit switches. The leds are optional, it's just to tell if the door is opened or closed at night just in case something were to fail. I don't have the photo cell or the switches in the picture, but they go on the top half of the bread board with the photocell in the left corner. You may have to read the code to understand were things will be hooked on the Arduino.Copy and paste this into the Arduino IDE then you are going to want to add a less then sign in front stepper.h and a greater sign in the back of stepper.h. Then upload this to the Arduino mega.

// Chicken door created by lucky3333
int led1=6; // the pin the first led is connected to

int led2=4; // the pin the second led is connected to

int switch1=3; //the pin the first switch is connected to

int switch2 =5; //the pin the second switch is connected to

int reading2; //reading of the second switch

int reading; //reading of the first switch

int photocellPin = 0; // the cell and 10K pulldown are connected to a0

int photocellReading; // the analog reading from the analog resistor divider

#include stepper.h

const int stepsPerRevolution = 1500; // how much the stepper motor is going to move

Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); // pins the stepper motor is connected to

void setup(void) { //the setup

pinMode(switch1, INPUT); // setting switch 1 as input

pinMode(switch2, INPUT); //setting switch 2 as input

pinMode(led2, OUTPUT); // setting led2 as a output

pinMode(led1, OUTPUT); // setting led1 as a output


void loop(void) {

photocellReading = analogRead(photocellPin);

myStepper.setSpeed(10); // how fast the stepper motor is going to move

reading= digitalRead(switch1); //digital reading of the first switch

reading2= digitalRead(switch2); //digital reading of the second switch

if(photocellReading<1){ //seeing if it is dark outside

if(reading2<1){ //seeing if the second switch is being pressed

myStepper.step(-stepsPerRevolution); // stepper motor moving counter clockwise



delay(1000); // waiting for a second

if(photocellReading>5){ //seeing if its light outside

if(reading<1){ // if the first switch is being pressed

myStepper.step(stepsPerRevolution); // stepper motor moving clockwise


} if(photocellReading<20){ // seeing if it is dark outside

if(reading>0){ // seeing if the first switch is being pressed

digitalWrite(led1, HIGH); //turning the first led on

delay(200); // waiting for 200 milliseconds

digitalWrite(led1, LOW);} //turning the first led off


if(reading2>0){ // seeing if the second switch is being pressed

digitalWrite(led2, HIGH); //turning the second led on

delay(100); // waiting for 100 milliseconds

digitalWrite(led2, LOW);} //turning the second led off }


Step 6: Holes for Leds and Photocell

Before drilling the holes make sure to solder some wire onto your parts. I used hot glue to cover the open wire so that the to wire can't cross. Then you are going to drill a hole(drill bit is 13/64) were the sun hits all day. Then if you are going to have leds then you are going to have to drill two holes(drill bit is 13/64) that are facing your house so you can see them when they light up at night. When I was ready to place my leds into the hole I hot glued around the led and then stuck them in the hole. The photocell was a little more complicated. I placed it in the hole then made sure it was correctly positioned then I hot glued inside of the hole to make the photocell stay.

Step 7: Setting Up

The first thing to do is to place your Arduino some were. I placed it in the middle between my leds and the photocell. I hot glued it to the wall to save on space and keep it from getting pooped on by the chickens. I then went and installed the door. Then making sure that it was going to a line correctly with my stepper motor pulley I mounted the stepper motor mount to the wall with some screws. These small stepper motors don't have enough power to just lift the door open so I had to add a pulley to assist the motor with the task. Then I placed the switches were I wanted the stepper motor to stop moving. I then proceeded to hook up my wires to the leds, switches,and photocell to the Arduino. I then organized my wires by hot gluing them to the wall to keep the chickens from pecking at them and undoing the connection.

Step 8: Testing

At this point you should hook up the Arduino with a power source somewhere between 7 and 12 volts. Place a piece of tape over the photocell to make sure that the motor will move the door down and that the bottom switch and the top switch will work. If the motor stops moving then the switch worked. If you are using leds make sure the led of your choice is lighting up.

Step 9: Improving

There was some big gaps around the edges of the door that would let a lot of cold air in. What I did to solve this was cut three pieces of wood and placed them around the door(2 pieces are 1"by1 1/2" by 11 1/2" and the other is 8 14/16" by 1" by 1 1/2"). Then I got a piece of fabric that was really thick(9" by 3") and would keep a lot of the cold air out. I placed this on top of the door over the switch. When I finished these improvements there was very little light coming through. I am also using a garage door battery that is 12 volt but you can use a solar panel or a extension cord. Comment down below if you have any other improvements to make this project better and more efficient.

Step 10: Finished

your chickens will love you for this. When I went outside to check on the door and the chickens the coop was a lot warmer then it would have been without the door. It also makes sure that no wild animals come in the coop and kill all of your chickens.

Made with Math Contest

Participated in the
Made with Math Contest