Owning chickens is a great experience, but getting up at sunrise to let them out of their coop can be a chore. Closing the door at night isn’t usually such a problem, but it can be inconvenient if your evening plans have to include the ceremonial traipse of the chicken gatekeeper.
I built the first automatic door opener a few weeks after we got our first chickens. I know it’s possible to buy ready made units that do the job, but our chicken coop is quite low, so there isn’t enough room for the normal vertical sliding door, and the existing horizontal sliding door was often jammed by pieces of bedding material or dirt. An off the shelf solution was unlikely to work in this situation.
I briefly toyed with the idea of making an internet connected chicken door, but the power requirements would have been excessive. I wanted the door opener to run from batteries – or possibly from a solar panel. An internet enabled door would be nice, but even a low powered version would see the whole roof of the coop covered in solar panels. To run from battery, I needed to keep things simple.
I decided to use an Arduino Pro Mini with a light sensor to control a servo connected to the door. I made the door open to the side on hinges, and rigged the servo so that it would only power when it was moving.
The inside of the door opener was a mess of wires and hot glue splodges, but it worked well. The servo and arduino had separate battery packs, and the light level that the door triggered on could be set using a potentiometer. A red button on the side of the box could open or close the door for those times when we were clean the coop or isolate the chickens for some reason. The arduino was running in a low power mode, sleeping for 2 seconds at a time. The whole mess of cable spaghetti was closed away in a waterproof box.
Fast forwarding to the start of November, the door stopped working. I thought at first the batteries had failed, so I replaced them and tested the door. The following morning, I had to open the door manually again, letting three very cross chickens out an hour later than they expected. The mess of wires and splodges of glue were going to be a nightmare to fix, so the time had come for Chicken Door Mk2. It was a good opportunity to redesign the door and iron out some of the bugs that I’d found after using the door for a while. I wanted to make the unit smaller, use rechargeable batteries, and get rid of the fiddly potentiometer that set the open/close light threshold, and get rid of the mechanical relay that powered the servo.
I wanted to get the door fixed as soon as possible, so I used things that I already had to hand. I started with the battery holders. I chose to use 2x 18650 batteries, which connected in series would give 7.2 volts, the maximum voltage for the servo that I was using. I chose to bypass the Arduino’s built in power regulator in favour of a more efficient board.
I added a second button to the design. One button opened the door, the other closed it. Pushing both buttons together for 3 seconds set the current light value as the trigger value for the door’s automatic setting. I replaced the relay with a TIP120 transistor, which was overkill for the application, but it’s what I had handy.
So far, I had held everything together with double sided foam tape and shrink wrap cable. Rather than mess around with another project box, I designed a 3 part case and a long servo arm using a CAD package and pressed my 3D printer into action.
With the case printed, I wrote the code to control everything, and tested it out on the workbench. Everything worked perfectly, so I fitted it to the chicken coop and set the trigger level. The following morning, I went out early in the morning, and had to let the chickens of manually because the door hadn’t worked. In fact, the door opened and closed unpredictably when I tried to open it close it using the buttons. I realised later that I forgot to fit a diode across the servo, and reasoned that the backwash from the motor was causing the power to spike. I fixed the problem and tried it again – it worked flawlessly. I reattached it to the coop, reset the trigger level, and went to bed.
The following morning, I was confronted by a mob of very cross chickens. The door hadn’t opened. Again. After charging the batteries, trying everything again and still failing to automatically release chickens – I realised the cause of the problem. It was freezing cold outside, and I’d used 18650 batteries. 18650 batteries do not like the cold weather, and they show this by radically reducing the amount of power that they can output for the first few seconds of use. After that first few seconds, the cell chemistry catches up, and the batteries operate normally (but with a reduced capacity). When the batteries got cold at night, the servo drew too much power which caused the door to reset itself, and reset the threshold for opening to its default value.
It took me a while to figure out a decent solution. I used a 5v ultracapacitor to bolster the batteries. Capacitors work well in cold weather, and can dump a massive amount of power all at once. They have the added advantage that when the batteries are changed in the door opener, they can power the unit so that it keeps the value for the threshold until the new batteries are replaced. In fact, the capacitor can power the unit for well over an hour if necessary, including servo use. Two weeks after applying the capacitor to the new chicken door opener, there have been no more problems, the chickens are less cross, and I have an extra hour of sleep in the morning.