Brenda Thiongo Project Automatic Greenhouse Control System

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

lOMoARcPSD|39118440

Brenda Thiong'O Project, Automatic Greenhouse Control


System
Electrical engineering (The Nyeri National Polytechnic)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by joshua maina (jbmaina100@gmail.com)
lOMoARcPSD|39118440

MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY

SCHOOL: ENGINEEERING AND ARCHITECTURE

DEPARTMENT: ELECTRICAL AND ELECTRONICS

PROJECT TITLE: AUTOMATED GREENHOUSE CONTROL SYSTEM

NAME: THIONG’O BRENDA WANJIRU

REG NO: EG209/0015/18

A PROJECT SUBMITTED IN PARTIAL FULFILMENT FOR THE AWARD OF THE


DEGREE OF BACHELOR OF TECHNOLOGYIN ELECTRICAL AND ELECTRONICS
ENGINEERIMG IN THE DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ENGINEERING IN MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY.

DATE OF SUBMISSION ………………………………..

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

DECLARATION
This is to confirm that this is my original work and has not been presented elsewhere for degree
or any other award.

Sign: .........................................

Date: ............................................

Name: Brenda Thion’go

Reg. Number: EG209/0015/18

Sign: .......................................

Date: ...................................

Supervisor…………………………………………

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

ACKNOWLEDGEMENT
First and foremost, I thank Almighty God for His love, grace, mercy and strength. I also
sincerely thank my supervisor, Mr. Job Kerosi, for his constant advice, encouragement and
support during this entire period of this proposal report. I acknowledge my loving family for
working tirelessly to ensure that I am okay and comfortable in school and their prayers. Not
forgetting my dear friends who have always been there for me, thanks for your encouragement
and prayers

ii

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Contents
DECLARATION...............................................................................................................................................i
ACKNOWLEDGEMENT..................................................................................................................................ii
ABSRACT.....................................................................................................................................................vi
CHAPTER 1: INTRODUCTION........................................................................................................................1
1.1 Background Statement......................................................................................................................1
1.2 Problem statement............................................................................................................................2
1.3 Objec琀椀ves..........................................................................................................................................2
1.31 Main objec琀椀ve.............................................................................................................................2
1.32 Speci昀椀c objec琀椀ves........................................................................................................................2
1.4 Jus琀椀昀椀ca琀椀on........................................................................................................................................2
1.5 Hypothesis.........................................................................................................................................2
CHAPTER 2: LITERATURE REVIEW................................................................................................................4
2.1 Introduc琀椀on.......................................................................................................................................4
2.2 Greenhouse overview.......................................................................................................................4
CHAPTER 3: METHODOLOGY.......................................................................................................................8
3.1 Introduc琀椀on.......................................................................................................................................8
3.2 Main components of the system.......................................................................................................8
3.3 Arduino Uno R3 Microcontroller.......................................................................................................9
3.31 Power.........................................................................................................................................12
Memory.............................................................................................................................................12
3.4 Digital output Humidity and Temperature sensor (DHT11 sensor)..................................................14
3.41 Technical speci昀椀ca琀椀ons.............................................................................................................15
3.42 Detailed speci昀椀ca琀椀ons:..............................................................................................................16
3.43Typical applica琀椀on and connec琀椀on:...........................................................................................17
3.44 DHT11Arduino Uno R3 interfacing............................................................................................17
3.5 Capaci琀椀ve moisture sensor..............................................................................................................18
3.51 Features & Speci昀椀ca琀椀ons...........................................................................................................19
3.52 Interfacing capaci琀椀ve sensor with Arduino................................................................................19
3.6 16 x 2 LCD Display............................................................................................................................20
3.7 Light Dependent Resistor (LDR).......................................................................................................20

iii

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

3.71 Construc琀椀on..............................................................................................................................21
3.72 Design considera琀椀ons................................................................................................................21
3.73 Use of the LDR in this system.....................................................................................................21
3.8 Relay System....................................................................................................................................22
3.81 Working of Relays......................................................................................................................22
3.82 Connec琀椀on of an SPDT Relay to Load........................................................................................23
3.9 Cooling system.................................................................................................................................24
3.10 Backup ligh琀椀ng system..................................................................................................................24
3.11 Irriga琀椀on system............................................................................................................................24
CHAPTER 4: TESTING, RESULTS AND DISCUSSION.....................................................................................25
4.1 Introduc琀椀on.....................................................................................................................................25
4.2 Construc琀椀on and tes琀椀ng..................................................................................................................25
The components used for the construction of the automated greenhouse control system are DHT11
sensor, capacitive soil moisture sensor, LDR sensor, LCD, LDR lights, Arduino Uno
Microcontroller, 4 module relay, resistor and connectors. The test circuit is split into sections
including, the power supply section, the relay section, the arduino section and the sensor section....25
4.21 Tes琀椀ng...........................................................................................................................................25
4.3 Results and Discussion.....................................................................................................................27
CHAPTER 5: CONCLUSION.........................................................................................................................31
5.1 Review of objec琀椀ves........................................................................................................................31
5.2 Problems encountered....................................................................................................................31
5.3 Recommenda琀椀ons...........................................................................................................................32
5.4 Program code..................................................................................................................................33
APPENDIX..................................................................................................................................................39
WORK PLAN...........................................................................................................................................39
PROPOSED BUDGET...............................................................................................................................40

iv

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 1..........................................................................................................................................11
Figure 2..........................................................................................................................................13
Figure 3..........................................................................................................................................16
Figure 4..........................................................................................................................................19
Figure 5 .......................................................................................................................................20
Figure 6..........................................................................................................................................22
Figure 7..........................................................................................................................................23
Figure 8..........................................................................................................................................24
Figure 9..........................................................................................................................................26
Figure 10........................................................................................................................................27
Figure 11.......................................................................................................................................30
Figure 12........................................................................................................................................33
Figure 13........................................................................................................................................36
Figure 14........................................................................................................................................36
Figure 15........................................................................................................................................37
Figure 16........................................................................................................................................37

Table 1 21

Table 2...........................................................................................................................................22
Table 3...........................................................................................................................................40
Table 4...........................................................................................................................................41

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

ABSRACT
This project entails a system which a system meant to control the conditions within a
greenhouse. Various sensors along with the microprocessor will be used. In this project, Arduino
Uno will be able to do some predefined task. The system projects the parameters in a display as
well as control five vital things: temperature, soil moisture, light, and humidity and soil nutrients.
The goal behind this project is to is to make an innovation that make an almost exact
environmental conditions for growth of fruits and vegetables.

vi

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

CHAPTER 1: INTRODUCTION

1.1 Background Statement


In the present world, agriculture still stands out as a key sector in many economies, especially
those in the Third World countries. Agricultural practices are vital for human survival owing to
the increasing demand for the supply of high quality agricultural produce for the rising human
population. This calls for more efficient ways of maximizing output, while maintaining, or even
improving, the quality of produce (palwak, 2020). As such, the greenhouse is one of the widely
used technologies in crop cultivation. Popular in the Western Countries and Asian countries for
long, the greenhouse has risen to become an indispensable tool for farming in Africa as a
continent. In Kenya, a lot of companies and individual people have embraced greenhouse
farming because it does not only maximize output but it has made it possible to grow any crop at
different places despite climatic conditions of the places. This is due to the increasing global
warming and climatic change, which makes it harder for certain, plants to thrive well in natural
climatic conditions. Individual crops require certain conditions for growth, thus the essence of a
greenhouse is to provide a controlled ambient climate for the proper growth and cultivation of a
specific type of crop. The most common plants grown in greenhouses in Kenya include flowers,
fruits, and vegetables and lately, many other food crops are being grown in greenhouses in areas
where climatic conditions are a constraint.

Against a hot climatic condition this project aims to design a system that makes it possible to
grow and cultivate fruits in a greenhouse in Naivasha region. This is in the rift valley in Nakuru
County. The region is well known for its greenhouses with crops such as flowers red cabbages,
red and white onions, strawberries, French beans and tomatoes being grown. The general
climatic conditions are average temperatures of 27°C 35°C, relative humidity above 50% and
average rainfalls of 1200mm – 1800mm, all year round. The high temperatures are due the
presence of Lake Naivasha. Generally, this region has a capability of supporting proper
horticulture owing to the favorable conditions. However, due to the high temperatures in the
region, there is need to control the humidity, precipitation and to regulate temperatures to
facilitate the crops grown at specific times of the year. This necessitates a mechanism in which
these two conditions are monitored and controlled, the temperatures and humidity.

Most common method of irrigation in Kenyan greenhouses is the drip irrigation. Not only is drip
irrigation easy to work with, but it supplies just the perfect amount of water to the crop hence
minimizes waste. Drip irrigation can be placed on top of the soil or buried in it. It’s easier to
control drip irrigation scheme and hence possible to automate it. Different crops requires specific
amount of water and thus necessitates a system which can check on the moisture content of the
soil to enable irrigation. (Hornum, 2021)

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Repetitive growth of crop, as in the case of greenhouse house farming, can result to depletion of
some nutrients in the soil. Different crops require specific nutrients, and a certain PH value of the
soil. Availability of some nutrients such as phosphorous is greatly affected by the soil PH while
other nutrients may not be necessarily affected by it. Most fruit crops thrive under a soil PH of
6.0-7.0 (Ganeshamurthy, 2015). To maintain, there is need for coming up with a system that can
check on the soil PH and the available nutrients, that way the necessary action can be taken like
adding certain materials to adjust the PH and increase the required nutrients.

1.2 Problem statement


This project attempts to resolve the problem with high temperatures and humidity within a
greenhouse in hot climatic areas where normally greenhouses will not be set up. The project also
aims at reducing a lot of manual labor involved with irrigation, checking on the soil condition
and trying to regulate the greenhouse temperature and humidity manually. The problem can be
solved by automating the processes thus reducing the cost of production and maximizing the
output.

1.3 Objectives

1.31 Main objective


To design and implement automa琀椀c greenhouse temperature monitoring, soil moisture check and light
control a mechanism.

1.32 Specific objectives


1. To implement a system that measures and regulates the light intensity inside the
greenhouse to ensure a given minimum level is maintained.
2. To come up with a system that checks on the amount of moisture in the soil, this activates
a water pump for irrigation system.
3. To implement a system that measures and regulates the light intensity inside the
greenhouse to ensure a given minimum level is maintained

1.4 Justification
Automation of a greenhouse provides efficient data acquisition and control of microclimatic
parameters. It also significantly reduces the labor involved in its maintenance thus making the
system useful for small scale agriculturists, gardeners and agricultural researchers.

1.5 Hypothesis
1. If we develop a system that is able to check on the nutrients available in the soil then we
can be able to improve on what is lacking and therefore increasing production.
2. If we develop an automatic drip irrigation mechanism, then we will be able to reduce the
cost of labor involved with manual drip irrigation system and also minimize water
wastage.

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

3. If we come with a system that can control the greenhouse temperature and humidity, then
we will be able to grow various crops under certain temperatures and the greenhouses can
be set up anywhere within the country.

1.6 Project scope

The scope for this project includes:

1. Monitoring and display of the ambient real-time temperature and relative humidity inside
the greenhouse.
2. The microcontroller generating a control voltage of 5V, enough to activate a relay which
switches on the fog cooling mechanism.
3. Maintaining of a constant temperature range of 270C to 40oC
4. To measure, regulate and maintain the light intensity inside the greenhouse above a given
preset minimum value as desired.

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

CHAPTER 2: LITERATURE REVIEW

2.1 Introduction
This chapter is about information concerning the greenhouse technology, its effect and the
available projects that have so far been developed to improve the efficiency and the functionality
of the greenhouse.

2.2 Greenhouse overview


The greenhouse is typically a structure whose roof and sides are transparent or translucent,
permitting a sufficient quality and quantity of solar radiation to enter the structure for
photosynthesis. It allows the growing of crops independently of the outside climate, since its
interior temperature and humidity can be controlled (Papadakis, 2000).

Greenhouses vary in size and complexity from small home or hobby structures to large
commercial units covering an acre or more of land; the average expanse of most greenhouses is
however 15m by7m. An even smaller greenhouse might be termed the hot bed, a glasstopped
box containing fermenting organic matter; the fermentation process yields heat, allowing the
gardener to start plants from seed in early spring for later transplanting.

The basic construction of a greenhouse consists of a light but sturdy frame capable of resisting
winds and other loads. Conventional foundations usually support vertical walls; the roof may be
gabled, trussed, or arched. The conventional greenhouse is fitted with glass panes, but plasticfilm
or fibreglass panels often supplant glass.

Components in a greenhouse can be broadly divided into 3 main categories.

1. Structural Design.
2. Green House covering.
3. Environmental controls

The Structural Design of a greenhouse must provide protection against damages from wind, rain,
heat and cold. At the same time the structure of greenhouse must be of minimum size in order to
permit maximum light transmission to the crop. Some of the structural considerations in a
greenhouse include:

Hot galvanized steel poles and profiles. It is based on the desired length, width, gutter height,
spans for the green houses (Zabeltitz, 2011).

For Poly or Aluminum/metallic lock profiles, connect polythene to metallic construction and
gutters. The roof should be built from strong gothic type arches with narrow spacing for higher
stability of the polythene cover and increased resistance to heavy rainfall and strong winds. The
structure should be built modularly to enable easy expansion. For most efficient release of hot

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

air and excess humidity, ventilation openings are placed in the roof. Opening should be vertical
in order to prevent rainfall from reaching the growing areas. For greenhouse covering,
polyethylene film is used to cover. The covering should have following properties:

UV Filtration: For longer duration of polythene itself and prevent harmful radiation from
reaching the plants the stability of the thermo film allows it to resist splitting and tearing and to
maintain the above properties up to two years

Anti – Fog properties: Accumulation of condensation and uncontrolled dripping inside the green
house are avoided by a special antifog coating.

Polythene strip for Insulation: These are special strips which insulate the covering polythene
from heat of the steel arches and protect the polythene at the point of contact. The strip lengthens
the life of polythene.

Insect Proof Net: A dedicated net is required for preventing entrance of insects into green houses
with minimum effect on ventilation. This insect proof net minimizes the consumption of
pesticides thus reducing the cost and negative effects of chemicals.

Environment control

Environment control systems are various control systems which are used to regulate temperature
(i.e. heating & cooling) and other controls. These consist of following:

Cooling: Evaporative cooling pads can be installed along the long wall of the green house in
order to reduce temperatures (Arbel, 1999) up to 15°C during the dry period and to increase
humidity if necessary. The system is automatically operated according to the temperature/
humidity/time.

1. Electric Fan: Dedicated fans with air replacement capacity and cooling operation for
climate control function and disease prevention. For energy conservation the fans are
operated gradually in four stages according to temperature and humidity parameters.
2. Air Mixers: These are used for the purpose of air movements in order to prevent diseases
and to create a uniform environment. They are resistant to high humidity and
temperatures as well as to chemicals.
3. Sensors: A fully integrated computer network constantly monitors and controls the
variables in greenhouses. For internal ambient climate control, indoor sensors are
necessary for temperature and humidity and outdoor sensors for external temperatures,
humidity, wind speed and directions.
4. Optional: Control system which is compatible with all irrigation and fertigation systems
in open field or green house. .

Maintenance of temperature and relative humidity within the greenhouse is difficult because of
fluctuating outside conditions. When the sun shines brightly, little heat is needed, and there has

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

to be a cooling mechanism in a way so as to prevent damage to crops. This can be achieved


through fanning, using evaporative cooling pads, use of openings to allow circulation of air and
also through fog cooling/misting, which not only reduces the ambient temperature, but also
increases the relative humidity. For internal heating purposes in chilly Polar Regions, hot water,
steam, electric cables, or warmair furnaces provide the heat, which is usually controlled by a
thermostat.

Temperatures in greenhouses are therefore regulated to suit the crop. Cooling is often required
during summer days in warm climates. Ventilation is the simplest technique, reducing inside
temperature to closer of that of the outdoors. Additional cooling by refrigeration may be
required; in dry regions, the evaporative cooler is efficient and also increases the relative
humidity within the structure.

Another form of environmental control consists of adding extra carbon dioxide to the air if the
crop requires it for extra photosynthetic efficiency (Ainsworth, 202`). The commercial-
greenhouse operator usually grows vegetables, fruits or ornamental plants. Such production
makes more demands on the grower, because he must assume many of the tasks normally
handled by nature in the open fields. He must regulate the temperature, ventilate, adjust the
amount of entering sunlight, and provide soil moisture, fertilize, and even facilitate pollination.
During the offseason, the structure must be cleaned and fumigated, its soil restructured, and
mechanical equipment checked.

Mechanization of greenhouse operations has lagged far behind the pattern of agriculture in
general. Disease is a particularly serious hazard in greenhouse farming, requiring constant
attention and use of chemicals.

Temperature and humidity control system

I will design an electronic system which:

1. Measures the ambient temperature and humidity inside a greenhouse through a


temperature and humidity sensor, soil moisture using sensing probes.
2. Compares the values obtained against the preset values in a microcontroller.
3. If the temperature is higher than the preset temperature, the microcontroller sends a
control signals to relay which switches on a temperature control mechanism (fog cooling
system) in a separate circuit.
4. The field sensor monitors the decrease in temperature and rise in humidity till the desired
level is attained. This is related to the microcontroller, which deactivates the relay to stop
the cooling mechanism.
5. Two probes of soilmoisturesensors are used and placed in the soil. When the soil-
moisturesensor does not sense the desired moisture in the soil, the system turns a water
circulation/pumping system until the sensor responds accordingly.

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Several cooling mechanisms can be used for this temperature control, which may include:

• Extraction of ambient heat by use of motor driven fans.

• Evaporative cooling by use of a fog cooling system. This involves the sprinkling of cold water
droplets into the greenhouse through nozzles using a high pressure system.. These form clouds of
water which evaporate and take away ambient heat in the greenhouse. I prefer the fog cooling
system because, as it extracts ambient heat to restore the temperature to the desired level, it also
increases the humidity in the green house.

An arduino microcontroller will be used as the heart of the whole system because of the
precision and speed of response offered by digital control circuits.
Microcontroller circuit

Microcontroller circuit Relay system

inputs

from

sensors

Figure 1

The system to be designed will have the following components:

1. An Arduino Uno R3 microcontroller.

2. An LCD system to display the changing conditions.

3. The DHT11 basic integrated Humidity and Temperature sensor – has a


transmission range of 20m.

4. A cooling mechanism – a motor driven fan.

5. A 5V DC relay.

6. A light dependent resistor. A breadboard.

7. Connecting wires.

8. Power supply, both A.C and D.C

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

9. Capacitive soil moisture sensor

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

CHAPTER 3: METHODOLOGY

3.1 Introduction
This chapter outlines and details the various components of this automated greenhouse climate
control system. The core of this system is an electronic circuit based on the Arduino Uno
microcontroller, which will serve as the bridge between the conditions in the greenhouse and the
regulatory system made of the misting/fogging system, the water supply system and nutrient
check system.

3.2 Main components of the system


Connected to this microcontroller will be a number of electronic components and sensors, which
will be used to feed and output various signals into and out of the microcontroller.

In general, the system design of this greenhouse climate control system will include:

1. The Arduino Uno R3 microcontroller.


2. The Digital output Humidity and Temperature sensor (DHT11 sensor).
3. A 16 by 2 Liquid Crystal Display (LCD) module
4. A general purpose 12V relay.
5. A Light Dependent Resistor (LDR) for extra system functionality of monitoring
greenhouse light intensity.

6. Capacitive sensor

In addition to these components, there will be a breadboard on which the circuit will
implemented, with connector cables/ jumpers used to link the various components.

Capaci琀椀ve
LCD display
moisture

COOLING
SYSTEM

DHT 11 ARDUINO UNO R3


SENSOR
MICROCONTROLLER Irriga琀椀on
RELAYS 1
2$3 system
LDR

BACKUP LIGHTING
SYSTEM

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 2
POWER
3.3 Arduino Uno R3 Microcontroller.
The Arduino Uno microcontroller (Barrett, 2013) will be the heart of the system which will
receive all inputs from the sensors, interpret them and output the required control signals to the
cooling system, fertigation system, and drip irrigation system for the desired conditions to be
restored.

A microcontroller is a specialpurpose computer which is embedded in a system and dedicated to


performing one task. Unlike the general purpose computers which can run thousands of
programs at a go, microcontrollers usually run one program stored in their Read Only Memory
(ROM) according to their designated duty. For instance, the Arduino Uno R3 microcontroller
which will used in implementing this greenhouse fruit cultivation system will be programmed to
ensure the parameters inside the greenhouse are maintained within a given range for the optimum
growth of the plants inside the greenhouse.

As such, the microcontroller has a dedicated input device(s) i.e., the DHT11 humidity &
temperature sensor among other related sensors like. the LDR, NPK sensor and soil moisture
probes and LCD, which is used as the output display interface for the system. All processing
action will be done in the ATmega328 microprocessor, which is programmed with the Arduino
language based on the C programming language. The core of the Arduino board is a
microcontroller chip known as the ATmega328.

The Atmega328 is an 8 bit computer such that once switched on; its CPU loads a byte from a
predefined memory location and interprets it as a statement. What follows is interpreted
according to the content of such a byte. Contrary to the other common computers, the
ATmega328 does not run any operating system: the usage of the resources is completely under
the control of the programmer. One cannot rely on the operating system to prevent wrong
memory usage, overflows, underflows and any other error. Moreover, that CPU can only run one
task at the same time (this is true for all the CPU’s). A fresh Arduino has an empty memory,
hence the first byte loaded by the CPU correspond to the statement nop: no operation. Before
using Arduino one has to load its memory with an executable program, i.e. a sequence of bits,
the first of which is interpreted as a statement and executed. If the statement needs parameters to
be executed, they are taken from the following bytes in the memory. Once the execution of a
statement has been completed, the CPU loads the successive byte in the memory and interprets it
as well as a statement. On switching off the Arduino, the memory is not lost. The sequence of
bytes loaded into it is kept in a non–volatile memory, such that on switching on again, the
program starts again from its beginning.

The timing for CPU operation is provided by a 16 MHz clock, while the power can be provided
through a dedicated power jack as well as through its USB interface. For operation, Arduino
requires an input voltage between 7 and 12 V (voltage regulation is provided on board). On

10

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

board, both a 5 V and a 3.3 V regulated output are provided to the user, too, from which one can
drive a maximum current of 50 mA. Arduino memory is of three types: a flash memory, where
the program is stored, of 32 kB; a static random access memory (SRAM) of 2 kB, where the
CPU stores and manipulates the variables used in the program; and an erasable read only
memory (EEP ROM) of 1 kB where the programmer can store data that must survive the switch
off (as the flash memory, where the program is stored).

The ATmega328 CPU is connected to 14 I/O digital pins (numbered from 0 to 13), 6 analog
inputs and a USB port. A digital pin is an electrical connection that can have two logical states: 1
and 0, or true and false or, as in the Arduino jargon, LOW and HIGH. When put to LOW, the
corresponding pin is at the ground potential: the voltage measured between the ground and the
pin is zero. If the pin is set to HIGH the voltage between the pin and the ground is 5 V.

Pins 0 and 1 are used for serial transmission and reception: on those lines the Arduino board can
communicate with shields on it using a serial protocol. Serial protocols are communication
protocols in which each bit is transmitted/received one after the other.

Pins 2 and 3 can also be used as interrupts. An interrupt is an electrical signal that interrupts the
current CPU program upon the occurrence of a given event. Interrupts exists also on computer’s
CPU’s 1. Once an interrupt is detected, the CPU saves its state in the memory and abandons the
execution of the program, jumping to execute the interrupt handler: a short and fast piece of
software needed to serve the interrupt. Upon completion, the CPU resumes the status it had
before serving the interrupt and restarts the execution of the program.

Pins 3, 5, 6, 9, 10 and 11 are PWM (Pulse Width Modulation) pins (labeled with a ~) and
provide also some analog capabilities. Correspondingly, their memory counterparts contain
values between 0 and 255.

Pin 13 is also connected to an LED on board. When the pin is LOW the LED is off, while if the
pin is HIGH the LED is on.

Besides standard use as digital I/O ports, pins 10, 11, 12 and 13 provide a mean to communicate
with external peripherals.

Analog inputs are labeled A0 through A5: each of them provides a resolution of 10 bits, i.e. they
convert any voltage from 0 to 5 V to a number between 0 and 1023 that can be accessed in the
memory.

11

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 3
The board also carries a USB A/B connector through which one can connect it to a computer for
communications. The USB connection also provides power to the Arduino when connected to a
computer, eliminating a need for an external power supply.

In summary, the technical specifications of Arduino Uno R3 are as follows:

Microcontroller ATmega328

Operating voltage 5V

Input voltage (recommended) 7V – 12V

Input voltage (limits) 9V – 20V

Digital I/O pins 14(of which 6 provide PWM output).

Analog input pins 6

DC Current per I/O pin 40mA

DC Current for 3.3V pin 50mA

12

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Flash Memory 32KB of which 0.5KB is used for the bootloader

SRAM 2KB

EEPROM 1KB

Clock speed 16MHz

3.31 Power
The Arduino Uno can be powered via a USB connection or with an external power supply. The
power source is selected automatically.

External (nonUSB) power can come either from an ACtoDC adapter or battery. The adapter can
be connected by plugging a 2.1mm centerpositive plug into the board's power jack. Leads from a
battery can be inserted in the GND and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may be unstable. If using
more than 12V, the voltage regulator may overheat and damage the board. The recommended
range is therefore usually 7 to 12 volts.

The power pins of this microcontroller are as follows:

• VIN The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). One can supply
voltage through this pin, or, if supplying voltage via the power jack, one has to access it through
this pin.

• 5V this is the regulated power supply used to power the microcontroller and other components
on the board. This can come either from Vin via an onboard regulator, or be supplied by a USB
or another regulated 5V supply. In this project, I will supply power to the microcontroller using
this power pin via a USB connection to a computer.

• 3V this is a 3.3 volt supply generated by the onboard regulator. The maximum current drawn
using this pin is 50 mA.

• GND these are Ground pins, at a potential of 0 volts, used to connect the whole system to the
ground and therefore protect it against any power surge. This pin is linked to the earth through a
connection via the breadboard.

Memory
The Atmega328 has 32 KB of flash memory for storing code (of which 0.5 KB is used for the
boot loader); it also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written
with the EEPROM library).

13

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Each of the 14 digital pins on the Uno can be used as an input or output, using pin Mode (),
digital Write (), and digital Read () functions. They operate at 5 volts, and each pin can provide
or receive a maximum of 40 mA and has an internal pullup resistor (disconnected by default) of
2050 KiloOhms.

In addition, some pins have specialized functions, which include:

• Serial: 0 (RX) and 1 (TX). These are used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USBtoTTL Serial chip.

• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value.

• PWM (pulse width modulation): 3, 5, 6, 9, 10, and 11. These pins provide 8bit PWM output
with the analogWrite() function.

• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication,
which, although provided by the underlying hardware, is not currently included in the Arduino
language.

• LED: 13. There is a builtin LED connected to digital pin 13. When the pin is HIGH value, the
LED is on, when the pin is LOW, it's off.

14

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 4
3.4 Digital output Humidity and Temperature sensor (DHT11 sensor)
The DHT11 (Srivastava, 2018) is a basic, low-cost digital temperature and humidity sensor
complex with a calibrated digital signal output. It uses a capacitive humidity sensor and a
thermistor to measure the humidity and temperature of the surrounding air, and spits out a digital
signal on the data pin (no analog input pins needed).

15

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 5
By using the exclusive digitalsignalacquisition technique and temperature & humidity sensing
technology, it ensures high reliability and excellent long-term stability. This sensor includes a
resistive type humidity measurement component and an NTC (Negative Temperature
Coefficient) temperature measurement component, and will connect to a high performance 8bit
microcontroller (the Arduino Uno R3 in). This will offers excellent quality, fast response to
changes in the measurements, antiinterference ability and costeffectiveness as two parameters are
jointly recorded and multiplexed along one pin to the microcontroller unit.

Each DHT11 element is strictly calibrated in the laboratory that is extremely accurate on
humidity calibration. The calibration coefficients are stored as programs in the OTP memory,
which are used by the sensor’s internal signal detecting process. An OTP (OneTime
Programmable Read Only Memory) refers to a kind of storage device like an EPROM but with
no quartz glass window in the package for erasing the contents. This reduces the packaging cost
but means the device cannot be erased with UV rays as other ROMs and so can only be written
once.

The singlewire serial interface makes system integration quick and easy. Its small size, low
power consumption and upto20 meter signal transmission makes it the best choice for long-range
applications.

The component is 4pin single row pin package of which only three pins are used. One is used to
multiplex the recorded measurements; another is connected to a 5V D.C. supply, while another is
connected to the ground.

3.41 Technical specifications


Overview

Item Measurement Humidity Temperature Resolution Package


range accuracy accuracy

DHT11 20%90% RH ±5% RH ± 2ºC 1 4 Pin, Single

16

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

OºC 50ºC row

Table 1
3.42 Detailed specifications:
Parameters Conditions Minimum Typical Maximum

Humidity

Resolution 1%RH 1%RH 1%RH

8 Bit

Repeatability ±1% RH

25ºC ±4% RH

Accuracy 0ºC 50ºC ±5% RH

Interchangeability Fully interchangeable

Measurement 0ºC 30%RH 90%RH


range
25ºC 20%RH 80%RH

40ºC 20%RH 80%RH

Response time 1/e(63%)25°C 6 seconds 10 seconds 15 seconds


(seconds) 1m/s Air

hysteresis ±1% RH

Long term Typical ±1% RH/year


stability

Temperature

Resolution ±1°C ±1°C ±1°C

8 Bit 8 Bit 8 Bit

Repeatability ±1°C

17

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Accuracy ±1°C ±2°C

Measurement 0ºC 50ºC


range

Response time 1/e(63%) 6 seconds 30 seconds


(seconds)

Table 2

3.43Typical application and connection:

Figure 6
The figure above shows how the DHT11 sensor will be connected to a microcontroller unit.

When the connecting cable is shorter than 20 metres, a 5K pullup resistor is recommended; when
the connecting cable is longer than 20 metres, an appropriate pullup resistor is selected as
needed. In this case, a 4.7K pullup resistor . The pullup resistor is important in that it ensures the
DHT11 input to the microcontroller is specified as HIGH according to the supply voltage
VCC/VDD even when the sensor is not switched ON or connected to the Arduino.

3.44 DHT11Arduino Uno R3 interfacing


The DHT sensor will multiplex the ambient temperature (in degrees Celsius) and the ambient
relative humidity inside the greenhouse through its digital output pin 2 to the Arduino Uno R3
microcontroller. For these measurements, the DHT library and then the digital pin 2 of the
microcontroller will initialize as the input for the DHT in the program.

To carry out the measurement of temperature and humidity, the DHT library has two functions:

DHT.temperature and DHT.humidity, which will transfer the recorded measurements to the
“temperature “and “humidity” variables of the program.

18

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

The Arduino Uno will read the values of these parameters from the DHT pin 2 using the
DHT.read11 () function.

During installation, the sensor will be placed within the greenhouse, at a suitable location away
from any dirt or dust that might clog the system. Preferrably, the sensor should be located at a
point halfway along the length of the greenhouse so as to have equal access to the conditions at
all extremes of the greenhouse.

However, the control circuit should be located at a distant location to avoid interference of the
sensitive circuit components by the prevailing and varying environmental conditions.

3.5 Capacitive moisture sensor


This is an analog capacitive soil moisture sensor which measures soil moisture levels

by capacitive sensing; i.e capacitance is varied on the basis of water content present in the soil.
The capacitance is converted into voltage level basically from 1.2V to 3.0V maximum. The
advantage of Capacitive Soil Moisture Sensor is that they are made of a corrosion-resistant
material giving it a long service life. It is perfect for low-voltage microcontroller with both 3.3V
and 5V power supply

19

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 7

3.51 Features & Specifications


1. Supports 3-Pin Sensor interface
2. Analog output
3. Operating Voltage: DC 3.3-5.5V
4. Output Voltage: DC 0-3.0V
5. Interface: PH2.0-3P
6. Size: 99x16mm/3.9x0.63″

There is a fixed frequency oscillator that is built with a 555 timer IC. The square wave generated
is then fed to the sensor like a capacitor. To a square wave signal that capacitor, however, has a
certain reactance, a resistance that forms a voltage divider with a pure ohm type resistor (the 10k
one on pin 3). The greater is the soil moisture, the higher the capacitance of the sensor.
Consequently, there is a smaller reactance to the square wave, thus lowering the voltage on the
signal line. The voltage on the Analog signal pin can be measured by an analog pin on the
Arduino which represents the humidity in the soil

3.52 Interfacing capacitive sensor with Arduino


Connect the VCC pin to 3.3V of Arduino and GND to GND. Similarly, connect the Analog
output pin to A0 pin of Arduino

20

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 8
3.6 16 x 2 LCD Display
An LCD (Liquid Crystal Display) screen is an electronic display module used in a wider range of
applications. These modules are preferred over seven segments and other multi segment LEDs.
This is because LCDs are economical; easily programmable; have no limitation of displaying
special & even custom characters (unlike in seven segments), animations and so on. A Liquid
crystal coating is the heart of the display which is sandwiched between two polarized glasses. A
16x2 LCD means it can display 16 characters per line and there are 2 such lines.

In this LCD each character will be displayed in 5x7 pixel matrix.

This LCD has two registers, namely, Command and Data. The command register stores the
command instructions given to the LCD. A command is an instruction given to the LCD
to do a predefined task like initializing it, clearing its screen, setting the cursor position,
controlling display etc.

The data register stores the data to be displayed on the LCD. The data is the ASCII value of the
character to be displayed on the LCD.

Since the LCDs horizontal's display is limited to only 16 characters at a go, the string used for
every instruction is restricted and that's why a notable string of abbreviations will be used, just to
pass the introductory message concerning the system.

3.7 Light Dependent Resistor (LDR)


The Light Dependent Resistor (LDR) will be used in this system for light intensity detection and
will be interfaced with the Arduino Uno microcontroller for control and regulation action. This
type of resistor basically generates an analogue electric current according to variations in the
surrounding light intensity.

A photoresistor or light dependent resistor (LDR) or photocell is a light controlled variable


resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in
other words, it exhibits photoconductivity. A photoresistor can be applied in lightsensitive
detector circuits, and light and darkactivated switching circuits. In this case, the photoresistor is
to be used to detect the variations in light intensity inside the greenhouse and through the micro-
controller, activates the switching on of a light bulb inside the greenhouse to allow proper plant
growth during the photosynthesis.

21

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 9
3.71 Construction
A photoresistor is made of a high resistance semiconductor. In the dark, a photoresistor can have
a resistance as high as a few megaohms (M), while in the light, a photoresistor can have a
resistance as low as a few hundred ohms. However, if incident light on a photoresistor exceeds a
certain frequency, photons absorbed by the semiconductor give bound electrons enough energy
to jump into the conduction band.

The resulting free electrons (and their hole partners) conduct electricity, thereby lowering
resistance. The resistance range and sensitivity of a photoresistor can substantially differ among
dissimilar devices. Moreover, unique photo resistors may react substantially differently to
photons within certain wavelength bands.

3.72 Design considerations


Photoresistors are less lightsensitive devices than photodiodes or phototransistors: the two latter
components are true semiconductor devices, while a photoresistor is a passive component and
does not have a PNjunction. The photoresistivity of any photoresistor may vary widely
depending on ambient temperature, making them unsuitable for applications requiring precise
measurement of or sensitivity to light.

Photoresistors also exhibit a certain degree of latency between exposure to light and the
subsequent decrease in resistance, usually around 10 milliseconds. The lag time when going
from lit to dark environments is even greater, often as long as one second. This property makes
them unsuitable for sensing rapidly flashing lights, but is suitable for gradually varying light
intensities.

3.73 Use of the LDR in this system


The LDR will be used for detection of light intensity in the greenhouse. A relay will be used to
provide electrical isolation between the Arduino Uno R3 circuit and the 240V AC greenhouse
backup lighting system.

As introduced before, if the intensity of light falling on the LDR is high, the LDR will have low
resistance. When the light intensity decreases, the LDR offers high resistance. Hence, there is an
inverse relationship between the intensity of light and resistance of the LDR.

22

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

The question that arises is how to measure resistance which in return can be used to calculate the
intensity of light. The Arduino Uno R3 board has 6 analog to digital converter channels and all
ADCs can measure voltage only. These channels cannot measure resistance directly.However,
resistance can be measured indirectly by converting it into voltage form using a voltagedivider
circuit. This is basically called signal conditioning and involves using a 4.7k resistor in series
with the LDR through a 5volt source. This way, the voltage measured across the LDR due to the
varying light intensity can be measured with the help of the analog to digital converters of the
Arduino Uno R3. This is a value that ranges from 0V to 5V and is assigned the variable “value”
in the control program.The analogue voltage, “value” is read from the analog input pin A0
through the code line.

The instruction:

digital=write (light, HIGH);

will be used to interface the Arduino Uno R3 with the relay and will send a control signal to
light up the greenhouse whenever the light intensity drops below a given threshold as defined in
the program. A similar instruction will also include to switch off the backup light when the
natural light is restored. This control signal is generated from digital pin 10 of the Arduino Uno
R3 which is to be used as the output pin and will be interfaced to the relay through the
ULN2003A Darlington Array chip.

Summary, the LDR will be interfaced with the Arduino Uno R3 as:

1. LDR pin 1 to the 5V pin on Arduino Uno R3.

2. LDR pin 2 to the analogue pin A0 on Arduino Uno.

3. LDR pi 2 to pin 1 of the 4.7k resistor.

4. Pin 2 of the 4.7k resistor to the Ground (GND) pin on Arduino Uno.

3.8 Relay System


A relay is a device which is used to provide connection between two or more points or devices in
response to the input signal applied. Relays provide electrical isolation between a lowvoltage
controller and a highvoltage device operating on AC voltage. Relays receive signals from a
microcontroller which works on DC and hence are required to bridge the gap.

3.81 Working of Relays


Considering the diagram below, when power is supplied to the input, a relay current will start
flowing through the control coil and as a result, the electromagnet starts energizing. Points A, B
and C are used as control points. When power is applied to the input terminals, due to
electromagnetic effect, points B and C (the Normally Open contact) are connected and this
closes the contacts completing the circuit for the power to the load.

23

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Deenergizing the relay deenergizes the electromagnet and this makes the contact move in the
opposite direction and opens the load's power circuit. Thus, when power supply is cut off point A
and C are reconnected; this is the normally closed contact of the relay. This force is mainly
provided by two factors they are spring and gravity.

Below is an example of how the connections are made to a load in a circuit using a SPDT relay
switch?

Energized relay position

Figure 10

3.82 Connection of an SPDT Relay to Load


Figure 11
When the relay coil is energized, contact is established between the common (COM) and
normally open (NO) terminal thereby completing the supply connections to the load. Hence, the
load is switched “on” when the relay is energized.

In this system, two relays will be employed which will serve as electrical isolators between the
electronic control circuit and the electrical parameter regulatory circuit.

24

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

For the misting system electrical circuit, the ULN2003A outputs a 12V DC signal to the relay
number one through output pin 16. This will activate the misting system, which will be used to
lower the ambient temperature and lower the relative humidity whenever the set range is not met.

For the backup greenhouse lighting system, the ULN2003A will also output a 12V DC control
signal through its output pin 15 in the event the light intensity varies out of the desired level.

3.9 Cooling system


From the relay, there's an electrical circuit to a cooling system. Basically I will be using a fan
which is driven by a 5V relay module. When temperature exceeds a certain level, the cooling fan
will be activated to maintain the desired temperature in the greenhouse. As this is a prototype, in
normal greenhouses a fog cooling system which is driven by a pressure pump using a 12V relay
module can be used.

The control signal from the microcontroller will activate the switching relays any time the
temperature and/or humidity levels go off the desirable range. This 5V DC relay in turn will
switch on a cooling system circuitry. Thus, as long as the desired parameters fall out of range,
the cooling system will be automatically switched to properly condition the greenhouse as
desired.

3.10 Backup lighting system


Light intensity is a key factor in the growth of any green plants. This is because plants require
light during the photosynthesis process through which plants form carbohydrates using oxygen,
water, mineral salts and light. As such, for any greenhouse to be effective there should be proper
supply of light to ensure efficiency in the plants' photosynthesis process.

A greenhouse should be able to provide the necessary conditions for the plants at all times. There
can be seasons or times when the plants are in the process of fruit formation or during their
flowering stages and during which none of the conditions should be interfered with to ensure
maximum output. Such are the situations when the ambient light intensity has to be maintained
even during the night when there is no natural light supply for the sun. For this reason this
system will have a provision for switching on a backup lighting system in the event the light
intensity falls below optimum level.

3.11 Irrigation system


In this project I will be using a capacitive soil moisture sensor which senses the amount of
moisture in the soil. If the soil moisture falls beyond a certain limit, a pump powered by a 12V
power supply will be activated. This pump can be connected to the drip system and will water
the plants until the required moisture level is reached. Just like the cooling system and the
backup lighting system, the pump is activated by a 5V relay system.

25

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

26

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

CHAPTER 4: TESTING, RESULTS AND DISCUSSION

4.1 Introduction
The designed circuit is implemented and tested in this chapter. First, the different modules to be
used in constructing the security system are tested to ensure that they function as required. For
testing the circuit is built on a breadboard. Putting the circuit on a breadboard is advisable as you
can easily identify a faulty component and replace it. Also, it is easy to make changes on the
circuit compared to one which is mounted on a copper board. Once the circuit is tested and
works as desired, it is fabricated on the PCB.

4.2 Construction and testing

The components used for the construction of the automated greenhouse control system are
DHT11 sensor, capacitive soil moisture sensor, LDR sensor, LCD, LDR lights, Arduino Uno
Microcontroller, 4 module relay, resistor and connectors. The test circuit is split into sections
including, the power supply section, the relay section, the arduino section and the sensor section.

4.21 Testing
After successful fabrication of the hardware components and compilation of the software, the
hardwaresoftware integration, testing and troubleshooting of the system is done. The integration
procedure basically involves connecting the microcontroller to the computer programming
interface and uploading the code into the microcontroller through the Arduino IDE.

After this, testing of the system is done, which involves:

Verification – this involves finding out if I constructed the correct system, whether the system is
capable of satisfying the requirements outlined in the objectives at the beginning of this report.
A number of experimental tests is conducted to verify that indeed the system is capable of
measuring the present temperature, relative humidity & light intensity and soil moisture, analyze
the values and generate the appropriate control signals required. This test also includes using a
simulated cooling system to control the ambient temperature and relative humidity, and also
using a backup lighting system to give light when needed, and a pump for irrigation and the
results is indeed positive.

Validation – this involveds finding out if the design has been constructed correctly by checking
that all system specifications has been met. A thorough analysis of both the software and
hardware used is done, with the actual values of the hardware components. The efficiency of the
system in terms of its speed of response and flexibility is also tested

27

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Test point Voltage Voltage


input output

DHT11 5V

Capacitive 5V
sensor

LDR 5V
sensor

Table 3

Figure 12

28

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

4.3 Results and Discussion


- When temperature is increased above 40oC using the DHT11 sensor, the LED lights up
and the fan starts to run in order to reduce the temperature to a desirable level. The
DHT11 sensor is a negative temperature coefficient transducer, which simply means that
its output voltage varies inversely with temperature. Therefore, as the temperature inside
the greenhouse increases, there is a variation in the output voltage, which is
correspondingly interpreted by the microcontroller and translated into the desired control
action. Moreover, it should be noted that increase in the ambient temperature leads to a
drop in the level of relative humidity inside the greenhouse.
- The capacitive soil moisture sensor is used to sense the amount of moisture in the soil.
The results from the sensor are displayed in the LCD. In this system, its designed such
that when the moisture falls below a value of 50, a pump is activated which irrigates the
crops. The minimum preset value for which to activate a pump can be changed according
to seasons, different stages of crop growth and depending on the type of crop grown.
- The LDR sensor is used to measure the amount of light in the greenhouse and displays
the value on the LCD. In this system, it is calibrated such that when the light falls below
50 the relay turns on the back up lighting system. This way the lighting in the greenhouse
can always be maintained as required.

Below are some of the images I took:


For back up lighting system the preset value is 60%, below this value back up light should be on,
in this project I used the red light of the LED to indicate back up light needed.

Figure 13 `
If the light detected by the LDR sensor detects a light above 60% then the red light of the LED
goes off indicating that there is already plenty of light in the green house hence no need for back
up light.

29

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 14

For temperature a preset value of 40oc has been set meaning if the temperature sensed by the
DHT11 within the greenhouse is below 40c then the green light of LED is off and the cooling fan
is not running.

30

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 15
If the temperature in the green house goes beyond 40oc, which is the preset value, then the green
light of the LED is on and hence the cooling fan is activated to lower the temperature to a
desirable level.

Figure 16
For back up lighting system the preset value is 60%, below this value back up light should be on,
in this project I used the red light of the LED to indicate back up light needed.

Figure 17

If the light detected by the LDR sensor detects a light above 60% then the red light of the LED
goes off indicating that there is already plenty of light in the green house hence no need for back
up light.

31

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

Figure 18

32

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

CHAPTER 5: CONCLUSION

5.1 Review of objectives


At the beginning of this report, I outlined a number of objectives of my design project. Here, I
present a review of the same against my design and findings, just to see how best I have fared in
achieving them. These included:

1. To implement automatic greenhouse temperaturemonitoring and control using the


DHT11basic sensor and Arduino Uno R3 microcontroller.

This objective has been achieved using the DHT11 sensor which is able to record the
temperature as it changes. The control action is also provided by the microcontroller generating a
5V dc signal that activates the cooling system to lower temperatures.

2. To implement a system that measures and regulates the light intensity inside the greenhouse
to ensure a given minimum level is maintained. This utilizes a relayactivated backup lighting
system.

Using LDR, the system records the light intensity in the greenhouse and relays the same to the
microcontroller. The microcontroller compares this against a preset minimum value and
generates a control voltage to the relay.

3. To come up with a system that checks on the amount of moisture in the soil which activates a
water pump for irrigation system.

This is achieved by the use of a capacitive soil moisture sensor which measures the amount of
moisture in the soil and compares it against a preset value and activates a 5V relay which in turn
turns on a water pump for irrigation

5.2 Problems encountered


Some of the challenges encountered while working on this project include:

1. High cost of acquiring the required components to fully implement the system. This is
why I had to use LED to indicate back up lighting has been activated since I was required
to use a 240V back up lighting system which was challenging to acquire. I also had to use
a cooling fan instead of a fog cooling system since it was hard to acquire one.
2. Working alone has been a challenge as I had to do all the tasks alone, which included
getting the system specification, writing the software, obtaining the circuit components,
integrating the hardware and software,testing the system and finally preparing the report.
I had to spend chunks of time alone, just to get things done.

33

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

3. I had to do most of my tests in an environment outside an actual greenhouse due to the


long distance from the targetarea greenhouses.
4. As the NPK sensor was quite expensive and not available within the country, I had to do
away with it and work on three objectives only.

5.3 Recommendations
This are some activities that can be done to improve the efficiency and functionality of the this
system.

1. Incorporation of the soil nutrient check system and control components of the hardware
circuitry.

2. Incorporation of a GSM module into the system to generate and send regular updates to the
system's user concerning the various control actions taking place in his greenhouse.

3. Further tests should be carried out on the system using actual misting/fogcooling systems to
test on the speed of response of the system.

34

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

5.4 Program code

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

#include "DHT.h"

LiquidCrystal_I2C lcd(0x27, 16, 2);

int BP = 8, MS = 9, CF = 10, S1 = 7, red = 4, green = 5, blue = 6;

#define sensorPin A0

#define DHTPIN 2

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

float moistureValue, sensorValue, ldrStatus, LightIntesity;

const int ldrPin = A2;

int button = 1;

int ledState = HIGH;

int buttonState;

int lastButtonState = LOW;

unsigned long lastDebounceTime = 0;2.

unsigned long debounceDelay = 50;

void setup() {

Serial.begin(9600);

dht.begin();

lcd.init();

lcd.backlight();

lcd.begin(16, 2);

35

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

lcd.print(" GREENHOUSE");

lcd.setCursor(0, 1);

lcd.print(" CLIMATE CONTROL");

delay(2000);

lcd.clear();

pinMode(ldrPin, INPUT);

pinMode(BP, OUTPUT);

pinMode(MS, OUTPUT);

pinMode(CF, OUTPUT);

pinMode(red, OUTPUT);

pinMode(green, OUTPUT);

pinMode(blue, OUTPUT);

pinMode(S1, INPUT_PULLUP);

void loop() {

int reading = digitalRead(S1);

if (reading != lastButtonState) {

lastDebounceTime = millis();

if ((millis() - lastDebounceTime) > debounceDelay) {

if (reading != buttonState) {

buttonState = reading;

if (buttonState == HIGH) {

ledState = !ledState;

36

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

lastButtonState = reading;

sensorValue = analogRead(sensorPin);

moistureValue = (map(sensorValue, 0, 1023, 100, 0) * 100 / 32);

ldrStatus = analogRead(ldrPin);

LightIntesity = map(ldrStatus, 0, 1023, 0, 100);

float h = dht.readHumidity();

float t = dht.readTemperature();

if (isnan(h) || isnan(t)) {

lcd.print("DHT Failed!");

delay(2000);

lcd.clear();

return;

if (digitalRead(S1) == LOW) {

if (button == 1) {

button = 2;

if (button == 2) {

button = 1;

if (ledState == HIGH) {

37

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

lcd.setCursor(0, 0);

lcd.print("HUMI : " + String(h) + " % ");

lcd.setCursor(0, 1);

lcd.print("TEMP : " + String(t) + " C ");

if (ledState == LOW) {

lcd.setCursor(0, 0);

lcd.print("LIGHT: " + String(LightIntesity) + " % ");

lcd.setCursor(0, 1);

lcd.print("MOIST: " + String(moistureValue) + " % ");

// Serial.print(moistureValue);

// Serial.print(" ");

// Serial.print(ldrStatus);

// Serial.println(" ");

if (LightIntesity <= 60) {

digitalWrite(BP, LOW);

digitalWrite(red, HIGH);

} else {

digitalWrite(BP, HIGH);

digitalWrite(red, LOW);

if (moistureValue <= 60) {

digitalWrite(MS, LOW);

38

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

digitalWrite(blue, HIGH);

} else {

digitalWrite(MS, HIGH);

digitalWrite(blue, LOW);

} if (t >= 40 && h <= 100) {

digitalWrite(CF, LOW);

digitalWrite(green, HIGH);

} else {

digitalWrite(CF, HIGH);

digitalWrite(green, LOW);

39

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

References

Ainsworth, E. A. 30 years of free‐air carbon dioxide enrichment : what have we learned about
future crop productivity and its potential for adaptation? Global Change Biology.

Arbel, A. O. Performance of a fog system for cooling greenhouses. Journal of Agricultural


Engineering Research, 1999.

Barrett, S. F. Synthesis Lectures on Digital Circuits and Systems. 2013.

Ganeshamurthy, A. N. Nutrient management in horticultural crops. Indian Journal of Fertilisers,


2015.

Hornum, S. T. A functional analysis of the role of input suppliers in an agricultural innovation


system. nairobi, 2021.

Kulcheski, F. R. NPK macronutrients and microRNA homeostasis. Frontiers in plant science,


2018.

palwak, k. M. The role of agriculture in ensuring food security in developing countries, 2020.

Papadakis, G. B.. Review Paper (SE—Structures and Environment): Radiometric and thermal
properties of, and testing methods for, greenhouse covering materials. Journal of
Agricultural Engineering Research, 2000.

Srivastava, D. A. Measurement of Temperature and Humidity by using Arduino Tool and


DHT11. International Research Journal of Engineering and Technology (IRJET), 2018.

Zabeltitz, C. V. Greenhouse structures. Springer, Berlin, Heidelberg, 2011.

40

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

APPENDIX

WORK PLAN
ACTIVITIES FEB MAR APR MAY JUN JULY AUG SEPT OCT NOV
CHAPTER 1
INTRODUCTION
CHAPTER 2:
LITERATURE
REVIEW
CHAPTER 3:
METHODOLOGY
PURCHASING OF
MATERIALS
FABRICATION AND
TESTING
CHAPTER 4:
RESULTS AND
ANALYSIS
CHAPTER 5:
RECOMMENDATION,
CONCLUSION AND
CHALLENGES
CHAPTER 6:
REFERENCES AND
APPENDIX

PROJECT
PRESENTATION

41

Downloaded by joshua maina (jbmaina100@gmail.com)


lOMoARcPSD|39118440

PROPOSED BUDGET

COMPONENTS QUANTITY PRICE


LED 1 150
LCD 1 400
DHTI1 SENSOR 1 300
CAPACITIVE SENSOR 1 200
ARDUINO UNO 1 1700
MICROPROCESSOR
BREAD BOARD 1 400

LDR 1 150
JUMPER WIRES 1 150
WATER PUMP 1 1200
COOLING FAN 1 160
12V POWER SUPPLY 1 650

5V CHANNEL RELAY 1 350


MODULE
PUSH BUTTON 1 10
TOTAL 5820

42

Downloaded by joshua maina (jbmaina100@gmail.com)

You might also like