You are on page 1of 40

UNIVERSITY OF DAR ES SALAAM

COLLEGE OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF ELECTRICAL ENGINEERING

EE 498: FINAL YEAR PROJECT I (FINAL REPORT)

TITLE: DESIGN AND IMPLEMENTATION OF AN AUTOMATIC


CHICKEN COOP DOOR WITH SECURITY SYSTEM AGAINST
PREDATORS.

A Project Report in Partial Fulfilment for the Award of Bachelor of Science in


Electrical Engineering

Name of Candidate : MWILAWI, WILLIAM MIKA

Registration Number : 2018-04-01746

Supervisor : Dr. FRANCIS MWASILU

Supervisor’s signature : ………………………….

Submission date : 17th February 2022


DECLARATION.
I Mwilawi, William M a student of Bachelor of Science in electrical engineering, declares that this
project report “Design And Implementation Of An Automatic Chicken Coop Door With Security
System Against Predators”. Submitted to the University of Dar es salaam in Partial Fulfilment for
the Award of Bachelor of science in Electrical Engineering is based on my own work under the
guidance of Dr. Francis Mwasilu. I further declare that, information from other sources like books,
articles and journals included in this report I credited them and given their details in the references.

Student name: Mwilawi, William M

Signature: …………….

Date 17/02/2022

This report may proceed for submission for assessment for the Award of Bachelor of science in
Electrical Engineering at the University of Dar es salaam.

Supervisor Signature: ………………………

Date: ……………………….

i
ABSTRACT.
This project analyses about the design and implementation of an automatic chicken coop door
which will open for allowing chickens to get in and out the coop as well as closing the door without
the use of human force. Also, the system will be added an automatic system which will select only
chickens to enter the coop while other animals will be prevented to get in.
This work aims to simplify the time table of a chicken keeper as it will not be interfered with
chicken schedule. Hence, chicken breeders will be able to conduct other economic activities with
no disturbance from the chicken schedule. On top of that, the design will protect the chickens and
their eggs inside the coop from being attacked by predators since the system will prevent predators
to enter the coop. Therefore, the system ensures safety of chickens inside their coop, even the
breeder will be in peace condition about the safety of his or her chickens.
The report involves analysis of different methods step by step which were used to design the
system up to the point of its completion hence this will help to understand the design in details.

ii
ACKNOWLEDGEMENTS.
I would like to appreciate the department of Electrical Engineering of university of Dar es salaam
for providing me with the chance of conducting the project and superb instructors who helped me
with my project.
I am grateful to my respected lecturer and supervisor Dr. Francis Mwasilu for his cooperation and
guidance throughout the project as a project supervisor. I appreciate him for helping me with my
project by sharing his suggestions, instructions and experiences.
I am also heartily thankful to our lecturers of department of EE for their worthy suggestions and
valued instructions during mid-oral presentations held at the university.
Last but not least I would like to express my sincere gratitude to my project coordinator Mr. Shaban
O. Kasinge for his updates and guidance about preparation of this report and all others who have
directly or indirectly contributed for bringing this project to this stage.

iii
TABLE OF CONTENTS.
DECLARATION. ............................................................................................................................ i

ABSTRACT. ................................................................................................................................... ii

ACKNOWLEDGEMENTS. .......................................................................................................... iii

TABLE OF CONTENTS. .............................................................................................................. iv

LIST OF FIGURES. ...................................................................................................................... vi

LIST OF TABLES. ....................................................................................................................... vii

LIST OF ABBREVIATIONS. ..................................................................................................... viii

CHAPTER ONE. ............................................................................................................................ 1

GENERAL INTRODUCTION. ...................................................................................................... 1

1.1. Background. ......................................................................................................................... 1

1.2. Introduction. ......................................................................................................................... 1

1.3. Problem statement. ............................................................................................................... 2

1.4. Proposed solution. ................................................................................................................ 2

1.5. Objectives. ............................................................................................................................ 2

1.5.1. Main objective. .............................................................................................................. 2

1.5.2. Specific objectives. ........................................................................................................ 3

1.6. Significance of the project.................................................................................................... 3

1.7. Methodology. ....................................................................................................................... 3

CHAPTER TWO. ........................................................................................................................... 5

LITERATURE REVIEW. .............................................................................................................. 5

2.1. Introduction. ......................................................................................................................... 5

2.2. Existing system. ................................................................................................................... 5

2.2.1. Manual chicken coop door. ........................................................................................... 5

2.2.2. Automatic chicken coop door. ....................................................................................... 7

iv
2.3. Proposed system. .................................................................................................................. 8

2.3.1. Automatic chicken coop door with security system by using infrared sensors. ............ 9

2.3.2. Automatic chicken coop door with security system by using RFID tags. ................... 10

2.3.3. Automatic chicken coop door with security system by using camera with machine
learning. ................................................................................................................................. 10

2.4. Requirements gathering for proposed system. ................................................................... 12

2.4.1. Camera module. ........................................................................................................... 12

2.4.2. DC motors.................................................................................................................... 15

2.4.3. Microcontroller. ........................................................................................................... 18

2.4.4. Sensor. ......................................................................................................................... 21

CHAPTER THREE. ..................................................................................................................... 24

PRELIMINARY DESIGN AND ANALYSIS. ............................................................................ 24

3.1. Introduction. ....................................................................................................................... 24

3.2. Design Hardware (System Modules Set Up and Configuration). ...................................... 24

3.3. Working of system. ............................................................................................................ 25

3.4. Flow chart of the system. ................................................................................................... 26

CONCLUSION. ............................................................................................................................ 28

REFERENCES. ............................................................................................................................ 29

APPENDICES. ............................................................................................................................. 30

Appendix A: Time schedule. ..................................................................................................... 30

Appendix B: Cost estimation. ................................................................................................... 31

v
LIST OF FIGURES.
Figure 1: Block diagram of proposed system by using camera. .................................................. 11
Figure 2: Camera module (a) An ESP32-CAM (b) An OV2640 (c) An OV7670. ...................... 14
Figure 3: Brushless DC motors (a) NEMA 17 stepper motor (b) Servo motor. ........................... 16
Figure 4: Raspberry Pi 3 ............................................................................................................... 18
Figure 5: ATmega328P Arduino boards (a) Arduino Uno (b) Arduino Nano. ............................ 20
Figure 6: Sensors (a) Ultrasonic sensor (b) IR sensor. ................................................................. 22
Figure 7: Components diagram for proposed system. .................................................................. 26
Figure 8: Flow chart of proposed system. ..................................................................................... 27

vi
LIST OF TABLES.
Table 1: Specifications of OV2640 vs OV7670. (Tessie, 2021) .................................................. 14
Table 2: Characteristics of brushed DC and brushless DC motors. (Millett) ............................... 15
Table 3: Specifications of servo and stepper motor. ..................................................................... 17
Table 4: Specifications for Arduino Uno and Arduino Nano. ...................................................... 20
Table 5: A comparison between Raspberry Pi and Arduino board. (Ibro, Wong, & Zyla, 2019) 21
Table 6: A comparison between an ultrasonic and a PIR sensor. ................................................. 23
Table 7: Time schedule for the project for semester I. ................................................................. 30
Table 8: Cost estimation. .............................................................................................................. 31

vii
LIST OF ABBREVIATIONS.
BLDC Brushless DC
BLE Bluetooth Low Energy
CMOS Complementary Metal-Oxide Semiconductor
CPU Computer Processing Unit
DC Direct Current
EEPROM Electrically Erasable Programmable Read-Only Memory
ESP Electric Selective Pattern
GPIO General Purpose Input Output
HDMI High-Definition Multimedia Interface
I/O Input Output
IR Active Infrared
LCD Liquid Crystal Display
LED Light Emitting Diode
MCU Microcontroller Unit
ML Machine Learning
RFID Radio-Frequency Identification
PCB Printed Circuit Board
PIR Passive Infrared
SRAM Static Random-Access Memory
USB Universal Serial Bus
UXGA Ultra-Extended Graphics Array
VGA Video Graphics Array

viii
CHAPTER ONE.

GENERAL INTRODUCTION.
1.1. Background.

Chicken breeding or keeping involves raising of domesticated birds especially chickens to produce
meat or eggs for food. Chickens raised for eggs are known as layers, while chickens raised for
meat are called broilers. It has originated from the agricultural era. It has been a feature of human
society for thousands of years. To ensure that it continues to make positive and sustainable
contributions to stable human society, it is essential that production and marketing are tailored to
local conditions and associated value chains, maximize nutrient cycling and efficient utilization of
all products and maintain genetic diversity.

Smallholder chicken keeping has an important role to play in feeding the world and to maximize
the benefits, it should be accompanied by improvements to local health services and holistic
programs that highlight the links between chicken keeping, human health and nutrition and
sustainable ecosystem services.

1.2. Introduction.
Chickens are prone to being attacked by many predators. In order to keep chickens safe and alive,
a good solution is to have an enclosed structure for the chickens to go in during the day and night,
hence, chicken coop is needed. Chicken coop is a structure where chickens are kept safe and
secure. Rather than having to go out every night to lock them up in this structure, or early in the
morning to let them roam the pasture. A good solution would be an automatic door installed on
the chicken coop. The door can be designed to include many different functions. These functions
will be involved in how it opens and closes, how it is set to open or close and how it prevents
predators to enter the coop.

In having a fail proof door, it will automatically open and close to allow the chickens to roam
pasture during the day and be safe from predators when they are in the coop during the day and
night. This door will avoid substantial risks of predators roaming the pasture all the time. The door
will increase productivity of the hens to lay eggs, and decrease the “costs” that are incurred if
chickens were loss to predators. (Inks, 2012)

1
1.3. Problem statement.

Existing chicken coop doors causes different problems to chicken breeders and chickens
themselves as follows;

➢ Chicken breeders encounters the situation of delaying to arrive and starts other economic
activities like cultivation due the tendency of waiting the time to open for chickens. Again,
they need to open the door in the morning even if they are lying cozy in bed, wrapped in
warm sheets (for resting days).
➢ Also, they need to close the door at every sundown, so if they happen to be detained
somewhere else or need to leave for an emergence and can’t return on time, their chickens
may be left vulnerable to predators.

1.4. Proposed solution.

Due to the problems associated with the existing chicken coop doors, technical solution to these
problems were proposed to solve the problems. Proposed solutions are as follows;

➢ Design of an automatic door will solve that scheduling issue. This electronic door will open
when chicken approaches near the door and close when chicken go away from the door.
Opening and closing of the door will be activated in between sunrise and sunset, at night
the door will be off closed for the secure of the chicken.
➢ Also, during the time of activation, the door will operate to allow only chickens to enter
and leave the coop, hence other predators cannot enter the coop through the door.

1.5. Objectives.

Purpose of conducting this project is to fulfil the objectives which are divided into two parts,
namely; main objective and specific objectives.

1.5.1. Main objective.

The main objective of this project is to design an automatic chicken coop door with security system
against predators that will be open and close automatic without human force and ensure the safety
of chickens while they are in the coop.

2
1.5.2. Specific objectives.

In order for the main objective to be archived, other preliminary objectives should be adhered first
so as to help in archiving the main objective. The following specific objectives will lead to the
achievement of the main objective.

i. To design control circuit for opening and closing the coop door.

ii. To select component of proposed system.

iii. To build prototype of proposed system.

iv. Test the prototype of the designed system.

1.6. Significance of the project.

On completion and successful installation of this project, it will offer the following significances.

i. It will help to reduce the disturbance of timetable of the chicken keeper from being
disturbed by chicken schedule.

ii. Facilitating the opening and closing of the coop door without human force.

iii. Providing security of the chickens in the coop from being attacked by predators.

1.7. Methodology.

In order to accomplish this project different methods and techniques will be employed, under time
consideration. Below is the list of methods that will be followed during this project.

i. Literature review
ii. Preliminary design and analysis
iii. Designing of the circuit
iv. Building a prototype
v. Testing a prototype
vi. Report writing

3
➢ Literature review.

This part involves searching for knowledge from different types of work have been done so far
about automation of doors and useful information from various books, international journals,
World Wide Web as well as consultation to supervisor.

➢ Preliminary design and analysis.

In this section, initial design of the project will be analyzed. The analysis will involve listing of
devices that will be used in this project and the flow chart of the system (working flow).

➢ Designing of the circuit.

Knowledge from preliminary design will be used to design the circuit of the proposed system.

➢ Building a prototype.

After designing of the circuit, the designed circuit will be installed by using hardware materials
and assembled together for testing and assessment.

➢ Testing a prototype

The prototype of the proposed system will be tested so as to see if the desired outputs are produced
as required. This method will be used to verify the proposed system if it works as it supposed.

➢ Report writing

At each step of conducting this project, information and data collected will be recorded which will
help in the writing of the report of this project.

4
CHAPTER TWO.

LITERATURE REVIEW.
2.1. Introduction.

This has been done by studying the various existing systems, their advantages and disadvantages
together with the different proposed systems and its advantages compared to the existing systems.
Proposed systems are discussed one by one, comparison between the proposed systems and
selection of the best one. Also, literature review through consultation to supervisor and internet
browsing.

2.2. Existing system.

Existing systems are of different design, but they have more challenges than the proposed system.
Existing systems seems to have less protection to the chickens while are in the coop. From the
field of study, the present systems that have been implemented are namely as follows;

➢ Manual chicken coop door.


➢ Automatic chicken coop door.

2.2.1. Manual chicken coop door.

Manual chicken coop doors are exactly what their name states; a door is manually open and close
every day and night respectively to keep chickens safe. The system involves of man power to
provide mechanical power to move the coop door from its initial state of being close or open. A
man supposed to be at home to open the coop manually and wait for the chickens to return and
then close the coop.

5
➢ Operation of manual chicken coop door.

The system involves the working flow as described below;

Human force; here is a person who use his arm to open/close the coop door manual.

Chicken coop door; a chicken coop is small house where chickens are kept, a coop door is the
means of keep those chickens inside their house and secure those chickens.

Door output; the output of door is a tendency of the door to be opened or closed after the human
force being applied to the door.

➢ Advantages of the system.

There are certain advantages of having a manual door for the chicken coop as follows;

i. Having absolute control of the door. A chicken keeper decides what time the door opens
and closes and personally make sure that none of his or her chickens are stuck outside
before the door closes.
ii. The system is less expensive in terms of its installation as it does not need more money for
buying electronic devices compared to the automated one.

➢ Disadvantages of the system.

Using manual door have some downsides to the chicken keeper and chickens themselves as
follows;

i. Compliment of timetable; a chicken keeper supposed to compile his timetable so as to copy


with the chicken schedule. Since he supposed to be around home during the time of opening
and closing the coop door.
ii. It is outdated; the system consumes the human force despite of being the alternative of
replacing the human force and time.
iii. Time consuming; chicken keepers are supposed to wait until sunrise or 7’oclock in order
to open the chicken coop door and then go to other activities in late hours.

6
iv. Manual doors can be slammed shut by a gust of wind, so if one of the chickens is entering
or leaving the coop when this happens, it will trap or most probably kill the chicken
outright.

2.2.2. Automatic chicken coop door.

As its name suggests, an automatic chicken coop door is a chicken-sized door that is controlled
and programmed. It opens and closes on its own on the schedule that sets it to and lets the chickens
in and out of the coop without having manually open the door. If chicken keeper’s schedule is less
flexible or if he or she is extremely busy, an automatic door can be a great help to him/her.

➢ Operation of automatic chicken coop door.

The existing automatic chicken coop doors most of them uses timer and light sensors to control
the opening and closing of the door. The design of the door is able to automatically open at a set
time in the morning and automatically close at a set time in the evening. Also, photo sensors are
used to support the design of the system, as they open the door at sunrise and close the door at
sunset by sensing the intensity of the sunlight. Hence, in between sunrise and sunset the door
remains open all hours until the time of close.

➢ Advantages of the system.

Such kind of automated coop door, has advantages to the chicken keeper as follows;

i. No need to get up early to let the chickens out or waiting until the time for opening the
coop door, the door does itself for chicken keeper.
ii. A chicken keeper won’t forget to close the coop door at night, the door will close itself.
iii. If it happens to have a night out or take a short vacation, it’s easier to leave the chickens
because they can leave and enter the coop as door operates.
iv. It’s self-timed, so the chicken keeper can control what time the door will open and close
every day.

7
➢ Disadvantages of the system.

Although an automatic system has a lot of advantages to a chicken keeper, but it does not have
much advantages to the chickens. Hence, even a keeper will suffer from that consequences. The
following are the challenges of using automatic coop door with timer and photo sensors;

i. The door remains open all hours between sunrise and sunset hence no protection for the
chickens in the coop during open hours.
ii. The chicken keeper may mess up the opening and closing times, this is mainly related to
daylight savings time changes.
iii. One of the chickens may get trapped at the door, this may be the case for gravity-driven
doors.
iv. The door may close before all the chickens make it inside. This mean that the chickens that
don’t make it in time will be stuck outside all night in case the chicken keeper don’t notice.
v. The door does not select what animal to enter the coop, it allows all animals to enter even
predators. Hence, predators can harm the chicks and eat eggs inside the coop.
vi. Chickens like privacy, especially if they are laying eggs. But privacy is ignored with these
automatic doors since they remain open for the whole sun day.

2.3. Proposed system.

The proposed system is an automatic chicken coop door with an addition of security which will
protect the chickens against predators in the coop. The system will prevent other organisms
(predators) such as snakes, dogs, cats and foxes to enter the coop through the door hence ensuring
safety of the chicken inside the coop. The door will open automatically to allow only chickens to
enter the coop, hence all chickens and their properties like chicks and eggs inside the coop will be
safe all the time. Different design of proposed system that were suggested are namely as follows;

➢ Automatic chicken coop door with security system by using infrared sensors.
➢ Automatic chicken coop door with security system by using RFID tags.
➢ Automatic chicken coop door with security system by using camera with machine learning.

8
2.3.1. Automatic chicken coop door with security system by using infrared sensors.

In this proposed design, the system will work with the aid of infrared sensors attached upper front
of the door. When the chicken approaches the door (get inside the range of sensitivity of the
sensor), PIR sensor will detect the heat radiated by the chicken and then sent signal to the control
circuit so as to open the door. The door will remain close when there is no any chicken inside the
range of sensitivity of the sensor.

This system will differentiate chickens from other animals (predators) by sensing specific
temperature of domestic birds including chickens which ranges between 40℃ − 42℃. All other
animals like snakes, dogs, cats, foxes etc. their temperature is below 40℃. So, the system will
allow the door to open if the detected radiated heat is between 40℃ − 42℃. Below or above that
temperature, the door will remain closed, hence predators cannot enter the coop because their body
temperature is below the required range of the sensor.

To implement this design seems to be somehow difficult due to the limitations of using sensors in
the design. The following are the limitations that hinder an implementation of the design;

i. It is difficult to measure internal body temperature of animals with their body covered with
feathers by PIR sensor. Most chickens body are full covered with feathers only small part
of their body are uncovered like legs and neck for some chicken species. So, this will be
difficult to reach the required temperature range, hence even chickens will be prevented to
enter the coop.
ii. Internal chicken body temperature may rise above or fall below 40℃ − 42℃ due to health
condition. Then all chickens with health problems will also be prevented to enter the coop
because temperature above or below the range will not activate the door to open.
iii. Internal body temperature of small chickens (a one-day-old chick) is approximately 39℃,
its temperature becomes the same as adult after five to seven days. So, before that days the
chicks will be prevented to use the door.

9
2.3.2. Automatic chicken coop door with security system by using RFID tags.

This design will involve the use of RFID tags in helping to open the door automatically. RFID will
be used to automatically identify and track tags attached to chickens. When chicken is near the
door, its tag will be identified by the system hence door will open to allow the chicken to enter the
coop. Predators without tags will not enter the coop door because will not be identified by the
system. The design is useful because can even track a lost chicken then it is easy to find a chicken
which did not return in the coop during night hours.

This design has limitations to install it because of the following reasons;

i. The installation is more expensive; the design needs each chicken to be attached with those
tags which is very expensive to people who keeps a lot of chickens.
ii. If it happens accidentally a tag removed in a chicken, that chicken will not be identified by
the system hence it will be prevented to enter the coop and left vulnerable to predators
during night hours.
iii. Sometimes not accurate and reliable.

2.3.3. Automatic chicken coop door with security system by using camera with machine
learning.

In this proposed design, a coop door will open and close automatically by the help of image
recognition. This design will allow the system to understand the image of chicken which was taken
in different angles as an input and a system algorithm will provide an output. Then, if the image
matches with the input, the door will open to allow the chicken in, otherwise the door will remain
closed. This will provide security to chickens in the coop all time since all predators will be
prevented to enter the coop.

10
➢ Block diagram of proposed system by using camera.

The proposed system by using camera with machine learning, its block diagram is presented in
figure 1.

Figure 1: Block diagram of proposed system by using camera.

KEY:

Electrical Power flow

Mechanical transmission

Signal flow

11
➢ Advantages of proposed system by using camera.

A proposed system will have the following advantage as follows: -

i. Time saving to a chicken breeder; this system will save the time of a chicken keeper to
continue with other task at time when he/she supposed to be around at home for opening
and closing the coop door.
ii. High efficiency of operation; the system will operate with high efficient, since the chicken
image is unique does not resemble with other animals easily.
iii. The system will allow all types of chicken to enter the coop since different images of
chicken will be taken at different angles so as to recognize faster.
iv. The door will be closed until the chicken approaches the door then it will open to allow
chickens to enter and leave the door, this is beneficial to laying hens since they like privacy.

From the proposed systems discussed above considering their limitations in installation and
advantages, Automatic chicken coop door with security system by using camera with machine
learning seems to be the best solution for this project.

2.4. Requirements gathering for proposed system.


The objective of this step is to obtain information about the potential need for such a door lock
system (Automatic chicken coop door with security system by using camera with machine
learning). The discussion will involve explaining the components and their specifications.
Components of the same functions will be discussed but selection of best component to use will
be made by considering its features and specifications which meet the requirements of the system.
The following are the suggested components with their specifications for the proposed system.

2.4.1. Camera module.

Is an image sensor integrated with a lens, control electronics and an interface like CSI, ethernet or
plain raw low voltage differential signaling. In this project camera module with image sensor will
be utilized so as to capture images for image processing and recognition by machine learning.
There are different types of camera module but only one module will be used in this project. The
selection of module will be done after the discussion of few camera module as follows;

12
➢ ESP32-CAM module.

The ESP32-CAM is a full-featured microcontroller that also has an integrated video camera and
microSD card socket. It’s inexpensive and easy to use, and is perfect for IoT devices requiring a
camera with advanced functions like image tracking and recognition.
The ESP32-CAM module has fewer I/O pins than the previous ESP-32 module. Many of the GPIO
pins are used internally for the camera and the microSD card port. Figure 2(a) shows a picture of
ESP32-CAM module. The ESP32-CAM is based upon the ESP32-S module, so it shares the same
specifications. It has the following features:
▪ 802.11b/g/n Wi-Fi
▪ Bluetooth 4.2 with BLE
▪ UART, SPI, I2C and PWM interfaces
▪ Clock speed up to 160 MHz
▪ Computing power up to 600 DMIPS
▪ 520 KB SRAM plus 4 MB PSRAM
▪ Supports Wi-Fi Image Upload
▪ Multiple Sleep modes
▪ Firmware Over the Air (FOTA) upgrades possible
▪ 9 GPIO ports
▪ Built-in Flash LED
The ESP32-CAM includes an OV2640 camera module. (Workshop, 2020)

➢ OV2640 camera module.


This is a 2 Megapixel OV2640 camera module with an f3.6mm lens. It contains a 24pin flexible
printed circuit (FPC) interface. A wide-angle lens and 1600 × 1200 high resolution, make it a
perfect camera. Picture of OV2640 camera module is presented by figure 2(b).

➢ OV7670 camera module.


The CMOS OV7670 camera module is one kind of CMOS image sensor available in low voltage,
high sensitivity and small size. This module provides the complete single-chip VGA camera
functionality and an image processor within a tiny footprint package. Figure 2(c) shows a picture
of CMOS OV7670 camera module.

13
(a) (b) (c)

Figure 2: Camera module (a) An ESP32-CAM (b) An OV2640 (c) An OV7670.

The CMOS OV7670 camera module and OV2640 have different specifications as presented in the
table 1 below.
Table 1: Specifications of OV2640 vs OV7670. (Tessie, 2021)
Key specifications OV2640 OV7670
Array size 1600 × 1200 (UXGA) 640 × 480 (VGA)
Power supply Core: 1.3𝑉 𝐷𝐶 ± 5% Core: 1.8𝑉 𝐷𝐶 ± 10%
Analog: 2.5~3.0𝑉 𝐷𝐶 Analog: 2.45~3.0𝑉 𝐷𝐶
I/O: 1.7V to 3.3V I/O: 1.7V to 3.0V
Power consumption Free running: 125mW Free running: 60mW
Standby: 600𝜇𝐴 Standby: < 20𝜇𝐴
Image sensor format Type 1/4" Type 1/6"
Maximum image transfer rate 1600 × 1200@15fps VGA@30fps
SVGA@30fps, CIF@60fps
Sensitivity 0.6V/Lux-sec 1.3V/Lux-sec
Signal/noise ratio 40dB 46dB
Dynamic range 50dB 52dB
Pixel size 2.2𝜇𝑚 × 2.2𝜇𝑚 3.6𝜇𝑚 × 3.6𝜇𝑚
Dark current 15 mV/s at 60℃. 12 mV/s at 60℃.
Output format YUV/RGB/Raw RGB YUV/RGB/GRB/Raw RGB
Data/MJPEG Data
Shutter type Rolling shutter Rolling shutter

14
Picking of camera module was done by considering the features of ESP32-CAM module and table
1 which offers an overview on the key specifications of CMOS OV7670 and OV2640 camera
modules. Based on initial studies of the system model, ESP32-CAM module was chosen, as it
believed to be the right one for the use, particularly because;

i. It’s inexpensive and easy to use.


ii. It is perfect for IoT devices requiring a camera with advanced functions like image tracking
and recognition.
iii. It is a microcontroller with camera interface, hence serves two purposes; image capture
and control the function of embedded system.
iv. It includes OV2640 camera which offers higher resolution than OV7670 camera.

2.4.2. DC motors.

Many motion control applications (automatic door control for this case) use permanent magnet DC
motors. Since it is easier to implement control systems using DC motors compared to AC motors.
They are often used when speed, torque or position needs to be controlled. There are two types of
commonly used DC motors; Brushed motors and Brushless motors. Consider the table 2 below
which illustrates the characteristics of brushed DC and brushless DC motors.
Table 2: Characteristics of brushed DC and brushless DC motors. (Millett)
Brushed DC motors Brushless DC motors
Physical feature Have brushes Have no brushes
Life time Short (brushes wear out) Long (no brushes to wear)
Speed and acceleration Medium High
Efficiency Medium High
Maintenance requirements Higher Lower
Electrical noise Noisy (bush arcing) Quiet
Acoustic noise and torque Poor Medium (trapezoidal) or good
ripple (sine)
Cost Lowest Medium (added electronics)

15
Due to declining costs and better performance, brushless motors are gaining in popularity in many
applications due to their characteristics as discussed above.
For automatic door applications, different type of motors are normally used examples BLDC servo
motors, stepper motors and others.

➢ Servo motors.
Servo motor is a rotary actuator or linear actuator that allows for precise control of angular or
linear position, velocity and acceleration. Servo motor as presented in picture of figure 3(b) is a
closed loop servomechanism that uses position feedback to control its motion and final position.

➢ Stepper motors.
A stepper motor also known as step motor or stepping motor, is a brushless DC electric motor that
divides a full rotation into a number of equal steps. The motor’s position can be commanded to
move and hold at one of these steps without any position sensor for feedback (an open-loop
controller), as long as the motor is correctly sized to the application in respect to torque and speed.
A picture of NEMA 17 stepper motor is shown in figure 3(a).

(a) (b)

Figure 3: Brushless DC motors (a) NEMA 17 stepper motor (b) Servo motor.

16
Table 3 below shows the specifications of servo and stepper motors.
Table 3: Specifications of servo and stepper motor.

Key specifications Servo motor Stepper motor (NEMA 17)


Size 38x11.5x24mm 42.3mmx48mm
Weight 17g 350g
Speed 0.14sec/60degrees (4.8V) 200steps/revolution
0.12sec/60degrees (6.0V)
Torque 2.5kgf-cm (4.8V) 3.2kg-cm
3.0kgf-cm (6.0V)
Voltage 4.8V-6.0V 4V
Current 1A 1.2A per coil
Driver L293 A4988, DRV8833, L293,
ULN2003

From the initial field of study of this project, the designed system requires feedback in the control
system of motors to ensure that the motor has reached the required position or not. Referencing
from the comparison of servo and stepper motors, it was determined that servo motors seems to be
the best motors for this project, because;

i. Servo motors are feedback featured, if it is commanded to go to a certain position, it will


do its best to get there. But stepper motors don’t offer feedback on whether they have
travelled their intended distance.
ii. Servo motors constantly struggling to attain a certain position or near-instant error
feedback when it can’t correct itself in more capable systems, but if there is a physical
impediment while spinning, stepper motor can skip steps then continue along as if nothing
is wrong.
iii. Servo motors can be commanded using external control hardware to travel to a certain
position and turn in a controlled manner to obey the command.
iv. Servo motors are less in weight compared to stepper motor.

17
2.4.3. Microcontroller.

Microcontroller is a computer on a single metal-oxide semiconductor (MOS) in an integrated


circuit (IC). Microcontrollers are designed for embedded applications, in contrast to the
microprocessors used in personal computers or other general-purpose applications consisting of
various discrete chips. For the purposes of this systems, a computational device is required. This
device needed to fulfill a series of requirements of the system that makes the features of this
platform possible with the most convenient development environment. The development
requirements that were considered into were as below;

• Ability to run a scripting language.


• Extensive community support.
• Availability of documentation.

Also, a computational device needed to have crucial I/O ports such as a port for the camera
connection, ports for motor connection. Those ports needed for the implementation of camera to
provide a live feed of the door view and motors to operate the lock and the door itself, the
computing device needed to be able to operate all the hardware that make these functionalities
possible.

After determining the requirements for the computational device, few products from popular
providers such as Raspberry Pi and Arduino were taken into consideration.

➢ Raspberry Pi 3.

Is a series of small single-board computers developed in the United Kingdom typically used by
computer and electronic hobbyists, due to its adoption of HDMI and USB devices. The picture of
raspberry Pi 3 is shown in figure 4.

Figure 4: Raspberry Pi 3

18
Specifications for the latest product in the Raspberry Pi 3 range as follows;

▪ Quad Core 1.2GHz Broadcom BCM2837.


▪ 64bit CPU
▪ 1GB RAM
▪ BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board.
▪ 100 Base Ethernet
▪ 40-pin extended GPIO
▪ 4 USB 2 ports
▪ 4 pole stereo output and composite video port
▪ Full size HDMI
▪ CSI camera port for connecting a Raspberry Pi camera
▪ Upgraded switched Micro USB power source up to 2.5A

➢ Arduino boards.

Arduino is an open source electronics platform based on easy to use hardware and software.
Arduino boards are able to read inputs light on sensor, a finger on a button, or a Twitter message
and turn it into an output activating a motor, turning on a LED, publishing something online. There
are many types of Arduino boards, in this paper Arduino Uno and Arduino Nano were taken into
consideration.

i. Arduino Uno: Is an open source microcontroller board based on the Microchip


ATmega328P microcontroller. Figure 5(a) shows the picture of Arduino Uno board.
ii. Arduino Nano: Is a small, complete and breadboard friendly board based on the
ATmega328P. It offers the same connectivity and specs of the Arduino Uno board in a
smaller factor. Figure 5(b) shows the picture of Arduino Nano board.

19
(a) (b)

Figure 5: ATmega328P Arduino boards (a) Arduino Uno (b) Arduino Nano.

The technical specifications of ATmega328P discussed above are elaborated in table 4 as well as
a comparison between Raspberry Pi 3 and Arduino boards are presented in table 5. So, to help in
deciding what computational device to use in this project by consideration of requirements of the
system.

Table 4: Specifications for Arduino Uno and Arduino Nano.

Specifications Arduino Uno Arduino Nano


Microcontroller/Processor ATmega328P ATmega328
Input voltage 5V/7-12V 5V/7-12V
DC current per I/O pin 20mA 40mA
Speed of CPU 16MHz 16MHz
Analog I/O 6/0 8/0
Digital IO/PWM 14/6 14/6
EEPROM/SRAM (kB) 1/2 1/2
Flash (kB) 32 32
USB Regular Mini
USART 1 1
Weight 25g 7g

20
Table 5: A comparison between Raspberry Pi and Arduino board. (Ibro, Wong, & Zyla, 2019)

Raspberry Pi 3 Arduino board


Stronger and quicker processor, multitasking Can run one code at a time, so can't multitask
available activities, slower speed
Built in Ethernet port, Wi-Fi and Bluetooth No internet connectivity (requires shield or
capability module)
Operating system can be switched easily, Bigger learning curve since it uses C/C++
scripting language used (Python) language and need outside sources
Audio output, Camera port, USB ports, HDMI Requires shields to implement most of the I/O
output included devices
Requires installation of programs to get simple Easier to connect to analog sensors, motors and
actions going other electronic components
Very expensive Inexpensive compared to Raspberry Pi 3

From the comparison of the features offered from the Raspberry Pi and the Arduino boards, it was
determined that the Raspberry Pi, unlike the Arduino, is more suitable for projects that involve
several functionalities at the same time. On one hand, the Arduino fits better in projects that require
easy reads from sensors and have to do operations based on the data, while being able to
communicate easily with a variety of motors or machine parts. However, this board does require
extensions in the form of shields, to expand on features that are required to accomplish this project.
Therefore, the Raspberry Pi was the most suitable board for this system.

2.4.4. Sensor.

A sensor is a device, module, machine, or subsystem that detects events or changes in its
environment and sends information to other electronics, frequently a computer processor. To
automate the operation of the door lock system a motion sensor is required. The sensor is
used to detect any activity that will be happening in front of the door, like a chicken approaching
it. Therefore, the sensor required has to be able to detect presence or movements within a
reasonable controlled area. The detection range needs to be limited to prevent the system from

21
being triggered by background activity. In this paper, two motion sensors i.e. Ultrasonic sensor
and IR sensor were taken into consideration.

➢ IR Sensor.

Active infrared sensor is one kind of electronic component, used to detect specific characteristics
in its surroundings through emitting or detecting IR radiation. IR sensors act as proximity sensors
and they are commonly used in obstacle detection systems such as in robots. Figure 6(b) shows a
picture of IR Sensor.

➢ Ultrasonic Sensor.

An ultrasonic sensor is generally used to measure the distance of an object using sound waves.
The sensor consists of a transmitter and receiver pair. The distance can be measured by taking
into account the elapsed time between the sound wave being generated and the sound wave
bouncing back to the receiver. Picture of ultrasonic sensor is shown in Figure 6(a).

(a) (b)
Figure 6: Sensors (a) Ultrasonic sensor (b) IR sensor.

22
Table 6 provides a side by side comparison between the Ultrasonic and PIR sensors.

Table 6: A comparison between an ultrasonic and a PIR sensor.

Type Ultrasonic IR
Supply voltage 5V DC 5V DC
Range 2-400 cm 20 cm
Supply current 8mA 20mA
Type of info Time that can be converted to HIGH, LOW
distance

By comparing the characteristics of each sensor type it was determined that the IR sensor is more
suitable for this product because of its higher accuracy in the types of environment it will be
exposed to, as well as the ability of emitting or detecting IR radiations.

23
CHAPTER THREE.

PRELIMINARY DESIGN AND ANALYSIS.


3.1. Introduction.

In this chapter, initial design of the project will be discussed. The discussion will involve listing
of devices that will be used in this project after a detailed review of main components as discussed
in chapter two. The flow chart of the system (working flow) and analysis of overall cost for the
project will be discussed too.

3.2. Design Hardware (System Modules Set Up and Configuration).

After requirements gathering, there is the hardware design phase. In this step, the selected devices
are assembled accordingly. The hardware system consists of the following components as selected
in section 2.4 of chapter two.

i. ESP32-CAM module.
ii. IR sensor
iii. Raspberry Pi 3
iv. Servo motor

ESP32-CAM module.

Vision part is essential in this project so as to help in identification of kind of animals to be allowed
to pass the door (chickens for this case). The system is enabled by employing a camera module
which is ESP32-CAM module. This module will help to capture image of object near the door.
Features and specifications of this module were explained clearly in section 2.4.1.

IR sensor.

This project requires a device which will be added to prevent camera to capture images all the
time, hence image capturing will be activated after detecting presence of an obstacle near the door.
Hence, an infrared sensor with specifications as explained in table 6 will be employed in this
design. Also, IR sensor is added to prevent chicken from being trapped by the door before they
leave the passage.

24
Raspberry Pi 3.

For the purposes of this systems, a computational device which is stronger and quicker processor,
multitasking is required. The Raspberry Pi 3 was on-board logical unit of choice, as explained in
detail in section 2.4.3 which provides its features and specifications. The Raspberry Pi 3 in this
project is responsible for the below functionalities;

i. Control the servo motor via commands coming from the database.
ii. Check the IR sensor for movement and using the camera to snap a picture of the object
which is at the door, whenever one is detected.
iii. Send the picture to the database and receive response: if a positive one, control the servo
motor to unlock and open the door.

Servo motor.

The implementation of such a door lock system involved some mechanical engineering in order to
make the door adaptable for chickens and to offer the feature of fully opening and closing the door
via commands from the database, or just by approaching, i.e. hands free. In order to achieve this
functionality, a servo motor is required. More details for servo motor are elaborated in section
2.4.2 and its specifications are presented in table 3.

3.3. Working of system.

Users (chickens for this case) will be allowed to pass the door by just approaching the door. When
a user is within a certain radius, an IR sensor detects them, and activates the camera. The Raspberry
Pi attached to the door and is responsible for controlling a servo motor, a camera then sends an
image of the user at the door to the database. Then, image recognition is taking place in an image
recognition library, which compares each image sent by the Raspberry Pi with images already
uploaded in the database. If the image recognition algorithm identifies an image, it automatically
sends a positive response to the Raspberry Pi, which in turn activates the servo motor and opens
the door. But, if the image recognition algorithm found an image that do not match, it automatically
sends a negative response to the Raspberry Pi, which ends the processing and the servo motor
remain still as well as door remain closed. Figure 7 shows components diagram of the proposed
system which illustrates the working of the system.

25
Figure 7: Components diagram for proposed system.

3.4. Flow chart of the system.


In this paper, door control is based on the confirmation that the detected object is indeed a chicken
and the corresponding movement trajectory also indicates that it has the intention to go through
the entrance.

The proposed innovative door control system is mainly based on chicken detection and intension
analysis. The first part involves image capturing of the detected object by IR sensor at the door,
while the latter includes image processing and recognition by machine learning. Figure 8 shows
the flow chart of the operating procedure for the opening and closing the door.

26
Figure 8: Flow chart of proposed system.

27
CONCLUSION.
In this report, preliminary design of automatic chicken coop door with security system against
predators was successfully done. This includes selection of best security system from those that
were proposed which will protect chickens effectively in their coop against predators. Also, in
preliminary design of proposed system, decision on choosing the appropriate devices for the
system was discussed in detail, hence initiating to come up with a good technical design of the
system in future work.

28
REFERENCES.
[1] Ibro, A., Wong, A., & Zyla, M. (2019, April 28). Digital WPI. Retrieved January 30, 2022,
from digital.wpi.edu.

[2] Inks, K. (2012, June 05). Design, construction and evaluation of an automated chicken coop
door. Retrieved November 17, 2021, from digitalcommons.calpoly.edu.

[3] Lwin, H. H., Khaing, A. S., & Tun, H. M. (2015, June). Automatic Door Access System Using
Face Recognition. International Journal of Scientific and Technology Research, Volume
4(Issue 06). Retrieved February 31, 2022, from www.ijstr.org

[4] Millett, P. (n.d.). Journal Artical. Brushless Vs Brushed DC Motors. Retrieved January 26,
2022, from https://www.monolithicpower.com/en/brushless-vs-brushed-dc-motors

[5] Shrestha, M., Kumar, S., Shrestha, S., & Pandit, V. (2012, October). Automatic Door Control
System. A Minor Project Report. Retrieved January 31, 2022, from
https://www.slideshare.net

[6] Tessie. (2021, November 05). Utmel Electronic. Retrieved January 28, 2022, from
www.utmel.com.

[7] Workshop, D. (2020, May 24). Build your own electronics. Getting started with the ESP32-
CAM. Retrieved January 22, 2022, from https://dronebotworkshop.com/esp32-cam-intro/

29
APPENDICES.
Appendix A: Time schedule.
Table 7: Time schedule for the project for semester I.

S/N Activities WEEK


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
1 Literature
review
2 Consultation
(with
supervisor)
3 First oral
presentation
4 Report
writing
5 Progress
report
submission
6 Second oral
presentation
7 Submission
of report
8 Third oral
presentation

Work already done


Work to be done

30
Appendix B: Cost estimation.
Table 8: Cost estimation.

S/N ITEM QUANTITY COST(Tsh)


1 ESP32-CAM module. 1 35,000
2 Servo motor 2 @20,000
3 IR sensor 2 @8,000
4 Converter/Adapter 12V 1 10,000
5 PCB 1 5,000
6 Stationary cost 20,000
TOTAL 126,000

31

You might also like