Automating a Chicken Coop Door Using Arduino

A DIY Chicken Coop Gone Digital


Our automatic chicken coop door as seen from outside the coop.

When we designed our chicken coop, automating our chicken coop door was a necessity. There was already so much to consider, from the design and quantity of nesting boxes to roosts and space. But, since we both work full-time jobs, an automatic chicken door had to be considered too.

We had seen plans for automated chicken coop doors. In fact, there are ready-to-purchase devices out there which will accomplish the mission of securing your birds. These products are rather expensive, especially given a significant design flaw: They rely on a timer to open and close the chicken coop doors. We didn’t like this idea because, as sunrise and sunset times change, the timer needs to be adjusted. If forgotten, there was a good chance the birds could be locked out of the coop. This was not acceptable.

Technology Arrives on the Farm

Last winter we attended the Northern Michigan Small Farm Conference and Trade Show. One of the workshops discussed ways to automate your farm and focused on greenhouse automation and data collection. We don’t have a greenhouse, but we listened intently as the speakers discussed the technology available to make life simpler for farmers. This was our introduction to the world of Arduino, which is basically a platform of hardware and software working together to accomplish just about anything you want.

What do I need in my Chicken Coop?

Download this FREE Guide from our chicken housing experts — chicken coop plans to ideas for nesting boxes.
YES! I want this Free Report »

We determined that Arduino could be used to create the perfect chicken coop door design. The only major roadblock was that we aren’t programmers. Fortunately, we have a close friend who is a programmer. We collected the hardware while he programmed and the end result is an automatic chicken coop door, which works reliably and lets us live our busy lives without always being home to let the birds in or out.

So What’s the Difference?

Through programming, we don’t need to periodically adjust the timer to keep up with the ever-changing sunrise and sunset times, ever. Our programmer incorporated a table of sunrise and sunset times by date, based on our location, into the program for our door along with a delay on sunrise and sunset times. We needed this delay to force our ducks to lay their eggs inside the coop before they head to the pond and because at night our birds aren’t quite ready for bed when the sun is setting. Our chicken coop door has a battery backup, too, so it will still open and close during a power outage. If you decide to use our plans and your coop does not have electricity, you’ll need to add a solar panel to keep the battery charged.

What You Need to Make Your Automatic Chicken Coop Door

Building this automatic chicken coop door requires some basic carpentry skills and tools, a general understanding of electricity and a little tech savvy. If you know how to build a chicken coop from a garden shed and create a Powerpoint you should be able to build this door. Here’s what you’ll need:

  • Arduino Uno microcontroller – The brains of the operation; it stores the program and tells the door when to open and close; found all over the internet for $10-15 shipped; make sure your Arduino comes with the USB cable and power cord like ours did.
  • Arduino DS3231 AT24C32 clock – Keeps accurate time for the Uno; it will require a watch battery most likely not included; also found all over the internet for $5 or less.
  • Jumper wires – Small wires with finished ends which connect the Uno to the relay board and the clock. This is also known as DuPont wire. Order a small bundle with different ends.
  • Relay Board – A circuit board with relays (electric switches) for controlling the linear actuator; we purchased one on Amazon for $12 
  • Linear Actuator – This physically opens and closes the chicken coop door; we purchased ours on Amazon for $68.
  • Battery backup – Powers everything and is nice insurance to have if you ever experience a power outage; we also purchased this on Amazon for $18.
  • Battery charger – Any inexpensive “trickle charger” will do; we purchased one from Harbor Freight for $9. If you don’t have electricity at your coop you’ll need to substitute a solar panel to keep your battery charged.
  • Electrical box – holds all the electrical pieces and Arduino; we had an electrical box on hand, but take a moment to think about where you are going to mount your box, and if it’s possible the box could get wet, look for a weatherproof enclosure at least 12×12” (our box is 16×16″); we took a scrap piece of plywood and glued it inside our box to mount the Uno, clock and relay board.
  • Wire, staples, connectors, wire nuts, etc.
  • ¼” x 5” Carriage bolts and nuts (x2)
  • 1”x10”x8’ board for cutting your pieces; we used PVC board so it wouldn’t rot.
  • 1-1/4” and 1-5/8” wood screws
  • Table saw with fence.
  • Drill
  • Laptop

Here’s the info tag on the linear actuator we used.

Step-By-Step: Making the Door

The chicken door measures 11.5”x 12”; however, the track for the door and the linear actuator require more headroom, so you’ll need free space measuring at least 13”x 40”. You also need to find a spot for the electrical box. After you’ve determined the location of the chicken coop door, lay out your lines and cut the hole for the door.

Cut all your pieces first. You’ll need:

  • 7.5”x 13” for the threshold
  • 4.5”x 26” (x2) for the rails
  • 5-7/8”x 14” (x3) to make the door
  • 3”x 4” (x2) and 2”x 4” (x2) to mount the actuator to the door

Disclaimer: We built another chicken coop door using scrap plywood so we could take pictures for this article, but would recommend PVC trim boards as they will not rot.

Next make the track for the door in the rail boards. The track will be approximately 3/8” deep by 1” wide. After setting the blade depth on your table saw, set the fence 1.75” from the blade.


A close-up of about how high the blade needs to cut into the rails to make the track, note the blade is set to half the depth of the board.

Start making cuts, moving the fence slightly with each cut, until your track is 1” wide. Do this to both rail boards.


Making the first cut for the track.


Track with two cuts.


Track is getting wider with successive cuts.


A finished rail with 1″ track. You’ll need to make two.

Construct the door by butting two of the three pieces you cut together. Use the third piece, centered left to right, to connect the two pieces, screw all three together with 1.25” wood screws.


Next, attach the rails to the threshold. Place a mark 1.5” from the front of the threshold on both sides.


Using this mark as a reference, position one of the rails perpendicular to the threshold and attach using 1-5/8” or larger wood screws. Pre-drill as needed. Repeat on the other side.


Screwing the rails to the threshold

Test fit the door to make sure it doesn’t bind in the track.


Test-Fit the door in the rails

If everything looks good, you’re ready to mount the actuator to the door. Drill a 5/16” hole through the center of your 3”x 4” pieces.


The easiest way to find the center is to draw diagonal lines corner to corner with a straight edge.


Using 1-5/8” wood screws, attach each 2”x4” piece to a 3”x4” piece to make an L-shaped bracket.


Use 1-5/8” screws to attach the two brackets to the back of your door. They should line up with the edge of the piece used to secure the two halves of the door and the bottom of the L-shaped brackets should be approximately 1” from the bottom of the door.


Use one carriage bolt and nut to secure the bottom of the actuator to the door. The top half will be secured to the coop once the door is installed. You are now ready to install the door in the coop.


Completed door, ready to install in the coop.

Because of the vast differences in chicken coop construction, you’ll need to determine the best way to mount the door and the upper half of the actuator. Before we installed the actuator, we used the battery to fully extend it so we could determine the location of the upper bracket.


A close-up of how we attached the top of the actuator to our coop.


Door seen from inside the coop in the closed position.


Door seen from inside the coop in the open position.

Step-By-Step: Wiring the Chicken Coop Door

With the door fully installed, it’s time to determine where you’re going to mount your electrical box and electronics. We decided it was best to mount our box in an area of the coop that is protected from the rain and snow. It may be easier to install the electronics before mounting the box in your coop. Using the listed schematic and jumper wires, connect the Arduino Uno to the relay board and clock board.


Wiring Schematic

Do the same to connect your battery to the charger and the Uno. Mount your electrical box in the coop, plug in the battery charger (or solar panel) and run two wires from the relay to the actuator.

Step-By-Step: Installing the Arduino Program and Files

Download and install the Arduino Program to a laptop, the software is free.

After you’ve installed the software, download the following chicken coop door program files and folders, making a note where they have been saved on your computer.

  • ChickenDoor (choose the file that matches your time zone)
  • Step_One
  • Libraries
  • Timezone_master
  • Configuration step by step

Follow the step-by-step instructions in the configuration file you downloaded. Once the files are loaded, the chicken door should be operational.

Setting the Delay and Making Time Adjustments

Sunrise and sunset times are specific to your location; latitude and longitude determine those times. The program for this door was written specifically for our area which is Cincinnati, Ohio. To correct this, you will need to set the delay based on the sunrise and sunset times in Cincinnati. For example, let’s say sunrise in Cincinnati is 8 a.m. but you live in Denver. Your sunrise on the same day is at 7:23 a.m. If you want your door to open at sunrise in Denver you need to adjust the delay by -37 minutes or you can just leave it alone and the door will open at 8 a.m. Denver time.

Using the delay is optional based on your needs, if you do not want a delay, set the values to zero. Making this change is easy to do and is outlined in the step-by-step instructions. By default the sunrise and sunset delays are set to 70 and 120 minutes respectively. We found this website especially handy when trying to calculate the difference between sunrise and sunset times in Cincinnati versus other cities in the United States.

We hope this automatic chicken coop door will prove useful in protecting your hens, like it has done for us! If you’ve made your own automatic chicken coop door, let us know in the comments below.

  • Timothy P.

    quick question, you mention a configuration step by step and to follow it.

    I only see the arduino files and the libraries. is there another file with the step by step instructions to be downloaded?

    • Hi Tim! Sorry about that. We uploaded the step by step but somehow didn’t get it in the right folder so it would show up publically. Anyway, problem is fixed. You should be able to see it now.

      • Erin,. Who can I talk to about the Arduino Coop door article? Specifically I’m trying to figure out who did the programming and ask them a few specific questions. Also I would be interested in talking to them about doing some customized work

  • Valerie D.

    Will ducks head in to a coop when it begins to get dark on their own?

    • The ducks are less predictable but ours have over time learned to go in. I’d say they make it in about 95% of the time. We had a duck raised by a chicken who always followed their schedule and she seems to have taught the other ducks to go in the coop at night.

  • Hi.
    My daughter spotted your article and as she wants to start keeping hen at her new home, as she works full time thought that this would be idealand you know who got the job.
    i have Just started to play with the Arduino and have no program experience, just trying to learn. I have downloaded the software and have altered the listing of sun rise and sunset times for the UK. The system works using a servo as a actuator,but the timings are not as your program is needing ajusted for the UK. Can you please advise me on what changes need done. Regards Frank

  • Thanks for posting this article. It is well written and easy to follow. I have built my controller and the door. I had an issue with the Sketch code. The door would never close I ran this down to the following line long sunset = pgm_read_word_near(sunsetAr + (ordinalDay – 1));
    which returned an erroneous number if the seconds were greater than 65535
    I know just enough C++ to be dangerous but I think that in my system it is doing a read word short. Anyway as a quick work around I reduced the sunset times by 30000 and then added 30000 back after the read. The door works like a champ. If you have any Idea what I may have done wrong to cause this I would like to hear. Thanks again.

  • Rather than reducing Sunset times
    the Fix for read error in the sunsetAr that I was experiencing
    long sunset = pgm_read_word_near(sunsetAr + (ordinalDay – 1));
    long sunset = pgm_read_dword_near(sunsetAr + (ordinalDay – 1));
    Regards Doug

    • Steph M.

      Hi Doug, if you send us the file via email, we would be happy to take a look and potentially post it. I was unable to retrieve it from DropBox.


  • What command do I need to add so the chicken door doesn’t open before 0630 during the summertime?

  • When I try to download the “libraries” folders and install the “TimeLib.h” folder, I get an Arduino error message that the folder does not contain a valid library. Has this folder or its contents become corrupted, or is there another problem? Thanks for any assistance you can give me.

  • It does not want to compile either file. I receive the following error: Arduino: 1.8.5 (Windows Store (Windows 10), Board: “Arduino/Genuino Uno”

    C:\Users\georg\Downloads\drive-download-20180518T023338Z-001\Step_One\Step_One.ino:11:21: fatal error: TimeLib.h: No such file or directory



    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

  • I am having an issue getting the program to work. I followed the program loading instructions but all the actuator does is repeatedly extend an inch or so and then retract, it does this until the power is removed. I confirmed the wiring set up and it matches the diagram provided in the article. Any suggestions? THANK YOU!

  • What happens if something is in the doorway when the systems starts lowering the door? Is there any kind of sensor?

  • Why couldn’t I just edit the lat/lon for my area? Also, is there a way to program a late hen open and close, maybe 30 minutes after the original close for any stragglers?


Leave a Reply

Credit Card Identification Number

This number is recorded as an additional security precaution.


American Express

4 digit, non-embossed number printed above your account number on the front of your card.


3-digit, non-embossed number printed on the signature panel on the of the card immediately following the card account number.


3-digit, non-embossed number printed on the signature panel on the back of the card.

Enter Your Log In Credentials
This setting should only be used on your home or work computer.


Send this to a friend