Gatsby Logo

Coop Controller: A Sonoff and a Linear Actuator

2020-10-20

Solar Powered Chicken Coop Controller

I often find myself saying, "Sweet, another thing to automate." My wifes chicken coop was one of those things.

This spring my wife came to me with another COVID project; Chicken Coop part duex.

A little back story. While we were living in Salt Lake my wife and father in law built a Chicken Mansion. In fact, to this day, it is still standing in the back yard of our old house in Canyon Rim. Promises were made that this was not going to be a bad sequal...

Fast forward and we are staring down a quiver of chickens and a bunker of a coop. Time to get my automation on.

Challenges

There were a couple challenges that we had to face.

  1. Reliability - As this was going to be protecting actual lives, it needed to be ACTUALLY reliable.
  2. Power - Given the coop sits approx 70 feet from the nearest power source, it had to be independently powered.
  3. Connectivity - The house has wifi so a solution that could use wifi without any additional hardware was ideal.

Power

Solar power solutions these days are easier and easier to come by. I am not an Electrical Engineer. My understanding of electricity is limited and I try to protect myself against stupidity by fusing everything and using quality wires/components. If someone sees something glaring, PLEASE LET ME KNOW!!! Thanks.

Okay, so with solar you basically have a panel, a charge controller and a storage device.

For the solar panel I chose a random 20-50 watt unit from Amazon. *The size of the panel depends on how quickly you want to recharge your storgage source as this will be the limiting factor of your system.

It is also probably a good time to talk really quick about my overall approach. Instead of moving my panel to match the sun angle during the year; I set it up to gain maximum power during the least producing months (Nov-Feb). I use this overall thought process throughout the build; keeping in mind my most power hungry time periods during the least power producing time periods.

With panel in cart, next up is charge controller. I received a recommendation from another project by SOURCE to use a Renology control due to its serial/bt capabilities down the line... i.e. another project potential. I ended up grabbing one of these

Panel and controller procured, now for battery source. I had a spare battery from an old project already housed in a pelican case so I just connected everything up with a handful of these amphenol plugs. Mounted the controller and accessories in a NEMA enclosure and mounted everything to the coop.

Panel is producing power and charging the battery, now on the the power drawing devices!

Controlling the Coop Doors

I guess this is a three part process; the controller, the actuators and the door itself.

Controller

I had originally started off working on this project using an AtomicPi and writting my own python scripts to control the GPIO pins. However, I was running into issues with voltage float across the pins leading to unreliability on the test bench. NOT a good sign. With a bit more research I settled on a SONOFF 4. I figured this would give me the ability to control two doors as each door needs two channels per doors (1 channel for UP and 1 channel for DOWN).

Additionally, the SONOFF has built in wifi and, AND the best part; an active and totally rad Home Assistant integration by AlexxIT. It was this integration that actually sold me in a sonoff. This would help with integration and keeping with my local control, single pane of glass approach to HA.

Linear Actuators

I had entirely too much fun playing with these. Purchased them from a vendor here in the US called Windy Nation. I would suggest checking these guys out for all your power needs. They contacted me quickly when the thought something was funky with my address; after hours on the eve of a Holiday just to make sure they could get a $45 dollar actuator in the mail before the long weekend. Also, I am very impressed with the quality of the products received from them. Will purchase from again.

For my needs, I needed to lift a door about 12 inches so I purchased one of these. I ended up purchasing another one for the other door after this one worked so well. Thank you again Windy Nation!

For those not familiar with actuators, you apply a 12v power source and the actuators extends and then an internal switch cuts the load until the load polarity is reversed (This is actually what the SONOFF is doing via some fancy wiring) at which point the actuator retracts.

Door

We wanted the external door to have some added security from external wild animals. We live on the edge of public land and often have vistors from the neighboring foothills. It was becuase of this that we spent a long time contemplating solutions until we came across this product. Slightly expensive for what it is but it a very novel concept with the locking mechanism and it ends up working pretty well.

We connected ours via a wire cable verus direct attach to the actuator. This was because I was worried about the door crushing a chicking that might be in the way during closing. With the door being attached via cable, the max pressure exurted during closing will be the weight of the door until the obsitcle is removed and then the door should close as expected.

Putting it all together

I had a real struggle getting the wiring correct on the sonoff in order to open and close the door as I wanted. In the end, I was able to gather the concept and determined the proper order.

Once the wiring was correct, and I could control the door locally via the buttons on the sonoff, it was time to download the 'ewelink' app and connect the sonoff to the interwebs.

After that, I installed the AlexxIT integration, added an glance card onto lovelace and added two automations for sunrise and sunset in order to open and close the doors.

Home Assistant

To install the integration

Once the integration is installed, your sonoff will show up as a...

Once you have identified the device and or entity name it is time for the automation.

This time around, I decided to try the new built in automation editor; and I was pleasantly suprised.

Built using Gatsby - Paz