Automatic chicken door

April 1, 2025
Description
UPDATE: The servo holder has been updated, just like the code
A while ago, I had a project for school where I had to create an automatic chicken door to protect chicken from foxes, I had some experience with Arduino, And had a kit laying around. So I created a door to project the chickens.
The door has a height of 250mm or 9.84 inches, and a with of 200mm or 7.87 inches.
The leading rail needs to be printed 6 times.
I combined a use of laser cutting and 3D printing for this, But you can normally find a piece of wood with the dimensions of a height of 250mm or 9.84 inches, and a with of 200mm or 7.87 inches, with a bore holl in the middel above it,
For all the Arduino components, You need a:
- Arduino Uno
- A stepper 28BYJ48 motor with driver board
- A infrared receiver
- A infrared sender
- 1 Battery
#include <IRremote.hpp>
#include <Stepper.h>
#define IR_PIN 3
#define stepsPerRevolution 2048
const int stepsPerRevolution2 = 1900;
const int stepsPerRevolution3 = 1900;
const int stepsPerRevolution4 = 4000;
Stepper mystepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);
int timer = 0;
void setup() {
Serial.begin(9600);
IrReceiver.begin(IR_PIN, ENABLE_LED_FEEDBACK);
mystepper.setSpeed(10);
Serial.println("IR Receiver gestart. Druk op een knop...");
}
void loop() {
if (IrReceiver.decode()) {
unsigned long command = IrReceiver.decodedIRData.command;
Serial.print("Ontvangen code: 0x");
Serial.println(command, HEX);
// Verwerk de ontvangen code
handleIR(command);
IrReceiver.resume();
}
}
void handleIR(unsigned long command) {
switch (command) {
case 0x46:
Serial.println("Knop: Omhoog");
mystepper.setSpeed(10);
mystepper.step(-stepsPerRevolution);
break;
case 0x15:
Serial.println("Knop: Omlaag");
mystepper.setSpeed(10);
mystepper.step(stepsPerRevolution);
case 0x40:
Serial.println("Knop: OK - Motor stopt");
if (timer == 0) {
timer = timer + 1;
} else {
timer = 0;
}
break;
}
Serial.println(timer);
if(timer == 1){
mystepper.setSpeed(10);
mystepper.step(stepsPerRevolution4);
delay(100);
mystepper.setSpeed(5);
mystepper.step(stepsPerRevolution3);
delay(5000);
mystepper.setSpeed(10);
mystepper.step(-stepsPerRevolution4);
delay(100);
mystepper.setSpeed(5);
mystepper.step(-stepsPerRevolution2);
delay(5000);
}
}
The assembly for the entire model
On the left side, the holes are on the top, On the right side, the holes are on the bottom, You need to drill it into the backplate