Automated Chicken Door

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.

Controllers

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

Actuator

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

Powering

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.

Photo-resistor

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.

Comparator

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

Limit switches

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.

H-bridge

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.

Energy used by the motor

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

Energy used by the electronics

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.

Energy available per day

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

Conclusion

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.

Components

The design consists of the following components:

  • 1x Arduino Nano
  • 1x Photoresistor
  • 1x 15K Ohm resistor
  • 2x Hartmann MBB1 micro switches
  • 1x TI L293D (for driving the DC motor)
  • 1x 12V DC motor with gearbox for torque

Design

A sketch of the design can be found below:

Code

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.

  • research/automated_chicken_door.txt
  • Last modified: 2018/04/05 18:06
  • by martinp