Melbourne, Australia is, apparently the fox capital of the world. So round here chooks have to be locked up at night in a secure coop. And sadly, we’ve lost a couple of our hard working girls when I forgot to lock the door at night.
Since machines never make mistakes I’ve built an automatic door system. What’s more, I’ve put the code and schematics on github because now I know how to git.
It’s all run by an Arduino, with a light sensor to detect when it’s time to open or close the door. There’s no power in the chook yard, so it is powered by batteries which are charged by a couple of small solar panels.
Here’s the circuit schematic, click to view full size. A pdf is available here.
The motor is an old 12v cordless drill motor, and you’ll see that it has its own battery. This is because I found that it was pulling too much current when it came on, causing the voltage to drop and the arduino to reset.
The batteries are NiCads, because I’m afraid of lithium ion batteries. They are charged up by small solar panels, but apart from the diode there is no charging circuitry. This is because I measured the current in full sun and found that it was only 50mA, so the internal resistance of the solar panels is limiting the charging current to an acceptable level. You could use a constant current circuit here if your panels were bigger.
The motor relay is a 5v dual relay module I got off ebay, should cost you less than $5.
Ditto for the light sensor module. it has a digital and analogue output. I toyed with the analogue one, and jumped through lots of hoops to get it to work, but it turns out the digital output is way more reliable, especially when you take a number of readings. The trim-pot on the board sets the sensitivity, you may need to adjust it.
Here’s a diagram of how it’s made. PDF here
The drill drives a lead screw, which slides the door up and down on a pair of drawer slides. The advantage of using a leadscrew is that it effectively locks itself so when it’s closed you can’t prise it open.
The drill motor had its gearbox and chuck still attached (I couldn’t get it off), but it turned out to be a good way of connecting the lead screw. And the gear box has a clutch, so it won’t tear itself apart if it gets jammed. The drill motor is housed in a piece of 45mm PVC pipe, so it’s all water tight.
To sense when the door is fully opened or closed there are a couple of switches, and there are a couple of screws in the door which trigger them.
All of the control circuitry is inside a plastic lunchbox inside the chook house, to keep it out of the weather. I run leads from the motor, switches, light sensor and solar panel to plugs on the lid of the lunch box so that I can work on it without having to sit in the chook yard.