How do open/close a hatch

I have a poultry run, when it gets dark, it needs to close, and when it's starting getting light it needs to open. This is to protect the chickens against predators that hunt at night.

Here is a quick sketch:

The door is about 50x50cm and weighs about .5 kg.
This is my first Arduino project, so I'm not sure what to use. I guess a basic servo that triggers on a specific time? And what's the best way to attach it to the door to make in open and closed? Also, how to make the whole thing weather proof?

There are plenty of water proofing kits. Just look up waterproof project boxes. A servo or stepper motor will probably do the job, and it all depends on what you have available in terms of setup. my first thought is to basically tie some rope or maybe steel cable to the top corners, mount everything on top of the device, and assuming the door is balanced so that it will fall open by default, you basically use the servo to pull in the cable to close it, and then release and let gravity open it. Light sensors and/or timers are easy.

That's an option, however I'm not sure whether the door will fall down if it's completely upwards

I had this idea, only the hook on the door should be a rails of some kind, and the box should be small enough to not obstruct the door when it's open

5 kg seems a little heavy for a servo: What about a geared motor and limit switches

0.5 kg :smiley:

Ok, sorry. But what if a chicken sits on the door when trying to close it?

I'm not shure the geometry works on your sketch. But a linkage from the servo horn to the door at a appropriate distance might. Have you considered a pulling linkage instead of at pushing one? And have an other servo for hatching the door. Here's one way to do it

You would use a Light Dependent Resistor (LDR) to sense the light level and open/close the door at dawn and dusk.

Do you need to ensure that all the birds are inside before you close the door?

D you need to have some way to tell whether the door has actually physically closed when it was supposed to?

The mechanics of opening and closing the door would be simple enough. I suspect you will want to design the mechanism such that the motor can't strangle/crush anything that happens to be in the way when it closes, for example by letting it close slowly under its own weight and using a cord to pull it open against the spring, so that the maximum closing force is limited. If you take that approach then a small DC motor with a high reduction gearbox winding a small pulley would be capable of producing enough force to lift 500g. It might need 30 seconds to fully open or close, but you're in no hurry. I have a 12V / 100mA motor here which is probably the sort of thing you'd need.

PeterH:
You would use a Light Dependent Resistor (LDR) to sense the light level and open/close the door at dawn and dusk.

Wouldn't it be easier to hardcode the dawn/dusk times for each day? That would also prevent the door from closing when something is blocking the sensor.

Do you need to ensure that all the birds are inside before you close the door?

Nope they automatically go inside when it gets dark. But just in case, I thought about having a speaker play some beeps a few minutes before closing, the birds should know that it's time to hop in.

D you need to have some way to tell whether the door has actually physically closed when it was supposed to?

I guess when using a servo, it's a matter of coding the right angle and it should be closed. I'm not sure if the servo is strong enough to keep the door shot.

The mechanics of opening and closing the door would be simple enough. I suspect you will want to design the mechanism such that the motor can't strangle/crush anything that happens to be in the way when it closes, for example by letting it close slowly under its own weight and using a cord to pull it open against the spring, so that the maximum closing force is limited. If you take that approach then a small DC motor with a high reduction gearbox winding a small pulley would be capable of producing enough force to lift 500g. It might need 30 seconds to fully open or close, but you're in no hurry. I have a 12V / 100mA motor here which is probably the sort of thing you'd need.

The only problem is that I suspect that the door will not fall under it's own weight, when it's up right, it's balanced and doesn't fall forward. A DC motor seems ok, but to me it seems way simpler to use one servo. However, I don't know if they're strong enough.

nilton61:
Ok, sorry. But what if a chicken sits on the door when trying to close it?

That's a good point, if the servo or motor is strong enough, it will just roll off

I'm not shure the geometry works on your sketch. But a linkage from the servo horn to the door at a appropriate distance might. [/q]
What will not work? Offcourse I need a rails instead of hook, but then it should work.[q] Have you considered a pulling linkage instead of at pushing one? And have an other servo for hatching the door. Here's one way to do it
http://arduiniana.org/wp-content/uploads/2009/10/fig10-6501.jpg

That's similar to my idea, altough I need both pull and push, I don't think the door will fall open on itself, because it's outdoors, there will be moisture and dirt that could door go less smooth.

An enclosed linear actuator would do the job: Pololu - Generic Linear Actuator: 12" Stroke, 12V, 1.5"/s

jremington:
An enclosed linear actuator would do the job: Pololu - Generic Linear Actuator: 12" Stroke, 12V, 1.5"/s

Cool.. but expensive

arne82:

jremington:
An enclosed linear actuator would do the job: Pololu - Generic Linear Actuator: 12" Stroke, 12V, 1.5"/s

Cool.. but expensive

You can make your own linear actuator for next to nothing, especially if you use salvaged parts. All you need is a threaded rod of the desired length, a captive nut that the rod drives, and a geared-down DC motor to rotate the threaded rod. There are lots of DIY tutorials, here is one picked at random: https://www.youtube.com/watch?v=Q_e-4cXfaMI

Wouldn't it be easier to hardcode the dawn/dusk times for each day?

The clock in an Arduino is not terribly accurate; a RTC chip like a DS3231 (or a GPS module) is strongly recommended to avoid drift. Although, if you combined a light sensor and the Arduino's internal clock, you could use each to reduce the error in the other. I.e., close the door when it gets dark AND it's within 1 hour of the estimated sunset time. If it's dark but not near sunset, wait for the sunset time to arrive before closing the door. If it's sunset time but not dark yet, wait until it gets dark before closing the door. The problem here is the Arduino will "forget" what time it is if there's a power loss or if you reset it.

The other issue with timing is, unless you live very near the equator, the sun rises and sets at very different times in the summer and winter. My chicken door sketch uses the TimeLord library to calculate the precise sunrise and sunset time for each day at my latitude and longitude:

http://forum.arduino.cc/index.php?topic=198702.0

I thought about using a simpler algorithm, but TimeLord is pretty small -- I'm only using like 9.5KB out of 32KB flash, so why re-invent the wheel?

I use a hacked up cordless drill to turn a length of threaded rod, like jremington describes. It cannot be back-driven, so a predator cannot physically muscle the door open. Other mechanisms like belts or strings can often be back-driven with little effort, so you must use a separate internal latching mechanism to prevent the door from being forced.

Why don't you hinge the coop door on the side like a people door. A typical hobby servo probably could easily swing the door open and closed with little effort and little chance of injuring a chicken in the door way. Below are some previous chicken coop discussions.

https://www.google.com/search?as_q=coop&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=