Most chickens are pretty good at putting themselves to bed when the sun sets, and [Eddy]’s chickens are no exception. But they’re not terribly thoughtful about closing up after themselves, so he set about on a long-term project to automate the door of their coop.
An open door overnight leaves chickens and their food vulnerable to predation. Rather than handle the chore manually and risk one forgetful moment that could wipe out his flock, [Eddy] used a servo to power the door and an Arduino to control it. To keep track of bedtime and wakeup, a Raspberry Pi looks up the local civil dawn and twilight times online and tells the Arduino when the moment is at hand. The Pi cleverly caches the times for use the next day in case the WiFi connection is down, and also provides a web interface to check on the door’s status and manually override the cycle. Result: safe, happy chickens.
If all this seems a bit much for a simple job, [Eddy] agrees. But he’s using this as a testbed to develop a home automation framework that can be retasked at will. Sounds like he’s on the right track to us, but for more IoT animal husbandry tips, he’ll want to check out this small farm automation effort.
Just a smidge of velociraptor DNA, we’ll have some clever girls soon enough …
This story is definitely for the birds.
That door will definitely stop a determined predator
It’s worked so far. Let’s hope the predators don’t get much smarter ;)
Just a smidge of velociraptor DNA, we’ll have some clever “predators” soon enough …
This swinging door would easily be pulled outwards by any of the common predators – the hardware cloth (screening) provides purchase for claws to grab ; the servo – especially with the long arm providing leverage against the servo gearing – doesn’t stand a chance against a predator, the door itself doesn’t appear to have a lot of structural rigidity (thus allowing it to be bent outwards at the bottom even if somehow the top didn’t want to be pulled out), and predators have no qualms with a bit of digging – the threshold needs to prevent that.
IMO, guillotine style doors are far more effective and reliable. On my coops, I use galvanized steel sheet, riding in a track (a simple groove, not some specialty hardware) mounted on the inside of the coop, the bottom edge of which runs past the bottom edge of the exterior opening, and without any perforations in the panel itself – a predator has nothing to ‘grab’, and it cannot be pushed inwards or pulled outwards. This is lifted and lowered using a small geared DC motor. Also, just as a matter of design preference, the automatic door is a chicken-appropriate opening mounted in the wall of the coop, separate from the full-sized door I use to enter for maintenance.
No need for internet connectivity – it’s driven by a state machine implemented in an ATTiny85, monitoring light levels and going into sleep for 15 minutes between checks (well, many 4s cycles, but it wakes up and goes right back to sleep until the light check interval is up) so it doesn’t consume much power excepting when it opens in the morning and closes in the evening, and those events are pretty short. The entire thing is powered from a solar recharged battery, so the safety of the chickens are not reliant on AC mains either: internet connectivity isn’t the only thing that might go down. I’ve never needed to remotely secure the coop on demand so long as the automatic mechanism functions properly (and if there’s something wrong with that, on demand would surely be hosed). Because it senses ambient light levels and the trend towards lighter or darker, it automatically adjusts to the seasonal change, just like the chickens do.
In this project here, besides a redesign of the door mechanism itself, there’s no reason the RPI couldn’t simply compute sunrise and sunset, negating the need for it to be able to communicate with the outside world. LAN operation/monitoring might hold some interest on the basis of home automation, but it shouldn’t be necessary for the basic function.
I can see this as a learning process for its creator, but this should be viewed as rev 0.1 — not something that anyone should model a reliable automated door on – the survival of your poultry flock is at stake.
Yes, a bit much for a simple job :-) Yes controlling ONE servo should be doable with a GPIO from the Raspi.
Just an ESP could have done the job as well, but hey, there’s no such thing as overengineering ;)
I agree, and the magic smoke from the power led will scares the predators!
Coming from Arduino-world to Pi-world I figured that out way too late! :)
Chickens aren’t legal in our city, but over the river they are. It’s nice to have them on civil time, some are in a tizzy as the time just changed. Now we are on Darklight Spending Time. Poor hens. It could cause an eggsplosion.
Why not just an rtc instead an entire raspi?
RTC doesn’t take in to consideration twilight times throughout the year or daylight savings times. One solution would be to program the times in years in advance, but that is really just a band-aid solution (albeit a large band-aid!)
Sure, but DST is super easy to calculate, especially if your product factory set, not marketed internationally with user interface:
http://stackoverflow.com/questions/5590429/calculating-daylight-saving-time-from-only-date
Thanks for the link. I was toying with the idea of just using an RTC (I actually bought a few just to mess around with it), but ultimately decided on a solution which I know will work and on the mark every time. :)
Another quite simple way would be a light dependent resistor, so it shuts on darkness, and opens on light :-)
I toyed with that idea too, but the coop is under a tree and I didn’t want to rely on something so fickle. Perhaps the RTC *plus* the light resistor would’ve been fine. But where’s the fun in that? ;) in any case, the RasPi grabs the perfect time to open/close right now throughout the entire year. No concerns for false positives.
Daylight Savings Time doesn’t pose a problem. Neither the chickens nor their predators change their schedules just because the silly humans do. Just keep the clock synced to the local Standard Time zone or to UTC and it will always be right. (Unless you have a burning need to use the chicken coop’s RTC to tell time, at which point I’d suggest maybe a nice watch.)
Formulae for predicting twilight have existed since the ancient Greeks; astronomical libraries have been a staple of electronic computer libraries since at least the 1960s. If you don’t feel like writing your own, you can always load up the Astral python module (or the appropriate library for your language.) They will deliver a lot more digits of precision than any chicken coop door actually needs. Then your only problem is knowing *where* your chicken coop is.
Syncing to UTC and using a library is a great way to do that. Thanks!
Could have just used an Ethernet interface on the Arduino. Or an ESP8266.
Great idea! I didn’t consider that. Would’ve saved me from using the RasPi. But the down side is it isn’t as easy for anyone to build it without a server of their own.
Thanks for featuring my project HAD! :)
For that kind of tasks implement your own NTP wireless server that doesn’t need internet connection is an easy and cheap way to get time! http://absolutelyautomation.com/articles/2016/09/15/esp8266-based-wireless-ntp-server-no-internet-connection-needed
Nice! Having had an automated coop door for over 10 years I know first hand it needs to be made fault tolerant. Mine’s a “dumber” door – with a light sensor (The goal is to close it some time after “dark” – why make it more complicated than it needs to be – DST who cares – the chickens don’t). It also has some fault detection and signaling if the door fails to open or close. Chickens are messy slobs and tend to poop on the door sill which sometimes prevents the door from closing. I’d also be interested to see how long that servo holds up to dust (and potential binding due to debris). My motor is a wiper motor/winch style door. Hasn’t killed a chicken yet and has held up to years of abuse in some pretty mixed weather conditions. Status is reported back via an LED. Slow fade – everything is OK. Rapid blink – something is screwed up.
Do we have to call everything connected to the internet IOT now?
Remember, we can’t spell idiotic without ioT!
I built something similar with an arduino, though I didn’t hook it up to the internet. I used a light sensor to trigger opening and closing the door. My coop has a sliding door so I used a piece of threaded rod and a motor to open/close the door, plus a couple of switches to sense the state.
Software part was trivial. The hard part was mounting it so that it was all straight. That and finding a gearbox that could increase the torque of the wimpy little motor.
Nice, but I prefer the Coop Boss: http://forums.parallax.com/discussion/161007/the-mink-is-gone-and-our-new-chicken-coop-door-is-working-like-a-champ