
Building an automatic chicken coop door opener - PascLeRasc
https://www.iotforall.com/building-cheap-automatic-chicken-coop-door-opener/
======
kabouseng
Reminds me of the story of a farmer asking if an engineer can help him
identify sick ostriches on his farm. So to identify a sick ostrich, it doesn't
eat anymore, so the engineer develops a tilt sensor that you strap to the
ostriche's neck, and if it doesn't tilt enough times a day the ostrich didn't
eat and a LED would light up red indicating the ostrich is sick and requires
the farmers attention.

Now the problem is to separate the sick ostriches from the healthy ones. So
the thinking is you connect the ostrich camp with a narrow passage to another
camp, and put out food in the other camp and as the ostriches move to the new
camp you capture and divert the sick ones.

Turns out that when you put out food in the new camp, only the healthy
ostriches will move to the new camp and the sick ones will stay behind because
they are in any case not interested in food.... which negates the need for
engineer and his sensor in the first place :D

~~~
Wiles_7
That reminds me of this story about removing empty boxes from a production
line.

[https://userweb.cs.txstate.edu/~br02/cs1428/ShortStoryForEng...](https://userweb.cs.txstate.edu/~br02/cs1428/ShortStoryForEngineers.htm)

~~~
gmiller123456
Funny, but obviously not real. If the guys were tired of "tired of walking
over every time the bell rang", the number of defects detected wouldn't be 0.

~~~
brokenmachine
1.Bell is ringing too much and people are tired of walking over: defects > 0

2.Put fan there to blow empty boxes: now defects == 0

I don't see the problem.

~~~
BioMeditate
Yea you would put the fan before the check point so the line doesn't stop.

------
3chelon
I've had my own design of one of these up and running for about 5 years now. I
should probably write it up.

I used a normal (non-stepper) motor with some gearbox I found in an old
cassette player. The door limits are detected using reed switches.

It is solar powered, with a 12V lead-acid battery. I've had to replace that
twice over the 5 years because winter tends to kill it. Since then I've added
a winter trickle charge wire from the nearest outbuilding.

The solar panel voltage into an ADC provides the daylight reading. An Arduino
Nano provides the main control functions. It spends a lot of time in sleep
mode, waking every 5 minutes to check light levels, and at night sleeps until
a preset time when it makes sense to start checking for daylight again.

It also has an XBee radio link to a Raspberry Pi which sends me email updates,
keeps the Arduino's clock accurate (obviating the need for an RTC), and alerts
me of any mechanical problems with the door mechanism. A common one is straw
and other mess getting jammed in the door runners, and once a broken door
mechanism.

Over the years I've tweaked the opening/closing times to account for the hens'
habits, and for predators. I've learned that the dawn/dusk opening technique
is not enough on its own, it needs to know the time of day also.

It opens at 6:30am or first light, whichever is latest. Too early in the
summer and you're asking for fox trouble, and also the neighbours used to
complain the cockerel would crow when it opened too early (sunrise can be
before 4am in midsummer).

My hens go to bed very early, so it closes before dark, and again at least by
7:30pm in the summer because foxes can be active by then.

We live in the country and almost everyone near me has hens, but they rely on
manual opening. They have all lost their entire flocks to foxes at least once
in the time my automated door has been operational, but thankfully we have
not. I have seen scratch marks on the sliding door indicating interested
predators, but I think my timing is right to keep the coop closed when foxes
are about.

~~~
rsync
"We live in the country and almost everyone near me has hens, but they rely on
manual opening. They have all lost their entire flocks to foxes at least once
in the time my automated door has been operational, but thankfully we have
not. I have seen scratch marks on the sliding door indicating interested
predators ..."

We live on a very small island of private property inside a _huge_ expanse of
open space / wilderness and thus have very heavy predation on any animals we
raise.

In the case of our chickens, I just kept adding hot wires to the fence until
nothing could get into the run. There are four hot wires now, two of which
form a negative (back bending) slope. It is impossible for a thing to climb
the fence now without touching (and holding) at least two hot wires. We've had
our current flock for over a year with no losses, vs. losing every previous
flock to raccoons and weasels every 2-3 months.

I wonder if you would comment on this (seemingly successful) strategy - you
seem to know what you're doing...

~~~
3chelon
The problem with fences is the underground part. I have relatives in France
whose chickens were all killed by a fox digging under the fence.

They say you need as much fence under the ground as you have above it.

Your problem with being really isolated is that the predators will not be
afraid to come out in daylight. If I were going for a tech solution I might
start thinking about detection systems...

Or maybe just dogs?

------
feistypharit
Anyone interested doing something like this, I've also done this with a
esp8266 and a linear actuator. Detailed how to:

[https://blog.garble.org/arduino-chicken-coop-
hardware/](https://blog.garble.org/arduino-chicken-coop-hardware/)

[https://blog.garble.org/arduino-chicken-coop-
hardware/](https://blog.garble.org/arduino-chicken-coop-hardware/)

I've installed a few of these now and love em

------
xg15
> _If price weren’t a constraint, I immediately would have chosen a cellular
> IoT board like the Particle Electron or Boron ($50). Connectivity to the
> cloud provides several advantages:_

I think we should question whether tech as a whole is moving in the right
direction when the first question for building a time-controlled, battery-
operated chicken door opener is "how do I connect it to the internet?"

(Sorry for the sarcasm, otherwise, it's a really cool project though)

~~~
mitjak
i mean, yes? but also his concerns around clock drift and email notifications
are legit.

~~~
jschwartzi
He could probably synchronize his RTC to the GPS system. GPS works by sending
a clock signal plus satellite ID from each satellite. Devices using GPS then
use an ephemeris to determine the location of each satellite and then
calculate the relative position of the receiver.

~~~
icebraining
There are also time signal radio stations like WWVB, which are used by
millions of devices to sync their clocks.

------
ndespres
My coop is outfitted with one of these automatic door kits:
[https://chickendoors.com/product/right-standard-pullet-
shut-...](https://chickendoors.com/product/right-standard-pullet-shut-
door/?gclid=CjwKCAiA0O7fBRASEiwAYI9QAhx1WldAnxw36kfxXPT6tfBQAQ5zuvg8KaQ-
QMzjUr93ty9jtWktrhoCaWMQAvD_BwE)

It opens at daylight, closes at dusk. Adjustable tolerances in either
direction which I need to adjust occasionally but not often, like after DST
changes to allow the door to stay open longer while the chickens get used to
the shorter days, ensuring they can get inside before the door shuts, with
darkness falling earlier. Small solar charger and battery keep it operational.

I understand the impulse of the author to design something complicated, but
practically speaking there is no need to remotely control the opening of the
coop door over the internet, especially if you have a photoresistor already to
detect daylight.

~~~
InitialLastName
Not sure I understand; if the coop is opening at dawn and closing at dusk, why
does it need to adjust for DST? From the chickens' perspective, the sunset
time doesn't change substantially at the moment of DST change.

------
dirktheman
Nice project!

 _Needs to be battery operated and last for at least two weeks (14 days)_ :
UNOs are notoriously power-hungry. It's highly unlikely that 4 AA batteries
can power an Arduino UNO full-time AND open/close the coop door. Maybe with
some advanced deep-sleep-cycle, but I'd love to know more about this.

I also fail to see why he didn't use a cheap ESP-board. They're usually
cheaper than Arduinos (as in: below 5 bucks), have an onboard WiFi chip and
they run Arduino code just fine. You get a couple of pinouts less, but since
he's only using a sensor and a stepper motor this won't be a problem.

If I were to make this, I'd go with a nodeMCU and a cheap solar charging
setup. Probably would fit in the budget, too.

~~~
LeifCarrotson
> UNOs are notoriously power-hungry... Maybe with some advanced deep-sleep-
> cycle, but I'd love to know more about this.

The naive Arduino code has two basic functions setup() and loop(). Putting
your main code in loop results in a busy wait that spins up 100% of the CPU
all the time. It's also running all the peripherals all the time.

You want to use "avr/sleep.h" and "avr/power.h" to put the processor to sleep
with peripherals off (except the one which will wake up the processor). See
[http://www.gammon.com.au/power](http://www.gammon.com.au/power) for a nice
tutorial. Opening these headers and their source in the avr-gcc libraries and
comparing to the documentation on the processor is a good exercise in getting
right down to the metal of how the processor manages power.

You also want to get rid of the ancient 7805 regulator; many clones use a
better LDO voltage regulator to alleviate the problems with high standby
current.

------
hihungryimdad
Really fascinated by this kind of stuff, but getting into it seems really
overwhelming. I think it would be something really fun for me and the kids to
do together, does anyone have any personal beginner resources to recommend?

Of course I'll do the googles too.

~~~
jon-wood
Like software development the best approach is to learn a concept at a time
and then put them together into something bigger. Start off just with an
Arduino and some basic LEDs and switches - that'll teach you the basics of
connecting things together (if you're really at the beginning don't even
involve an Arduino, just get do it all on a breadboard). Once you're
comfortable with that maybe add some more exotic inputs and outputs, like
light sensors and motors. After that maybe replace your Arduino with an ESP32
which will give you wifi and bluetooth to interact with your system.

Once you've spent a while doing that you should be in a good place to start on
more complex projects - there are a few robot kits designed to have a
Raspberry Pi mounted on them to make them programmable, or maybe look at
ESPHomelib[1] to do some home automation.

[1] [https://esphomelib.com/](https://esphomelib.com/)

------
hackeric
Very creative and useful project. The Internet of Poultry (IoP) has finally
arrived:)

~~~
gh02t
Honestly, farming is probably the place where IoT makes the most sense.
Especially for very environmentally sensitive processes like winemaking, large
sensor networks and data analytics offer a lot of value to the farmer.

~~~
jschwartzi
You can do a lot of the same stuff with Bluetooth Low Energy and avoid putting
your entire winery on the internet. I really like BLE because it's a very
straightforward set of protocols for building sensor networks and
sending/receiving data.

~~~
gh02t
LoRa is probably the way to go for farmers, given the range requirements. No
need to connect to the Internet regardless.

------
dpeckett
Great project and all, and definitely something fun to work on, but this is a
pretty questionable application for IOT (don't wish to discourage).

What's the key metric here? The chicken coop opens and closes at the
appropriate time of the day? How does IOT help solve that objective? There's
some great parallels here to an MVP in the software world.

As for my two cents, an alternative and more robust solution, could be put
together with something like an aliexpress ambient light switch, limit
switches, a recycled car battery, a trickle charge solar panel, and some relay
logic.

~~~
ergothus
I'm unclear on why this is a questionable usage. My wife keeps chickens, and
going out morning and night to open the doors is...certainly not hard, but
inconvenient (particularly the night one, as you often remember AFTER you've
settled in for the night and must head out, regardless of weather.

Skipping the occasional visit doesn't work either - they need to get out both
for general happiness and foraging, and if you don't close the door, creatures
kill your chickens. (This has happened to us twice, and we're in the middle of
suburbia, albeit the Seattle variety with more wildlife than the average cul-
de-sac)

> The chicken coop opens and closes at the appropriate time of the day?

It's closed sometime after chickens have entered for the night, which tends to
go off of sunlight, and opens early enough that the chickens aren't literally
cooped up when they want out. That's rough, but the machine doesn't have to be
perfect, it just has to do as well or better than we humans do.

As for what value does IOT add? Well, it can help confirm when it is/isn't
working, but mostly it's that the cost is almost the same, at least for those
of us without extensive electronics experience. Your alternative (I'm not sure
how it's more robust) solution LOOKS cheaper, but I wouldn't know how to
connect the parts and would likely screw up the amps/watts enough to break
stuff and require replacement parts. For me, spending an extra $50 on parts is
worth the saved time and effort - even as the $250 version that has no options
for customization of behavior/interactions is NOT worth the saved time and
effort.

Probably - it should be noted I've been researching this topic (along with any
way to ensure the chickens ARE all inside - if they get broody they may nest
elsewhere, which ends poorly) for the past year but so far we're still doing
it manually. I expect this to change over the holidays.

> There's some great parallels here to an MVP in the software world.

Only in the vague "is this adding enough value to be worth it?" sort of way,
but as the answer is "it depends" I'm not seeing the great learning
opportunity you're implying.

~~~
dpeckett
I have no qualms with the merit of an automatic chicken coop door. Obviously
the benefits can be considerable, and the project certainly fits the bill.

The point is, almost all maker projects jump straight to let's throw an
Arduino at it, with no consideration to the tradeoffs at all. This can be
quite a disservice.

There are tradeoffs, eg. power management? (those batteries aren't going to
last at all), fault tolerance? (arduino crashes due to condensation shorting
out the timing crystal), maintenance? can you instruct an untrained individual
to perform any meaningful repair work (eg. bend the arm on a damaged limit
switch).

One benefit IOT can bring, is the detection of fault conditions etc (door took
too long to open fully something stuck in the tracks), but implementing that
kind of handling in a meaningful way is a complex problem.

These things rarely matter for a diy project, but you see this stuff
everywhere. Consider whether a problem can be solved in an analog or
mechanical manner, it's likely to lead to a simpler and more robust solution.

As for ensuring chickens are inside of a coop, that's a tough problem and I'm
interested to hear your thoughts on that?

Eg. for the above chicken in coup problem, something as simple as a weight
triggered switch on the ramp (or a push bar near the coop opening) is likely
to out perform anything more complex.

~~~
ergothus
> I'm interested to hear your thoughts on that?

My thoughts are definitely too complex. Currently I'm thinking of a camera
that will turn on a light and take a picture (at a specified time || when door
closes) and send that to our family Slack - someone will habitually look at
any notification, and we don't have a large number of chickens so it's fastest
to rely on human perception to see if someone is missing. Or just a camera
that we can turn on remotely to check the feed ourselves.

That's the "simple" version - a more complex one would take a picture and
compare to an empty sample to decide how many blobs there are, but that is
hampered by (1) If chickens huddle, that becomes complex and (2) it's not a
problem space I have any interest in, so the problems won't be fun to solve.

~~~
dpeckett
Vision sounds like a really tough way to solve it, challenging lighting
conditions just to make things trickier.

I know that in some contexts, RFID tags are used for livestock tracking. Don't
know if they would comfortably work on birds though.

------
bcheung
How does the track mechanism work? Is that just a string being wound around
the motor shaft?

I've been playing around with Arduino and find the electronics easy but it's
really hard to get good information about linear motion in terms of what parts
to get and what wheels / accessories are compatible / needed with what tracks.
Very few resources out there and I've ordered so many incompatible tracks,
wheels, carriages, etc because I couldn't find any information on what mates
with what.

------
henripro
I used a raspberry pi, a controller board and a linear actuator to create a
similar solution. I also coded up the door lock, but turns out the linear
actuator has enough resistance to stay closed on it's own.

[https://github.com/HenriPro/ChickenCoopDoor](https://github.com/HenriPro/ChickenCoopDoor)

------
josephv
Cool project, but is it a failure for one of the requirements being that it
costed under $50 and title says it costed $100?

~~~
sketchet
I believe it was $50 for the door and the remaining $50 was for the parts.

------
gadders
Depends what you value your time at, but I've had two ChickenGuard automatic
door openers for years now, and they've worked perfectly:
[https://www.chickenguard.com/](https://www.chickenguard.com/)

~~~
code_duck
Heck, why not just go to the store and buy some eggs?

~~~
ahje
The taste (not to mention the color) of store-bought eggs aren't up to par.
Eggs from own free-range chickens are simply... better.

Also, chickens are really fun animals, and they taste nice too.

~~~
code_duck
I agree! But my comment was sarcasm/extension about his suggestion to reduce
effort by buying a commercial door opener. Like damn, if you’re not going to
make your own door opener with an Arduino, are you truly even committed to
raising chickens?

~~~
joshcrowder
I got the sarcasm and found it highly amusing, more so with the amount of
comments about egg quality!

------
pvaldes
The biggest problem is to convince chicken to go sleep at the coop instead in
its favourite tree.

------
metaphor
I'd be very surprised if the motor and electronics last a season without
fault.

------
davewasthere
Annoyingly, doesn't mention how it counts the chickens. :)

~~~
codeulike
It has a light sensor, so it assumes that once its dark enough, the chickens
will have come inside of their own accord. Based on chickens I've met, this is
probably accurate.

~~~
wiredfool
When I did it, I just closed the door at ~nautical~ civil twilight. The
chickens come home to roost before that, and the predators (raccoons)
generally were later than that.

My design was Raspberry PI -> sensor/power board -> battery powered drill. And
an extra long usb cable to get the wifi dongle to the other side of the roost,
because when the chickens were in the coop, they absorbed enough wifi signal
to make it drop off the network.

Edit -- changed which twilight. Also, code here:
[https://github.com/wiredfool/coop-door](https://github.com/wiredfool/coop-
door)

Unfortunately, schematics and physical door design are lost to several moves.

~~~
codeulike
TIL chickens are wi-fi jammers

~~~
icebraining
All sacks of meat, humans included, are to some degree. We're made of a lot of
water.

------
mbirch39
our neighbor had an automatic door and the coyotes learned what time the doors
opened.

They were first in line for breakfast.

------
pieterhg
Where is the video? (I'm on mobile Safari)

~~~
oneeyedpigeon
[https://vimeo.com/301639731](https://vimeo.com/301639731)

