Introduction: 3D Printable Fully Function Automatic Chicken Door
Attending School: Ogden-Weber Technical College
With this project, there were three tasks that I wanted to complete.
1. Use items and materials that were already available to me
2. It had to be fully functional and reliable
3. Had to be simple to operate and install
I believe I have completed all three of these tasks as the door came out as I wanted it to and it works perfectly without any problems.
I did use Fusion for all of the parts that I needed to model up in order to get this project up and running.
Materials
- A 3D printer with a decently sized build volume (I used an Ender 3)
- Filament (preferably PETG or any other materials that can take some heat before it deforms)
- 625ZZ Bearings
- Arduino Mega25600
- 28BYJ-48 Stepper motor with the driver Board
- Photoresistor
- A large battery that has around 12 volts (I used a battery that came out of a truck)
- Solar Panel
- Wire
- Small Nylon String
- screws (I ended up using mostly M4 screws but I did use a lot of random screws from a pile)
- Solar Charge Controller
- 220-ohm resistor
- Solder and soldering iron
- Mini Breadboard
- pipe/pole (18.5 MM in diameter)
Optional
- LED light bulb
- 2 small LEDs of color choice (I used red and green)
- Your personal preference of a closed momentary normally closed push-button, push-button, or a switch
Step 1: Parts That Need to Be Printed
There are only a few parts that need to be printed. I highly recommend you print the parts in some kind of heat resistant and UV resistant plastic such as PETG so the door lasts and you don't have to keep replacing parts.
Needed
- Chicken door electronic housing
- Chicken door electronics Closure lid
- Chicken door large bracing
- Chicken door large rod
- Chicken door lower half
- Chicken door lower pole holder
- Chicken door motor mount
- Chicken door smaller bracing
- Chicken door upper half
Optional
- Light bulb
- Light bulb switch or Light bulb switch automatic
- Light bulb wire clamp
- Wire organizer (though it does keep the wires looking nice and organized)
Attachments
- Chicken door electronic housing.stl
- Chicken door large bracing.stl
- Chicken door electronics closure lid.stl
- Chicken door light bulb wire clamp.stl
- Chicken door large rod.stl
- Chicken door upper half.stl
- Chicken door lower half.stl
- Chicken door light bulb .stl
- Chicken door lower pole holder.stl
- chicken door light switch automatic .stl
- Chicken door smaller bracing.stl
- Chicken door motor mount.stl
- Chicken door small rod.stl
- chicken door light switch v1.stl
- Chicken door wire organizer .stl
Step 2: Assembly Part 1
Assembly is relatively simple.
Depending on your printer's accuracy you might have some trouble placing the components where they need to since it's a pressure fit. Just grab some sandpaper and sand down the printed part to achieve the needed dimensions or if your fits are too loose you could use a few drops of super glue to ensure your parts will never come loose.
To begin with, grab two bearings and place them in the motor mount parts flush to the inside surface.
Note: These bearings are also the same bearings that are in V-slot wheels that 3d printers use and to get them out of the wheel just place the wheels in hot water and let them sit for a few minutes and you should find that the bearings can be easily removed by pushing them out. Make sure to dry the bearings as best as you can to prevent rust from forming and add a bit of lubrication to the bearings to ensure smooth rotation.
Next, take the two halves of the door and press them together.
(Might need a rubber mallet for this since the tolerances are tight)
After that take the bigger rod and position it in the center between the two bearings.
Continue to Assembly #2......
Step 3: Assembly Part 2
Note: Before continuing onto the next step check to see that the smaller rod fits onto the shaft of the motor. If it doesn't you have a few choices. I used a soldering iron to heat up the plastic and then shoved the motor shaft into the hole where it should go and this gives a nice and snug fit. The other choices aren't so neet and might not give such a nice fit but you can use a Dremel or such and make the hole slightly larger so the shaft of the motor fits neatly inside of the designated hole.
Then take your smaller rod and slide it from the motor mount side through the bearing and then through the larger rod and then it should stop sliding once it reaches the far end of the bearing surface.
Note: Make sure that the small holes in the rods line up so you can see light through the holes or you will have to reposition the rods until the light shines through.
Now it is time to mount the motor to the printed part. To do this just set the motor inside of the rectangular cut out so the holes of the motor line up the holes of the printed part. You might need to rotate the rods to get the shaft to go into the hole of the smaller rod.
You may have noticed the 4 holes on one side of the motor mount part. These holes are for mounting the top braces to the wall of the coop to ensure stability. I have included the brace files one is smaller than the other to fit my needs, and the large brace also allows me to mount the electronic housing easily to it. These probably will need to be modified to your specific needs since all chicken coops are not the same. So this can be easily done in some kind of 3d modeling software such as Fusion, TinkerCad, etc.
Now it's time to grab the poles and place them into the designated holes in the lower pole holder printed part. Again the holes might need to be sanded to fit the diameter of the poles if your printer doesn't have very good accuracy. Then after that slide on the two combined halves of the door onto the poles, these should slide smoothly. If not you have some sanding to do on the combined halves(you can try a little bit of lubrication on the poles just make sure the lubrication is the drying type as to not attract dust). After this put on the motor mount that should have the bracing that has been attached pointing to the side of the door that does not have the plastic that slides on the poles as seen in the photo. The door should look mostly complete at this point.
Step 4: Assebly Part 3
Now it is time to take the nylon string or any string of choice that has good strength and shove one of the ends through the holes of the combined rods at the top of the door. Once this is accomplished tie a knot to keep the string from falling out and allow the string to be wrapped up once the electronics are hooked up.
After that make sure that the door is in the lowest position and grab the string and make sure it goes inside the rectangular cutout and not on the outside as seen in the photo. Then bring the string down to the door and at the top of the door, there should be a square cut out. This square cut out allows the string to go through it to make it easy to make a knot (I used a round cylinder that had a grub screw instead). Make sure there isn't a ton of extra string that needs to be wrapped up by the motor and after making your knot cut off the extra string.
Note: The amount of string you will need will depend on your specific needs.
At this point, you can mount the electronic housing bottom piece to the longer bracing. On the housing bottom piece, there are two holes for screws that should also align up to the two holes on the larger bracing. Mount the housing to the bracing before mounting the Arduino or you will have to take off the Arduino and waste time. You should be able to mount the Arduino mega, stepper-motor driver board, and the small breadboard to the electronic housing. I used screws from a disc drive that I took apart to mount the components so just find some small screws that are lying around and those should work fine.
Step 5: Program
Programming the Arduino is relatively easy. Just plug the Arduino mega into your computer. Then if you don't have the Arduino IDE already installed you can do that now. Then download the file that I have included and open it up in the Arduino IDE. Following that step set the correct board and processor(Arduino Mega 25600) and find the port it is connected to (mine doesn't have a port since I don't have the Arduino connect to the computer). Then just click the upload button and it should start compiling the sketch. If it gives an error message sometimes you just have to unplug and replug in the Arduino to the computer and try to reupload the sketch. The lights on the Arduino should flash which means that the uploading is working.
Here is the code if you have trouble with the included Arduino file:
#include
const int stepsperrevolution = 1500;
//Determines what pins the drive board is connected to
Stepper mystepper(stepsperrevolution, 3, 5, 4, 6);
//This section determins what pins are being used
int led1 = 8; //If you don't plan on using the leds delete the int led1=8; & int led2=7;
int led2 = 7;
int light = A0; int count = 0;
int lightcount;
void setup() { // put your setup code here, to run once:
mystepper.setSpeed(10);
//Sets the speed of the motor..lower value makes have more torque while a higher value allows for more speed
//Sets weather info is coming in from sensors or data is being sent out from the arduino
pinMode(led1, OUTPUT); //If not using leds delete this line and the line below it
pinMode(led2, OUTPUT); pinMode(light, INPUT); }
void loop() { // put your main code here, to run repeatedly:
lightcount= analogRead(light);
if(lightcount >15 && (count <10) ){ /*If you want the door to open ealier change all number 15s to a lower number and up it if you want to open later change them to a higher value
If you need the motor to rotate more then it does change all number 10s to a higher value and if you need it to rotate less, lower the values
*/
mystepper.step(stepsperrevolution);
count = count + 1;
} if(lightcount<15 && (count > 0) ){
mystepper.step(-stepsperrevolution); count = count - 1;
}
//This section tunrs off the motor to save power
if(count == 0){
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
else;
if(count == 10) {
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
//This section controls the two leds...You can delete this section if you don't plan on using the leds
if(lightcount<15 &&(count >= 5)){
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
}
else;
if(lightcount <15 &&(count <= 1)){
digitalWrite(led2, LOW);
delay(5000);
digitalWrite(led2, HIGH);
delay(1000);
digitalWrite(led2, LOW);}
} //Don't delete this bracket
Attachments
Step 6: Installation Part 1
Installation is relatively easy since all the assembly should be complete. Now it is just placing the door where you want it to go and then screwing in some screws. The bottom piece just uses everyday wood screws which can also be used for the top bracing if you like but I opted for some M4 screws which I had laying around and I drilled two holes and then screwed in the screws through the wall and into the longer bracing. For the smaller bracing I ended up using some short woods screws but you can use whatever screws you have that will meet your mounting needs. Next, you are going to mount the solar panel charger control near the Arduino housing so that the USB cable can be used to power the Arduino since the solar panel charger has USB ports. I also screwed in a small piece of wood at the bottom to raise my door off of the floor to avoid getting it as dirty as if it would have been resting on top of the floor.
Now you can mount your solar panel to where ever it gets the most sunlight (for me it was on the roof of the coop). Then you are going to drill a hole into the coop. If you have the solar panel on the roof it's a good idea to make a hole in the side of the coop for the wires and then make a loop. this allows for any rain to fall off instead of going into the coop. You should also add silicone to insure the hole with the wire doesn't allow water to make its way into the coop and cause problems.
The next part of the installation is going to be placing the battery somewhere near the charge controller. I have mine on the outside of the coop on top of a piece of styrofoam (hard to tell in the picture) then I have a cover to keep the battery protected from the elements. You could take this further and have a box inside of the coop just for the battery. That would ensure the battery is protected and it would also make it easier to access the battery if needed. For the wiring for the battery, there was already a small hole in the floor and that is what I used to rout my wiring from the battery into the coop and then connect it to the charge controller. If you need to add a hole just use a drill with a good size drill bit and create your hole where you need it to go.
Step 7: Installation Part 2
If you are just keeping this build simple then there is only one thing left to install and that would be the photoresistor. I drilled a hole in the side of the coop just big enough to accommodate the diameter of the sensor. I then proceeded to put the sensor in the hole with a little bit of superglue just to make sure it doesn't fall out. If you want you can print out the wire organizers that I have included to make the wires more organized and not all over the place.
Note: I placed the sensor outside to make sure it reads the accurate amount of sunlight. You could potentially leave the sensor by a window if you have one and that should work fine too.
Optional Installation
This is if you want to make your coop a bit more high-tech. For the two small LEDs, you are going to do the exact same thing as with the photoresistor. Just drill to small holes that will fit the LEDs (make sure the holes are facing where you can be able to see them flash at night) and add a little bit of glue and it's that simple for that part.
Now if you want to have a small 12 volt light bulb inside of the coop for when you need to go out there when it is dark this will be the perfect thing to do. I had a little 12 volt light bulb lying around so I created a custom mount for it to fit my needs. I then also created two different types of switch mounts that can be used. The normal switch mount just has a micro push button that allows you to turn on and off the light when you want. The automatic switch has a normally closed monetary push button that presses up onto the door when it's closed turning off the light. When the door opens the switch allows current to flow through turning on the light. Wiring these up is really simple just make a series circuit with them and you should be good to go. The charger control has a negative and a positive terminal dedicated to an accessory like this light bulb.
Step 8: Wiring Up the Electronics
Note: Before moving onto the next step, if you plan on using the electronic enclosed that I provided make sure that you route the wiring through the holes of the closure before wiring up the electronics. The small hole on the side is for the photocell while the larger opening on the opposite side is for the LEDs and the motor wires.
The wiring is really simple the Easy circuit with no LEDs has only the motor and the photocell that you have to wire up. The motor connects from pins 2-6 on the Arduino while the photocell has a wire that reads the current and that connects to A0. The photocell uses a 220-ohm resistor to keep the pin the Arduino pins from getting burned up.
The Circuit with LEDs is the same as the easy circuit but the LEDs have the power sent from pins 8 and 7. They also use 220-ohm resistors to keep them from burning up. The black wires are to the ground and the red wires are to 5 volts on the Arduino board or to the LEDs pins.
Note: The small breadboard works perfectly fine but if you want to go the extra mile you can make a custom PCB board but I don't have the knowledge to do that and the breadboard works perfectly fine for me. Though if you end up using the breadboard make sure to glue down the resistors and wires with something like hot glue just to ensure that they don't fall out and cause issues.
With all the Ardunio wiring done you can now put on the lid to the electronic enclosure. The screws I used were M4 screws. Next, you can wire up the solar panel and the battery and if you are using the 12 volts led if you haven't already. The charge controller has the spots marked on the plastic to show you where everything should go making it very easy. Just make sure not to place the negative in the positive or vice versa. Before you plug in the Arduino to your charge controller make sure that the door is all the way closed. Now the Arduino can be plugged into the charge controller USB port. The door should start rising up with the motor humming. If this does not happen go back and make sure that the wiring is correct as this is most likely your problem.
Step 9: Testing and Modifying
The door should stop after 10 rotations as determined by the code that was uploaded to the Arduino. If the door is needed to be raised higher or lower you can go into the sketch and change the values until you get your desired result. The final thing to make sure is that the door shuts correctly. I suggest that you get a piece of duct tape or electrical tape and cover the photoresistor. The door should start closing once this is done. If it does not this can also indicate a wiring issue or even a program issue if you changed something in the sketch. If you used the LEDs you should eventually see one of the lights flashing when closing Then eventually the other LED should start flashing instead and continue flashing every few seconds to indicate the door is closed.
Now with all of these steps taken care of the door should be off and running without any problems. I have been using my door for over a month and it still functions as it should. The door is a very nice feature to have to keep out the cold blowing wind. It is also useful in keeping out any varmint that might want to enter the coop during the night. It is also a fun thing to talk about when you have guests over and they stare out of a window and they see the blinked lights from the chicken coop and they think it is an Alien invasion! (:
During the process of modeling all of this in Fusion, I learned a bit more about inserting mesh features into Fusion. I had to do this with the STL file for the stepper motor to make sure I got the accurate dimensions which helped a lot from having to do any guesswork. This knowledge will definitely help me in the near future if I want to modify a file from someone else to fit my needs.