Automating the opening and closing of the chickens door reduces the mental payload and gives more freedom. It also makes the chickens more safe as humans might forget to close the door in the evening.
This is the very definition of progress: making life easier.
Solution | Price | Plus | Minus |
---|---|---|---|
12V timer | ~10€ | Easy to set up, reliable | Setup has to be changed over the year ; 12V powering needed ; Power consumption ? |
Arduino mini + electronics | ~8€ | If battery/solar powered, the board has to be modified to reduce the power consumption ; Electronic circuit has to be built and programmed | |
Analog electronics | ~5€ | Low power | Electronic circuit has to be built |
Solution | Price | Plus | Minus |
---|---|---|---|
Electric car antenna | ~20€ | Easy to integrate | |
Winch actuating a sash | ~10€ | Can be built with broken electronics | Has to be built |
Servo-actuated self-locking door | ~10€ | Complex to build |
Solution | Price | Plus | Minus |
---|---|---|---|
Solar panels | ~5€ | Energy self-sufficient ; Coop easy to displace | Requires low power electronics |
Power adapter | ~5€ | Stability | Requires a power line |
Rechargeable Battery | ~15€ | Coop easy to displace | Inconvenient ; Requires low power electronics |
As we try to reuse the tings we have and to buy as less as possible, the solution depends a lot on the material already available.
Function | Selected solution | Why |
---|---|---|
Controller | Analog electronics | low power, low cost |
Actuator | Winch actuating a sash | no cost because reused materials |
Power | Solar panels | we can reuse solar lightings for garden, can be moved, energy self-sufficient |
The total cost will only be around 5€ for the electronics. The drawback to this is the time demanding construction work.
The photo-resistor is a component which resistance depends on the quantity of light illuminating its sensitive area. During the day, its resistance drop to below 100ohms, while during the night, it is higher than 100Kohms.
The photo-resistor is placed in series with a fix-value resistor. The tension between both components (V1 on the schema) is higher during the day, and lower during the night.
The tension V1 is compared to two fix tensions V2 and V3. If V1 > V2, we consider the state to be “day”. If V1 < V3, the state is “night”. This is done by two comparators. Below is the output of both comparators depending on the voltages.
V2 < V1 | V3 < V1 < V2 | V1 < V3 | |
day | undefined | night | |
V4 | 6V | 0V | 0V |
V5 | 0V | 0V | 6V |
When the state becomes “day”, we want the door to open. This means, that the motor turns in one direction, but only until the door is open. This is why the limit switch S1 opens the circuit and stops the motor when it detects that the door is open. Similarly, the limit switch S2 stops the motor when the door is closed.
The H-bridge is composed of 4 BC547 transistors. It allows the rotations of the motor in both directions. When V4 = 6V, and S1 = closed, the upper left and the lower right transistors are activated, a current is flowing through the motor from the left to the right, thus making the motor turning in one direction. The two other transistors activate the other direction.
If the system is powered by a battery or a solar panel, an energy analysis can be done to be sure of the feasibility, or to be able to improve the design.
Parameters we need to know:
Current measured through motor while door is lifted | I_motor = 100mA |
Voltage powering the motor | V_motor = 6V |
Time measured to open | T_open_door = 10s |
First we calculate the power drawn from the motor:
P_motor = V_motor * I_motor = 6V * 100mA = 600mW = 0.6W |
Then we can calculate the energy used by the motor to open the door:
E_open_door = P_motor * T_open_door = 0.6W * 10s = 6W.s |
This energy can be converted in W.h:
E_open_door = 6W.s = 6/3600 W.h = 1.6mW.h |
As the door needs to be closed as well, we just double this value to get an approximation of the total energy used by the motor per day.
E_motor_per_day = 2 * E_open_door = 3.2mW.h |
We try to use resistors having high values to reduce the power they use (0.07mW in total). As a result, the component consuming most of the energy is the comparator. This is why we use the an ultra low power comparator draining as little as 0.05mA. More information can be found in the datasheet.
P_comparator = U_comparator * I_comparator = 6V * 0.05mA = 0.3mW |
P_electronics = P_comparator + P_resistors = 0.3mW + 0.07mW = 0.37mW |
Energy used by the electronics per day:
E_electronics = P_electronics * 24h = 0.37mW * 24h = 8.9mW.h |
We can see that it is the same order than the energy used by the motor. While the motor consumes 2000 times more power than the comparator, it is used only 20s a day, while the comparator is always on.
The solar garden lighting give approximately 4h of light every night. From this information, we can estimate the energy available per day.
The LED is powered with 1.2V and consumes 30mA. We can measure this with a multimeter.
P_led = V_led * I_led = 1.2V * 30mA = 36mW |
E_led_per_day = P_led * 4h = 36mW. 4h = 144mW.h |
The batteries of the garden lighting have a voltage of 1.2V (can be read on the package). As we want to power our system with about 6V, we have to use 5 garden lightings, and to connect their batteries in series.
E_available_per_day = 5 * E_led_per_day = 144mW.h * 5 = 720mW.h |
Summary:
E_motor_per_day | 3.2mW.h |
E_electronics_per_day | 8.9mW.h |
E_used_per_day | 12.1mW.h |
E_available_per_day | 720mW.h |
We are happy to see that more energy is available than used. The security margin tells us that after one normal sunny day, the system can work without additional energy for 59 more days, which is very good.
Security_margin = E_available_per_day / E_used_per_day = 720mW.h / 12.1mW.h = 60 |
Due to difficulties in debugging and maintaining the old chicken door, a new version has been built utilising an Arduino Nano. The operation of the system is much the same - The door is actuated by a 12V DC motor when the voltage of a photoresister hits a specific value, and the turning of the motor (thus the opening/closing of the door) is stopped with a limit switch.
The design consists of the following components:
The Arduino code can be found here. It is relatively well-commented and fairly straightforward in its operation. It is contained as a PlatformIO project, which provides a collection of useful commandline-based tools for working on Arduino projects. In order to build and run the code, it is necessary to download and install PlatformIO.
Once PlatformIO is installed, clone the repository.
$ git clone https://github.com/s3krit/chicken_coop
To build the code without uploading it to the Arduino (which is useful for testing the correctness of your code), use the following command
$ pio run
If this runs without any errors, it can be uploaded to the device in the following way: $ pio run –target upload –environment nano
. In addition to this, one can monitor the serial output of the Arduino device with pio monitor
.
The DC motor is powered by a 12v power adapter, and the Arduino by a USB cable plugged in to a mains adapter. The entire ensemble sits inside the chicken coop to protect it from the rain. In theory, the powering of the entire thing could be switched to a solar solution - We are in possession of a solar charger/battery in the form of a phone powerbank. It is capable of outputting up to 9v. Without the circuitry to 1) break out from the USB output provided by the powerbank and 2) Step up the voltage to 12v in order to power the motor, it is not currently a viable solution. This is worth investigating in the future, since the current chicken coop is mobile and it would be advantageous to not have it being tethered to the barn.
Generally, the construction is simple - The DC motor is part of a gearbox assembly that is connected to a winch. The winch is connected to the door via some fishing line/monofilament. The photoresistor is fixed in place somewhere useful (Ideally inside but pointing outside). The limit switches are placed in positions where the door will hit them on completely opening and completely closing.
There are two important aspects of constructing and installing the chicken door. Firstly, the position of the motor must be such that there is as little friction when raising the door as possible - failure to do so could end up with the door beingjammed and potentially burning out the motor. Secondarily, the limit switches must be placed fairly carefully such that they are hit by the door when it raised and closed.
Other than that, the construction is fairly simple - make sure to guide cables away from the floor as much as possible - chickens and ducks are curious and like to chew on/piss on/mess with your hard work.
While the chicken door offers basic functionality, it could be iterated on and improved in a couple of ways.
Join our #ecohackerfarm iRC channel on freenode or send us an email on life@ecohackerfarm.org