Introduction: Automatic Chicken Coop


This project is a automatic chicken coop. It measures the water and feeder level of the waterbowl and feeder.
It will also automatically open and close. This will happen on the time or day light. When the door is closed it can be opened by the chickens through a RFID chip on there legs. All the data of the chicken coop will be visible on a website.


We have chickens at home but we don't have always time to check on our chickens. With this project i can easily check on my chickens and know that they are save in there coop.


You need hole saw for the motor to open the door. For the spindle that attached the string and the stepper motor I used my 3D printer. You can make it from wood if you want but it would be more difficult to fit on the stepper motor. I also used glue to attach the guardrails for the door.

Other tools

Because this is for a school project I also made a I mini chicken coop. I used a table saw for this, some screws and a drill.



  • raspberry pi 4
  • HC-SR05 Ultrasonic Sensor
  • waterlevel sensor
  • Photosensitive sensor module
  • stepping motor + ULN2003 driver
  • SparkFun RFID Starter Kit + RFID tags
  • 16x2 LCD display
  • MCP3008
  • PCF8574
  • breadboard
  • 10K resister
  • Breadboard power supply

Other supplies

  • Drinking fountain
  • Step box silo
  • PVC sheet
  • plywood sheets (chicken coop)

Step 1: The Design

You can see on the pictures the design of the chicken coop that I made. Most things will work if you want to use this project on your chicken coop. The only thing you normally need to change is the placement of the water bowl, feeder and the size of the door. All the rest don't need to change but you can do so as you see fit.

Step 2: Electronics

Basic sensors

On the pictures above can you see the Electronics schematic of this project.
The ultrasonic sensor will be used for measuring the level of the feeder and the waterlevel sensor for the water level. These two components will be connected via a MCP3008 component to the PI.

LCD screen

With the PCF8574 we can show the IP address from the pi on the LCD screen. The IP address is required to access the website. On the website we will show the data from the sensors.

Stepper motor

The stepper motor i use comes with the uln2003 so it just connecting the two. The stepper motor has 4 magnets turning these on and of will allow the motor to turn. The four pins on the uln2003 are each corresponding with 1 of these magnets.

RFID reader

The RFID reader only need to be connected with 3 wires. ground, vcc and TX. The TX will send a serial signal to the PI. So we need this pin with the RX pin. You can also connect a antenna to the RFID reader for a bigger reach. If you want to use the RFID sensor effectively I recommend this. For what I am doing is the range of the RFID sensor is good enough. The moment you start working with real chickens you want to have some extra range from a antenna. without it it will be very inconsistent for the chickens to activate it.

Step 3: Chicken Coop


I created the chicken coop out of 1 plywood sheet cut in 3 equal parts. With what was left I made a feeder and a stand where my raspberry Pi can rest on.


  • make 2 gutters for the walls
  • make small 2 holes where your wires can run trough
  • cut a piece of would out of the bottom for the RFID reader
  • Make a place for the RFID reader in a piece af wood and put it in the hole

after I painted the coop I screwed the bottom to the walls. You can see the end result of the RFID reader in the last picture. If you have a ramp for your chickens you can put your RFID reader underneath that. I also made some support legs so the wires have room to go underneath my project.


The front wall will have all the electronics on it. For the hole of the stepper motor it needs to be at least 2 times the height of the door away from the bottom of the door. Otherwise your door will not be able to fully open. I recommend to have at least 5 cm extra room for safety. In the corner there is a place for your PI. The breadboard will be glued on the inside of the front wall.

  • Make a hole for your door.
  • Make to hole for your stepper motor
  • screw the other wall on the front wall on a 90 degrees angle
  • screw a piece of wood in the corner of the 2 walls


Cut the door you want out of the PVC sheet. Make it slightly bigger than the door itself so your fully covering the door. Make a small hole in the door where you can attach the string.

the spindle

I 3D-printed it but you can also made made it out other material. I will attach the design underneath this step.

Step 4: Code


The website I have made is for mobile first. on it you can see:

  • current water, feeder level
  • histogram of the water bowl, feeder
  • if the door is open/closed
  • the chickens that you have a RFID tag for
  • The chickens who openend the door with the RFID

You can also:

  • edit/add chickens and there tags
  • edit when/ how the door will open


if you want to use the code u will need to change a few things.

  • maybe the serial address to your RFID is changed.
  • Amount of steps for the door to open/close can be different.
  • connection to your database
  • % for water and feeder level

You can find the code on my GitHub. The code is not perfect and I will normally still change some things.

Step 5: Sensors

stepper motor and LDR

  • put the stepper motor in the hole you made for it
  • Screw
  • Stick the 2 legs of the LDR also trough the hole
    • Make sure that the legs don't touch the metal of the motor
    • You can also put Heat shrink tubing around the legs so they can't make a short circuit
  • I also soldered a wire to the legs of the LDR
    • You can connect it another way if you want

If you want to use this in at home make sure there is something covering the motor and LDR so water can't touch it. The LDR still needs light so make the cover transparent or have a hole where the LDR can still have daylight.

Ultra sonic sensor

  • make a hole in the side of your feeder to fit the wires trough
  • screw the sensor to the top of the feeder
  • when done correctly you can measure the distance to the food inside the feeder
  • put the wires trough the hole and connect it to the PI

Water level sensor

  • make a hole in the bottom of the water bowl
  • insert the sensor so that the electronics are just outside the bowl
  • use waterproof sealant to keep the sensor in place
  • the result will be something like in the picture
  • put the wires trough the hole and connect it to the PI

RFID reader

  • Put the reader in the hole you made for it.
  • now you need only the wires to the PI

Step 6: Assembling


  • paint the bottom and wall
  • screw the bottom and the walls together

The result will be like in the first picture.

breadboard + PI

  • Put the PI on the stand you created
  • use glue or double-sided adhesive tape to stick the breadboard on the wall.
  • they need to be able to connect to each other


Normally the sensors will have already wires connect to them. Run the wires trough the bottom and put them trough the hole next to the feeder. In the second picture you can see the result.

Step 7: End Product


At the end I made a cover for my breadboard. You don't need it but it looks better in my opinion. I made it from the PVC sheet where I cut the door out.


The things I would changes if your going to build this is

  • the breadboard + Pi placement. I would place them a bit higher so the chickens will not be able to reach the wires.
  • better covers for the breadboard and outside stepper motor/LDR
  • wires on the wall beter hidden
  • RFID reader with a antenna or one with better range.
    • More range will also mean higher cost. Antenna's and RFID readers are not cheap.
    • I would recommend to make your own an antenna if you can. It is allot cheaper and if you do it richt your range will increase. If your not satisfied with the range you can still look for a antenna