Arduino Chicken Coop: Hardware

This post details the hardware used in the coop for running the door, lights, etc. and how it's wired up.  See previous post about physical structure.

Parts

Controller

 

Having prior experience with Arduino, the ESP-12F in particular, that is the "brains" of the operation.  It has ample IO, built-in LEDs, buttons, and WiFi.  Plus, it's cheap and powered from a simple USB connector.  The cost is always fluctuating, but you can get them shipped in single units for about $3 each from China.  I buy mine directly from China via Aliexpress.  I've had good luck with the "GREAT WALL Electronics Co" seller.  With some other sellers, sometimes nothing arrives at all.  And since it already can take weeks for stuff to arrive, it can take months to resolve if nothing ever comes.

Linear Actuator

A linear actuator is used to physically open and close a door.  If you're familiar with the older car antennas that would go up and down, it does the same thing.  You'll find people claiming you could use a salvaged car antenna driver, however, they aren't very strong and likely wouldn't move a door with any heft to it.

The linear actuator I am using is the Bemonoc.  Linear actuators come in all sorts of types and variations.  Here are the key considerations:

  • Voltage: Knowing I was planning on running everything off a 12V supply, I needed a 12V unit.  I chose 12V because, if needed, it could be run from a battery, but AC/DC convertors are aldo easy to find.
  • Load capacity: How "strong" it is or how much weight it can move.  I chose one with a 300N(66lb) capacity.  Typically, it seems load is inversely proportional to speed (more speed = less load and vice versa).
  • Size: How far it moves between the in and out position.  You want this size to be about the size of your chicken door.  I chose a 12" model.
  • Speed: How fast it moves.  Typically, linear actuators are SLOW.  The model I chose is "high-speed" at 30mm/s (~1.1inches/s).  If you do the math, that means it will take about 12 seconds to open and close.  It's not unusual to see speeds of 0.25 inches/second, so almost a minute to open and close.  I didn't want it to be so slow, the chickens wouldn't notice it moving and get crushed.

One other important thing that most linear actuators have, but is important in our case, is a limit switch.  This means of the actuator is fully extended and you keep trying to extend it, it won't burn out the motor.  Instead, it just stops, and ignores the input until you tell it to go the opposite direction.  This is crucial for us, because we use a simple timer that's lomnger than the actual travel time to open and close the door, we don't have a sensor that tells us when the door is open or closed.

WARNING: Beware that linear actuators cannot be forced open.  This is nice for keeping predators out, but bad if something or someone is stuck in it.  This particular actuator doesn't close with a huge amount of force, but if it were to close on someones neck, it could kill!

Power supply

When I did my initial planning, I wasn't sure if I was going to be able to get power to my coop.  Solar with battery was my fallback option.  So I decided to run everything as 12V.  That means I'd need a AC to DC convertor.  I ordered one that looked nice, but later found it had some serious flaws in terms of line noise.  In the end, I used an old 12V battery maintainer I had sitting around from when I used to ride motorcycles and needed to keep the battery charged over the winter.

Lights

Chickens will lay eggs year round if they get 12-14 hours of light per day.  Unfortunately, during Michigan winters, that just doesn't happen.  So, I wanted some lights that I could control as well.  I wanted 12V, so I could power them from the same supply as the linear actuator.  I ended up going with waterproof LED strip lights.

I haven't done a winter yet, but already I feel like I may have been better off with something else.  The 16ft of lights was somewhat tricky to position in the coop, and I'm somewhat concerned the chickens might peck at them.  Time will tell.

Interior coop lights

Relay Module

Since the ESP is 5V and our linear actuator and lights are 12v, we need a relay module.  I chose the SainSmart 4-channel.  The linear actuator requires two channels, and the lights require one channel.  I probably should have bought a larger one, in case I want to run another linear actuator someday.

WiFi

The ESP-12F devices don't have a realtime clock, so they'll drift minutes in a day if left to their own devices.  They're dependent on NTP to keep reliable time, and NTP requires networking.  Plus, it runs a web interface.  It doesn't have the best WiFi range and the coop was too far from the house to access its WiFi, so I had to have a way to get networking there.

Since I was already running powerline networking around my house, and already had power running to the coop, it was an obvious choice.  I already had a TP-LINK AV500 laying around, but it has known WiFi relability issues.  So when I ran into line noise issues, I went ahead and got the newer AV1200 version.  Though, it didn't isolate and solve my noise issues, it has a nicer UI reliable wireless.

Camera

Having a camera in the coop is handy for many reasons, such as to make sure all the chickens made it in at night and just generally watching them without disturbing them.  I happened to have a Foscam 8918W sitting sround, so that's what I'm using.

Screenshot of the coop.

Wiring

Basically, the left side of the diagram are all the connections from the ESP to the relay:

ESPRELAYCOLORPurpose
VCCVCCRedPower
GNDGNDBlackGround
GPIO14IN4GreenDoor 1/2
GPIO16IN3YellowDoor 2/2
GPIO5IN2BlueLights

The right side of the diagram details the connections to the lights (indicated by red LED), linear actuator (indicated by motor), and the 12V power supply (indicated by the lightning bolt).  The only really tricky part here is that in order to drive the linear actuator, you need to reverse the polarity, hence the use of two relay ports.  Apply voltage in one direction, it extends, reverse the voltage, it contracts.  The synchronization of running those two at the same time is handled in the software.

Checkout the next post about the software necessary to make it work.

This article was updated on November 28, 2018