In response to the request for help automating his hen-house posted by Greger Wikstrand on his blog I came up with the following idea.
In this case there is more than one way to go when selecting components for the automation system. Since there is no requirement that the hen-house should be communicating with the outside world using the Internet in any way, one could assemble a simple system using off the shelf 230V powered components such as those listed below. This would be home automation without IoT, of course one could add some sort of monitoring capabilities using off the shelf building blocks available for building automation today, but that would add substantially to the budget.
Another, and perhaps a bit more challenging, way to automate heating and light in the hen-house would be to pick either a Raspberry Pi or Arduino as the basis for the solution and add some relays and sensors. I've chosen the Arduino track, but basing the solution on a Raspberry Pi would most likely require the same amount of work and about the same amount of spending. This wouldn't either be an IoT solution, but it's a lot easier to add this functionality using either Wi-Fi or Bluetooth connectivity - and voila IoT would open up for a plethora of possible functionality.
First let's revisit the requirements
Light and heat should be automated. Light should be on from 7 in the morning until 8 in the evening, but only if the sun is not up. Hence there is a requirement for some sort of optical light sensor or information on when sunrise and sunset occurs. In addition to this it should be possible to turn on the light manually for a shorter period of time (ten minutes or so) to care for the animals. The heat should turn on when the temperature drops below 5 degrees Celsius inside the hen-house.
The automation system can be powered by 230V since there is light and heat in the hen-house today and hence electricity is available.
Since the hen-house is located outdoors and the environment in the hen-house is more aggressive than a normal home automation environment the encapsulation of the electronics requires some extra attention during the design and build phase. Encapsulating the electrical and/or electronic components in a weather resistant enclosure is highly recommended and a great portion of the total project spend will be on the enclosure for both alternatives.
For this system an IP rating of at least 65 is probably required, however this is not any guarantee that it will withstand any kind of weather. An IP rating of 65 indicates that the equipment should be dust-proof and withstand low pressure jets from all directions. The requirement for a really good enclosure is valid for both design tracks.
The best location for the enclosure is in a dry place, but it still needs to be accessible for servicing and hence placing it on the outside of the hen-house but protected by a roof or in a separate hen free compartment of the hen-house might be wise.
Bill of Materials for 230V Solution
- Thermostat for heater, for example Schneider-Electric CCT15840 with external probe CCT15847 for controlling the heater.
- Astronomical time switch Schneider-Electric IC Astro 1C/CCT15224 for turning on and off the light based on time of day and availability of sunlight. The timer can be bypassed manually, allowing turning on and off the light if needed.
- In addition to above an enclosure is needed that can withstand the weather properly, some cabling and a DIN rail for mounting the control equipment.
The 230V system is built around the two control units CCT15840 and CCT15224. The CCT15840 controls the heater based on a required temperature and a range. Astronomical time switch, CCT15224, is programmed using a computer and can by itself calculate the times for sunrise and sunset based on geographical location and time of year. The CCT15224 can also be programmed with an additional 84 on/off switch points and can hence be used for turning on the light if it's dark after 7 in the morning and turn off the light at sunrise, and at sunset if sunset occurs before 8 in the evening the light comes on.
Bill of Materials for Arduino Based Solution
- Arduino Uno board
- Temperature sensor, water proof
- Relay module for Arduino
- Real time clock to keep time accurately
- Push button to turn on the light for 10 minutes
- A reliable power supply to power the Arduino is required
- In addition to above an enclosure is needed that can withstand the weather properly and some wiring.
The Arduino solution has to be programmed to calculate sunrise/sunset, or an additional light sensor is needed. Adding a light sensor to the Arduino solution will save some time for a rather low increase on project cost.
Last, but not least, let's add a WiFi module to the Arduino setup to add features like remote monitoring of the hen-house. A small web page needs to be built to view the current status of the hen-house, i.e. read current temperature, status for heater and lightning. The web page could also allow for interacting with the hen-house to turn the light on and off. For backend a quick and easy way to get started is ThingSpeak with it's Open API..
The cost for both solutions are probably comparable and somewhere around 3-4000 SEK for the components; however for the Arduino solution to work there will be some serious programming to be made. On the other hand, assembling the 230V system requires an authorized electrician, which might be wise to use at least on a consulting basis when wiring the relay module for the Arduino as well unless one wants to risk having fried hens.