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

Final year project thesis June, 2016

CHAPTER ONE

1 INTRODUCTION

1.1 Background

In agriculture, one of the most important jobs is to watering the farming land. Most of the
farmers use the manual control over the land that is to monitor the pumping or watering the land
by visiting the site. This will surely need more and more labor and as a result the efficiency of
work may be degraded. An automatic system can be developed to monitor all the controlling
operation. Automatic control system reduces the human labor and increase the efficiency of the
corresponding work. In this paper, an automatic control system is introduced for watering the
land by measuring the humidity or in other word the temperature. The system measures the
humidity of the soil and depending upon the condition it will provide the needed water in the
land. There are a number of systems introduced to enhance the agriculture system by providing it
with various autonomous control systems. The agriculture technique has been developed day to
day all over the world and so the agriculture engineering has been enhanced gradually to serve
the world with more integrated and efficient system. It will sense the humidity in a continuous
fashion. There is a sensor included in this system which senses the humidity and sends the record
to the Microcontroller. The pumps are connected with the system relay circuit. There are two
conditions are set in between which the pump will be ON or OFF. When the water supply is
needed, Microcontroller sends digital pulse to the system to enable the relay circuit and the water
will be supplied till the time the pump will be ON. So, in this system no manual control is
needed to control the overall process.

The control system was designed with aim of reducing power consumption and also the cost
of overall design. The system was built with single chip ARDUINO UNO R3 microcontroller
and POT-HG used as a sensor and control circuits for opening/closing the Relay for water flow.
The actions taking place and problems encountered in the water flow is controlled by the system.

Hawassa university, IOT School of Electrical and Computer Engineering Page 1


Final year project thesis June, 2016

The system with ATmega32 as main controller interfaced with the motor by counting the
number of rings and humidity condition of the soil by using sensor. This project also includes the
project micro controller based automatic liquid level controlling system is design to monitor the
level of water in the tank.
The system basically operated with micro controller. Automatic water pump and level
controller are equipments used to control the water level in the tank. The level is controlled by
using a switch used as a sensor which inserted inside a tank and microcontroller. Main
components are switch, micro controller, power supply, and LCD display, pump motor etc. The
switch sensors sense the presence of water and give indication to microcontroller. The
microcontroller produces the control signals to drive the motor. If there is insufficient water in
the overhead tank then microcontroller gives control signal to start the motor and if there is
sufficient water in the over head tank then the microcontroller gives control signal to stop the
motor. And also the microcontroller enables the output display on the LCD. Hence the level of
liquid in over head tank can be automatically controlled. Moreover, the common method of level
control for home appliance is simply to start the feed pump at a low level and allow it to run until
a higher water level is reached in the water tank the desired level of liquid in tank/container, i.e.,
it switches on the pump (motor) when the liquid level in the tank/container goes below a
predetermined maximum level and switches it off as soon as the water level reaches the pre-
determined maximum level in the tank/container to prevent it from overflowing, thus maintains
the water level at a fixed level always. Generally switch ON the pump when their taps go dry
and switch OFF the pump when the overhead tank starts overflowing. This results in the
unnecessary wastage and sometimes non availability of water in case of emergency. Here a
circuit is designed which can make this system automatic, i.e. it switches ON the pump when the
level in the overhead tank goes low and switches it OFF as soon as the water level reaches a pre-
determined level. Water Level Controller employs a mechanism to detect and maintain the water
level in a tank or any other container by switching it ON/OFF the motor automatically when
needed. The level sensing is done by sensors which are placed at different levels on the tank
wall. Hence this water level controller is one of the cheapest & simplest devices which prevent
wastage of both electricity and water.

Hawassa university, IOT School of Electrical and Computer Engineering Page 2


Final year project thesis June, 2016

1.2 statement of the problem

There are many reasons and problems which motivate us to seek for solutions and
suggestions.
The majority of the farmers need to travel to the field every time to switch on/off the motor,
hence wasting time. With the proposed work, the worker can save his time by turning on/off the
motor automatically. Also the system switches off the motor automatically when the moisture
level of the soil has reached a sufficient value.
Today, most of the liquid like water tank users in agricultural have replaced conventional
pump with electrical pumps. But they find it very inconvenient for the condition of water or
liquid pump because there is no effective liquid level indication system. As a result, if
mechanical sensor fails, there are a plenty of water waste as well as wastage of power consumed
by motor pump. Solution of this problem is automatic liquid tank level controller using liquid
level sensor and arduino microcontroller .

1.3 Project Objective

1.3.1 General Objective.

 The main aim of this project is to monitor and record the values of humidity of natural
environment and to pump the plants water at required humidity level in order to achieve
maximum plant growth and yield.
 The main purpose of this project is also to automate the data acquisition process of the
soil condition and various parameters that governs plant growth allows information to be
collect at high frequency with less labor requirements.
 In addition our project is also to include to build microcontroller based an automatic

Liquid level controlling system.

Hawassa university, IOT School of Electrical and Computer Engineering Page 3


Final year project thesis June, 2016

1.3.2 Specific Objective


 The system monitoring water management.
 The system checks the temperature, humidity.
 To save time and power consumption.
 To design arduino microcontroller based an automatic liquid level monitoring and
controlling system
 To develop and integrate the building block of liquid level controller.

1.4 Significance of the project

Any project aim is to solve a problem and find the way to simplifies people‟s life. Similarly,
design of office appliance for efficient use of electricity play important role in minimizing risk which
comes through wastage of power and lead our people to use traditionally unbelievable technology in
which device is simply controlled by arduino microcontroller. Not only that we got many experience
and knowledge while doing the project. Surely speaking it gives us hope and confidence in our field
of specialization.

1.5 Scope of project


In the recent days the agriculture is very much developing and so the farmers also need
some special feature of the systems that are currently used for it. Automatic pumping system is
one of the useful systems in the agriculture. It will supply water just when it is needed. So, one
part of labor can be operated by the machine itself and so the efficiency of the farming will be
increasing and as the system is dependent on the humidity value of the soil, so there no overflow
or underflow of water in the agriculture ground. The system can also be used apart from the
agriculture.
The project also is design to automatically control the the liquid level of the tank and the motor
pump, which ensures continuous liquid flow to the tank and we specify that the motor will pump
until the overhead tank is full.

Hawassa university, IOT School of Electrical and Computer Engineering Page 4


Final year project thesis June, 2016

The scope of the design and simulation is keep concise and simple. In other way this project
mostly concerned with not to introduce unnecessary complexities and render it generally
uncomfortable.

1.6 project organization

This project report is organized into five chapters:


 Chapter one gives the introduction to the project, the project background, statement of
problem, objectives and the scope.
 Chapter Two is the literature review which describes the system and compares the
earliest pumping and water tanker controller.
 Chapter Three gives a complete technical aspect of the design (hard ware and software
design).
 Chapter Four contains Result analysis of the project.
 Chapter Five gives the conclusion of the whole project, if the objective and scope of the
project were achieved and recommendation. This chapter also includes appendices and
the references used.

Hawassa university, IOT School of Electrical and Computer Engineering Page 5


Final year project thesis June, 2016

CHAPTER TWO

2. LITERATURE REVIEW OF PROJECT

A controller based automatic plant irrigation system was designed by Gunturi (2013). The
main aim of the research was is to provide automatic irrigation to the plants with a system that
operates with less manpower. This in turn helps to save funds and water. The researcher
programmed the Arduino microcontroller as giving the interrupt signal to the sprinkler, and this
was used to control the entire system. Temperature sensor and humidity sensor were connected
to internal ports of the microcontroller via a comparator, and whenever there is a change in
temperature and humidity of the surroundings these sensors senses the change in temperature and
humidity and gives an interrupt signal to the micro-controller and thus the sprinkler is activated.
It was the position of a paper by Hodgson and Walter that based on real world systems as the
benchmark, using optimization software in place of traditional design techniques results in
significant cost savings. The researchers discussed the potentials of modern optimization
technology to the pumping industry and presented examples of cost-saving design experiences.

On the other hand Khaled Reza el al., (2010) introduced the notion of water level
monitoring and management within the context of electrical conductivity of the water. The
authors motivated by the technological affordances of mobile devices and the believe that water
level management approach would help in reducing the home power consumption and as well as
water overflow; investigated the microcontroller based water level sensing and controlling in a
wired and wireless environment. The research result was a flexible, economical and easy
configurable system designed on a low cost Arduino microcontroller and finally, proposed a web
and cellular based monitoring service protocol to determine and senses water level globally.

Rojiha (2013) analysed this existing oil-pumping system and discovered that they have a
high power-consuming process and needs more manual power. He then proposed a sensor
network based intelligent control system for power economy and efficient oil well health
monitoring.

Hawassa university, IOT School of Electrical and Computer Engineering Page 6


Final year project thesis June, 2016

Several basic sensors were used for oil well data sensing, and the sensed data was given to
the controller which processed the oil wells data and it was given to the oil pump control unit
which controls the process accordingly. If any abnormality is detected then the maintenance
manager is notified through an sms via the GSM. This system allowed oil wells to be monitored
and controlled from remote places.The easy way to comply with the conference paper formatting
requirements is to use this document as a template and simply type your text into it. A range of
level control systems and methods are used in industry. Systems may be based on the use of
floats, probes or sensor. Level control is one of continuous process that can be treated as an
integrating process. The level controller can be applying on temperature control, pressure
control, and water control.

The level controller is used with electrical probes or sensors. The electrical probes are used
with power supply and motor. The probes will put inside the tank and the motor will pump as the
water goes down. The probes will detect the level of the water and on/off the motor.

The level controller which are using water sensor will sense the low and high level of water
in water tank. If the water was low, the motor will pump the water and will stop to pump water
after the high level reached. Automatic Water level Controller can be used in Hotels, Factories,
Homes Apartments, Commercial Complexes, Drainage,and agricultural lands etc. Automatic
water level controller will automatically START the pump1 set as soon as the water level falls
below the predetermined level and shall SWITCH OFF the pump set as soon as tank is full.

Electronics circuit has undergone tremendous changes since the invention of a triode by Lee
De Forest in 1907. In those days the active component likes resistors, inductors and capacitors
etc. Of the circuit were separated and distinct unite connected by soldered lead with the invention
of a transistor in 1984 by W.H Brattain and I.barden, the electronic circuit became considerably
reduced in size. It was due to the fact that transistors were not only cheaper, more reliable and
less power consumption but was much smaller in size than an electronic tube. To take advantage
of small transistors size, the passive component too were reduce in size there by making the

Hawassa university, IOT School of Electrical and Computer Engineering Page 7


Final year project thesis June, 2016

entire circuit very small development of printed circuit board(PCB) further reduce the size of
electronics equipment by eliminating bulky wiring and tie point.

In the early 1960s a new field of micro-electronics was born primarily to meet the
requirement of the military which was to reduce the size of it electronics equipment to
approximately one tenth of it then existing volume.
The drive extreme reduction in the size of electronic circuit has lead to the development of
micro-electronics circuit called integrated circuit (ICS) which are so small than their actual
construction is done by technicians Using high powered microscopes. An integrated circuit is a
complete circuit in which both the active and passive component are fabricated in on a tiny
single chip of silicon, Active component are those which have the ability to produce gain
example are transistors and field effect transistors (FET). An integrated circuit sometimes called
a chip or microchip is a semi-conductor wafer on which thousands of millions of tiny transistors,
capacitors are fabricated, An IC can be either analog digital depending on its intended
application.
Many earlier works dealt with various techniques of monitoring and controlling of liquid
levels in industrial and domestic applications. Broadly this automatic control problem can be
achieved under two means: mechanical methods and electrical methods. Float ball type liquid
level control is a popular method of control still used in practice for normal applications such as
overhead tank overflow restrictors etc. The electrical methods of control include a micro
controller -based circuits which automatically predict the liquid levels and accordingly active the
circuit to operate motors. In spite of several such available methods, still there are new
techniques in this application so as avoid dangerous operating conditions in industrial boilers.
Tan: - proposed a water level control system for nuclear steam generator. The control system
consisted of a feedback controller and a feed forward controller. The robustness and performance
of both the controllers are analyzed and tuning of the parameter of the controllers. It is shown
that the proposed gain scheduled controller can achieve good performance at high and low power
levels.

Hawassa university, IOT School of Electrical and Computer Engineering Page 8


Final year project thesis June, 2016

Safarzadeh: - presented a water level control system for horizontal steam generators using the
quantitative feedback theory.

Moradi: - proposed a control strategy to achieve desired tracking of drum water level. Transfer
function between drum water level (Output) and feed water vs. steam mass rate were considered.

Maffezoni:-highlighted the principal dynamic phenomena which determine the structuring of


boiler-turbine control systems, clarifying the essential connections of such phenomena with the
physical nature of the process.

Zhang and Hu:-proposed the water level control system using PI controllers. Zhang: - analyzed
the water level control of pressurized water reactor nuclear power station using PID and fuzzy
controllers.

Ansarifar:-proposed an adaptive estimator based dynamic sliding mode control method for water
level control.

Liu: - presented a proportional controller with partial feed forward compensation and
decoupling control for the steam generator

Hawassa university, IOT School of Electrical and Computer Engineering Page 9


Final year project thesis June, 2016

CHAPTER THREE

3. HARDWARE DESIGN AND SOFTWARE DEVELOPMENT

The system consists of hardware and software. The hardware part involves Arduino Uno R3
microcontroller, motor pump, moisture sensor, Relay, level sensors (switches) and power supply.
The software part is the Arduino Board is programmed using the Arduino IDE software used to
interface hardware. The Arduino Based Automatic model atomization of agricultural
environment for social modernization of agricultural system will be made in the following steps:
 Complete layout of the whole setup will be drawn inform of a block diagram.
 Day and night sensor will first sense the condition and give its output to the Arduino
microcontroller & displayed on the LCD
 The soil condition is checked by moisture sensor, depending upon the soil condition &
water level, water pump motors are turned on or off depending the conditions.

3.1 Hardware design

There are many methods of designing Arduino based automatic humidity monitoring and
pumping system. The brief explanation will present as follows. The system has three major parts;
humidity sensing part, control section and the output section.
The basic operation of control unit is the controlling water pump by arduino which is
programmed by particular program. Water pump are connected with an output pin of arduino via
a relay circuit which is connected with a transistor.
The soil humidity was detected using moisture sensor. The control unit was achieved using
ATMega328 microcontroller based on arduino platform. The output was the control unit was
used to control the system by switching it on and off depending on the soil moisture contents.
Two stages of design were undertaken; hardware and software.

Hawassa university, IOT School of Electrical and Computer Engineering Page 10


Final year project thesis June, 2016

Power Level
supply sensor

Water
Reservoir
tanker

Relay Motor1/pump
LCD ARDUNIO UNO 1
Display R3 (MCU)

Relay Motor2/pump
2

Water
Moisture sprinkler
Plants
sensor

Fig 3.1 over all block diagram of the system

3.2 Working principle of block Diagram


The power supply provides power to the Arduino, to the relay and motor pump. The
Arduino Uno used to control the motors. Follow the schematic to connect the Arduino to the
relay motor driver, and the driver to the water pumps. The motors can be driven by a 10-12volt
power sources. The Arduino Board is programmed using the Arduino IDE software. The water
sprinkler or in other word water tube used to transmit water to the plant land. The moisture
sensor measures the level of moisture in the soil and sends the signal to the Arduino if watering
is required. The motor/water pump supplies water to the plants until the desired moisture level is
reached.

Hawassa university, IOT School of Electrical and Computer Engineering Page 11


Final year project thesis June, 2016

On the other hand the level sensor measures the level of water inside the tanker and sends
the signal to the arduino if water empty inside the tanker.
In this project an automatic water level control for overhead tank with switching device is
designed using electronic control to refill the water without human intervention.

Fig3.2Typical liquid level control system

The system design was carefully arranged to refill the water tank when the water is get empty
to a certain level. Also the system automatically shut down the water pump by putting the
electric pump OFF when the tank is high or full. The approach used in this work is the modular
design approach the overall design was broken into function block diagrams. Where each block
in the diagram represents a section of the circuit that carries out a specific function.

The system was designed using functional blocks as shown in the block diagram bellow in
this method the circuit is designed to display four different level using three switches as a
sensors that inserted inside the tank in different places to monitor the inflow and outflow of
water in the tank.

This project designed for automatic water level controller for overhead tank with switching
device. The conventional irrigation methods like overhead sprinklers, flood type feeding systems
usually wet the lower leaves and stem of the plants. The entire soil surface is saturated and often
stays wet long after irrigation is completed. Such condition promotes infections by leaf mold
fungi.

Hawassa university, IOT School of Electrical and Computer Engineering Page 12


Final year project thesis June, 2016

The flood type methods consume large amount of water and the area between crop rows
remains dry and receives moisture only from incidental rainfall. Water is supplied frequently,
often daily to maintain favorable soil moisture condition and prevent moisture stress in the plant
with proper use of water resources.

The automatic pumping system requires about half of the water needed by sprinkler or
surface irrigation. Lower operating pressures and flow rates result in reduced energy costs. A
higher degree of water control is attainable. Plants can be supplied with more precise amounts of
water.

Components of Arduino Based automatic humidity monitoring and pumping system


The components are listed as follows: -
 motor Pump
 Water Filter
 Relays
 Soil moisture Sensors
 Level sensors
 Tanker
 Arduino Uno R3 microcontroller (The brain of the system)

3.3 Component used Description


This project uses Arduino Uno to controls the motors (Pumps). Follow the schematic to
connect the Arduino to the motor driver, and the driver to the water pump. The motor can be
driven by a 10-12volt power sources. The Arduino Board is programmed using the Arduino IDE
software. The moisture sensor measures the level of moisture in the soil and sends the signal to
the Arduino if watering is required. The level sensor measures the level of water in the soil and
sends the signal to the Arduino if the tanker is empty. The motor1 supplies water to the plants
until the desired water level is reached.

Hawassa university, IOT School of Electrical and Computer Engineering Page 13


Final year project thesis June, 2016

The motor/water pump2 supplies water to the plants until the desired moisture level is reached.
All components are used in this project described as follow.

3.3.1 ARDUINO UNO R3


Arduino is an open-source physical computing platform based on a simple microcontroller
board, and a development environment for writing software for the board. Arduino can be used
to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling
a variety of lights, motors, and other physical outputs. The boards can be assembled by hand or
purchased preassembled; the open-source IDE can be downloaded for free. The Arduino
programming language is an implementation of Wiring, a similar physical computing platform,
which is based on the Processing multimedia programming environment.
This project uses Arduino Uno to controls the motor. Follow the schematic to connect the
Arduino to the motor driver, and the driver to the water pump. The motor can be driven by a 10-
12volt battery, and current measurements show us that battery life. The Arduino Board is
programmed using the Arduino IDE software. The moisture sensor measures the level of
moisture in the soil and sends the signal to the Arduino if watering is required. The motor/water
pump supplies water to the plants until the desired moisture level is reached.

Performance
 Digital I/O 0~13.
 Analog I/O 0~5. (R3 is 0~7)
 Input voltage: when connected to the USB without external power supply or external 5 v
output and external power input.
 Arduino size: width of 70 mm X high 54 mm.
Special Port
1. 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). You can supply
voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
2. AREF. Reference voltage for the analog inputs. Used with analog Reference.

Hawassa university, IOT School of Electrical and Computer Engineering Page 14


Final year project thesis June, 2016

Fig 3.3 Arduino Uno R3

The table below shows arduino specifications

Feature Specification
Microcontroller RTmega328p
Operating voltage 5v
Input voltage 7-12v
Digital I/O pins 14(of 6 provide PWM output)
Analog Input pins 6
DC current per I/O pin 40mA
DC current for 3.3v pin 50mA
Flash Memory 32KB(ATmega328) of which 0.5KB
Clock Speed 16MHz

Table1. Arduino Specifications

Hawassa university, IOT School of Electrical and Computer Engineering Page 15


Final year project thesis June, 2016

The ATmega328P is a low-power CMOS 8-bit microcontroller based on the AVR


enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the
ATmega328P achieves throughputs approaching 1 MIPS per MHz allowing the system designed
to optimize power consumption versus processing speed The ATmega328P provides the
following features: 4K/8K bytes of In-System Programmable Flash with Read-While-Write
capabilities, 23 general purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial programmable
USART, a byte-oriented 2-wire Serial Interface, an SPI serial port, a 6-channel 10-bit ADC and
five software selectable power saving modes. The Idle mode stops the CPU while allowing the
SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI port, and interrupt system to
continue functioning.
The Power-down mode saves the register contents but freezes the Oscillator, disabling all other
chip functions until the next interrupt or hardware reset. In Power-save mode, the asynchronous
timer continues to run, allowing the user to maintain a timer base while the rest of the device is
sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except
asynchronous timer and ADC, to minimize switching noise during ADC conversions. In Standby
mode, the crystal/resonator Oscillator is running while the rest of the device is sleeping. This
allows very fast start-up combined with low power consumption. The AVR core combines a rich
instruction set with 32 general purpose working registers. All the 32 registers are directly
connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be
accessed in one single instruction executed in one clock cycle.

Hawassa university, IOT School of Electrical and Computer Engineering Page 16


Final year project thesis June, 2016

Fig 3.4 ATmega328P

3.3.2 RELAY
A relay is usually an electromechanical device that is actuated by an electrical current. The
current flowing in one circuit causes the opening or closing of another circuit. Relays are like
remote control switches and are used in many applications because of their relative simplicity,
long life, and proven high reliability. Relays are used in a wide variety of applications
throughout industry, such as in telephone exchanges, digital computers and automation systems.
Highly sophisticated relays are utilized to protect electric power systems against trouble and
power blackouts as well as to regulate and control the generation and distribution of power.
Although relays are generally associated with electrical circuitry, there are many other types such
as pneumatic and hydraulic. Input may be electrical and output directly mechanical, or vice
versa.
Working Principles of RELAY: All relays contain a sensing unit, the electric coil, which is
powered by AC or DC current. When the applied current or voltage exceeds a threshold value,
the coil activates the armature, which operates either to close the open contacts or to open the
closed contacts.

Hawassa university, IOT School of Electrical and Computer Engineering Page 17


Final year project thesis June, 2016

When a power is supplied to the coil, it generates a magnetic force that actuates the switch
mechanism. The magnetic force is, in effect, relaying the action from one circuit to another. The
first circuit is called the control circuit.
There are three basic functions of a relay: On/Off Control, Limit Control and Logic Operation.
 On/Off Control: Example: Air conditioning control, used to limit and control a “high
power “load, such as a compressor
 Limit Control: Example: Motor Speed Control, used to disconnect a motor if it runs
slower or faster than the desired speed
 Logic Operation: Example: Test Equipment, used to connect the instrument to a number
of testing points on the device under test.

Fig 3.5 RELAY Connection

Image Notes
1. Connect the ground of your 12V source to the ground of your Arduino.
2. If you forget that Diode you could destroy your Arduino and the coil of relay.
3. R1 limits Ib.

Hawassa university, IOT School of Electrical and Computer Engineering Page 18


Final year project thesis June, 2016

3.3.3 Sensor
A sensor is a device that measures a physical quantity and converts it into a signal which can
be read by an observer or by an instrument. For example temperature sensor, humidity sensor,
water level sensor etc.
3.3.3.1 Humidity Sensor
A humidity sensor senses relative humidity. This means that it measures both soil temperature
and moisture. Relative humidity, expressed as a percent, is the ratio of actual moisture in the soil
to the highest amount of moisture soil at that temperature can hold. The warmer the soil is, the
more moisture it can hold, so relative humidity changes with fluctuations in temperature. The
most common type of humidity sensor uses what is called “capacitive measurement.” This
system relies on electrical capacitance, or the ability of two nearby electrical conductors to create
an electrical field between them. The sensor itself is composed of two metal plates with a non-
conductive polymer film between them. The film collects moisture from the air, and the moisture
causes minute changes in the voltage between the two plates. The changes in voltage are
converted into digital readings showing the amount of moisture in the air.
Capacitive type sensors are very linear and hence can measure RH from 0% to 100%, but require
complex circuit and also need regular calibration.
3.3.3.2 Soil Moisture Sensor
A predefined moisture threshold is used as a reference to control the water pumping if
needed. If the water level is less than a predefined value then our sensor will detect this and will
inform the system to pump the water. On the other hand if it exceeds the threshold value and the
water pump is ON then our system will switch OFF the water pump. This will allow efficient
usage of water. Soil moisture levels can be expressed in terms of soil water content.
Soil moisture sensors measure the water content in soil. A soil moisture probe is made up of
multiple soil moisture sensors. Technologies commonly used in soil moisture sensors include:
 Frequency domain sensor such as a capacitance sensor.
 Neutron moisture gauges, utilize the moderator properties of water for neutrons.
 Electrical resistance of the soil

Hawassa university, IOT School of Electrical and Computer Engineering Page 19


Final year project thesis June, 2016

In this particular project, we will use the moisture sensors which can be inserted in the soil,
in order to measure the moisture content of the soil. Manage the board. The recommended range
is 7 to 12 volts. Soil electrical conductivity is simply measured using two metal conductors
spaced apart in the soil except that dissolved salts greatly alter the water conductivity and can
confound the measurements.

Fig 3.6 Moisture Sensor

In total A soil moisture sensor is a device that measures the volumetric water content (VWC) of
soil. Mathematically VWC, θ, is given as follows;

Mathematical representation of VWC

Where: Vw is the water volume and VT is the total volume (soil volume + water volume). Soil
moisture sensors are classified according to how they measure the soil moisture content.

3.3.3.3 Soil Moisture calculation


Two methods are used in determining the volumetric water content (VWC); direct and indirect.
The direct method entails drying a known volume of soil in an oven and weighing it. The direct
method of measuring VWC is done using the following mathematical notation:

Hawassa university, IOT School of Electrical and Computer Engineering Page 20


Final year project thesis June, 2016

Soil Moisture calculation

Where:
 M wet is soil sample before drying in the oven
 M dry is soil sample after drying in the oven
 ρw is water density
 Vb is the volume of soil sample before drying

Indirect method is based on correlating soil physical and chemical properties with water
content. Three techniques are used in this method namely: chemical titrations, geophysical
sensing and satellite remote sensing. Chemical titration determines the moisture loss in sample
soil after freeze drying or heating. Satellite remote sensing uses microwave radiation to check on
the difference in dielectric properties of dry and wet soils. Geophysical sensing uses physical
devices which are inserted in the soil to determine the soil moisture content. Techniques used in
this method include: electrical resistance, electrical conductivity, soil dielectric, soil tension, soil
capacitance among others.

3.3.3.4 Types of soil moisture sensors

3.3.3.4.1 Electrical resistance blocks Sensors

These sensors are made up of two electrodes made from a porous substance like sand
ceramic mixture or gypsum. The two electrodes are imbedded in the soil during installation.
Moisture is allowed to move freely in and out of the sensors electrodes as the soil becomes moist
or dries up. The resistance of the electrodes to the flow current is correlated with moisture
content. To measure this resistance the electrodes are biased (energized) with a dc voltage and
the current flowing through them measured. Applying Ohm‟s law;

R=V/I

Where: R is resistance (Unknown) (Ω)


V is biasing voltage (3.3V to 5.0V)
I is the current flowing through the electrodes (Amps).

Hawassa university, IOT School of Electrical and Computer Engineering Page 21


Final year project thesis June, 2016

Fig 3.7 Homemade soil moisture sensor

When the moisture content in the soil is high more current will be allowed to flow thus
indicating low resistance. On the other hand for dry soils the sensor will indicate higher
resistance portrayed by the low current reading. This type of sensor is cheap and readily
available. Electrical resistance blocks Sensors can also be readily assembled from home using
two metal plates or steel nails. Electrical resistance blocks Sensors are mostly used in small
projects and gardens due to the following disadvantages;
 They are badly affected by soil PH and salinity thus requiring regular maintenance
 They have low sensitivity.
 The electrodes; especially which provides a constant source of ions; do not dry at the
same rate as the soil surrounding it.

Fig 3.8 Schematic of an electrical resistance block and meter

Hawassa university, IOT School of Electrical and Computer Engineering Page 22


Final year project thesis June, 2016

3.3.3.4.2 Electrical conductivity probe sensors


Electrical conductivity probes employ the same principle as the Electrical resistance blocks
Sensors. The one major difference between the two types of sensors is that Electrical
conductivity probes sensors have their electrodes/probes in direct contact with the soil. By
definition electricity is the flow of charges and water in its pure form cannot conduct electricity.
The amount of impurities in water and mineral salts make it polar thus able to conduct
electricity. A large volume of water will mean more ions and thus better electric conduction.
Electrical conductivity probes sensors takes advantage of this phenomenon. The amount of
current passing between the probes is directly proportional to the soil moisture content. Moist
soil allow more current to flow between the probes while drier soils only allow a little current to
flow between the probes. Better conductivity indicates a lower electrical resistance.
Most of the soil moisture sensors currently in the market especially for small projects are
Electrical conductivity probes sensors. They have the following advantages.

 They are cheap.


 They are readily available
 Easy to calibrate and install

3.3.3.4.3 Capacitance sensors


Capacitance sensors use Frequency Domain Reflectometry (FDR). Frequency domain
reflectometry is the measure of signal reflections through a medium across frequency.
Capacitance sensors contain two electrodes which are separated by a dielectric material. The soil
becomes the dielectric component after the electrodes are inserted into the soil; it could even be
inserted into the access tube in the soil to achieve the same results. A high oscillating frequency
is thereafter applied to the electrodes to induce a resonant frequency. The magnitude of the
resonant frequency is dependent on the dielectric constant of the soil which in turns depends on
or can change to the soil‟s moisture content. The change of the frequency as a result of the soil‟s
moisture content is converted into the measurement of the soil moisture.

Hawassa university, IOT School of Electrical and Computer Engineering Page 23


Final year project thesis June, 2016

3.3.3.4.4 Humidity Measurement


Water supply is required in the agriculture ground when the soil contains lesser amount of
water. When the temperature in the air increases, the capability of air for holding the water vapor
will be increased. This means the temperature rise in air causes more vaporization in the air from
soil. So, it is obvious the amount of water in the soil will be decreased. The humidity sensor
senses the amount of the water particle or humidity of the soil. The humidity sensor, mentioned
above, is actually senses the present humidity i.e. the Relative Humidity (RH). The relative
humidity is actually the ratio of actual vapor present to the saturation vapor amount. So, the
vaporization or in other word the relative humidity is inversely proportional to the temperature
rise of the air as well as the actual humidity of the air as because the actual humidity is directly
proportional to the temperature rise. There are two fixed values of humidity sensor, monitored by
the controller, which totally control the supply and flow of the water into the agriculture ground.

When RH is low, it indicates high temperature and so the vaporization into the air will be
increased. Then the relay will be turned ON and the water will be supplied into the ground.
While supplying the water into the ground, the amount of water will be increased in the
agriculture ground meaning that the humidity in the soil will be in increasing mode. In the
highest preset value of the sensor, it indicates the lower temperature or in the other hand the
vaporization is low as the amount of the water in the soil is in the highest level. Then the relay
will be turned OFF and the water supply in the soil will be halted. After some time when the
vaporization is increasing, the system will iterate in the same way and then it continues the water
supply.

3.3.4. WATER PUMPER MOTOR


The water pump motor is used to artificially supply water for a particular task. It can be
electronically controlled by interfacing it to a microcontroller. It can be triggered ON/OFF by
relay signals as required. The process of artificially supplying water is known as pumping. There
are many varieties of water pumps used. The pumping of water is a basic and practical technique,
far more practical than scooping it up with one's hands or lifting it in a hand-held bucket.

Hawassa university, IOT School of Electrical and Computer Engineering Page 24


Final year project thesis June, 2016

This is true whether the water is drawn from a fresh source, moved to a needed location,
purified, or used for irrigation. Regardless of the outcome, the energy required to pump water is
an extremely demanding component of water consumption.

Fig 3.9 Water Pump/Motor

The flow rate of our motor can be found as follows

or

Q = nd/231

3.3.5 Liquid tank

This is the tank inside which the level of the liquid has to be controlled. Liquid is pumped to
the tank from the reservoir using liquid pump motor, liquid coming down into the tank. The
switch used as a sensor inserted inside the tank at different levels used to determine liquid level
to measures the height of the liquid in the tank. The microcontroller controls the pump so that the
liquid is stopped at the desired level. The tank used in this project is a plastic container.

Water sprinkler pipe; line is to transfer or pass the water from the water pump to the fields and
to the sprinkler head. In this project the estimated area is 38 cm2.

3.3.6 Level switch sensor

Hawassa university, IOT School of Electrical and Computer Engineering Page 25


Final year project thesis June, 2016

Fig 3.10 level sensor

The level is sensed with a conducting metal strip. It works on the principle of electrical
conducting property of water. The sensing system used is based on transistor switching principle.
The base of a transistor, connected to a resistor, is given at a certain level inside the tank and the
base of the tank has 5V Vcc.

3.3.7 Liquid crystal displays (LCD)


LCD is a type of display used in digital watches and many portable computers. LCD displays
utilize to sheets of polarizing material with a liquid crystal solution between them. An electric
current passed through the liquid causes the crystals to align so that light cannot pass through
them. LCD technology has advanced very rapidly since its initial inception over a decade ago for
use in laptop computers. Technical achievement has resulted in brighter displace, higher
resolutions, reduce response times and cheaper manufacturing process.

The liquid crystals can be manipulated through an applied electric voltage so that light is
allowed to pass or is blocked. By carefully controlling where and what wavelength (color) of
light is allowed to pass, the LCD monitor is able to display images. A back light provides LCD
monitor‟s brightness. Just as there are many varieties of solids and liquids, there is also a variety
of liquid crystal substances. Depending on the temperature and particular nature of a substance,
liquid crystals can be in one of several distinct phases. Over the years many improvements have
been made to LCD to help enhance resolution, image, sharpness and response times. One of the
latest such advancements is TFT or Thin Film Transistor. TFT-LCD‟s make use of a very thin
transistor that is applied to glass during acts as switch allowing control of light at the pixel level,
greatly enhancing image sharpness and resolution. This has been particularly important for
improving LCD‟s ability to display small-sized fonts and image clearly.

Hawassa university, IOT School of Electrical and Computer Engineering Page 26


Final year project thesis June, 2016

LCD interfacing with Arduino is a real-world application. In recent years the LCD is finding
wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs). This is
due to following reasons:

1. The declining prices of LCDs.

2. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU to keep
displaying the data.

3. Ease of programming for characters and graphics.


Liquid Crystal Display (LCD) screen is an electronic display module. An LCD has a wide
range of applications in electronics. The most basic and commonly used LCD in circuits is the 16x2
display. LCDs are commonly preferred in display because they are cheap, easy to programme and
can display a wide range of characters and animations. A 16x2 LCD have two display lines each
capable of displaying 16 characters. This LCD has Command and Data registers. The command
register stores command instructions given to the LCD while the Data register stores the data to be
displayed by the LCD.
The voltage needed is preferable 2-20 V A.C. The voltage threshold for watch type LCD
display is 1to 2V. It is a16 pin device with 16*2 displays. LCD used to display the condition of
motor and the value of relative humidity.

Fig 3.11 LCD Display


3.4 Software development
Software is computer program, instructions that cause the software, the machine to do work.
Software as whole can be divided into a number of categories base on the type of work done.
The two primary software are operating software (system software), which controls the working
of the computer, application software, which addresses the multitude of task for which people
use computer.

Hawassa university, IOT School of Electrical and Computer Engineering Page 27


Final year project thesis June, 2016

The fig below shows the flow chart of our project. We have tried to explain as follows.

Flow chart

Start

Select Humidity
Mode

Moisture
Yes <Desired value No
(RH=50)

Yes Yes
RH>40 No Yes Is tank No
empty?

Motor2 Turn off Motor1 Motor1


on Motors Yes
on off

End

Fig 3.12 the overall flow chart the project

Hawassa university, IOT School of Electrical and Computer Engineering Page 28


Final year project thesis June, 2016

3.5 Output Units


3.5.1 LCD Interface with Arduino
To affect display a 16x2 Liquid Crystal Display (LCD) was chosen. LCD pins D4, D5, D6
and D7 were used as data lines in a 4 bit mode configuration. These pins were connected to
arduino pins 5, 4, 3 and 2 respectively. Pin 15(A) was connected to Vcc and pin 16 (K) was
connected to GND. These pins (A and K) are for the LEDs integrated on the LCD circuit board.
LCD‟s pin E (Enable) was connected to digital pin 11 on the arduino board. Pin RS (Register
Select) on the LCD was connected to arduino digital pin 12. R/W pin of the LCD was connected
to GND (ground). The figure below shows the LCD-microcontroller interface.

Fig 3.13 LCD Connection to arduino

3.5.2 LEDS interfacing with Arduino


To indicate the three states of the soil three LEDs were used. The three LEDs lit up
depending on the soil moisture content. When the soil was dry LED connected to arduino digital
pin 13 was lit.

Hawassa university, IOT School of Electrical and Computer Engineering Page 29


Final year project thesis June, 2016

For moist soil (required condition) LED connected to arduino digital pin 12 lit up and for soggy
soil LED connected to arduino digital pin 11 lit up. The three LEDs were connected to the
microcontroller as shown below.

Fig 3.14 LEDs Connection to arduino board


Ohms law was utilized to determine the size (in ohms) of the protection resistor to be interfaced
with the LEDs. From Ohms law Voltage (V) = {Current (I)}*{Resistance(R)} Where as in our case;
V= Vcc (5V) -Voltage drop across LED (selected LEDs has 2.0V)
ILED= LED current (20mA) 33
VLED = LED Voltage drop (red in colour) (2V) R= minimum required resistance value Therefore R min
= {(5-2) V}/ {20mA} =150 Ω To achieve current limitation a resistance value higher than the
calculated Rmin was selected. A 220Ω resistor was used and thus only 13.6mA current was allowed to
pass through each of the three LEDs
ATMEGA 328P MICRO CONTROLLER is the brain of the project which initiates the
Relay and LED signal at a junction. The LED‟s are automatically on and off by making the
corresponding port pin of the microcontroller high.so the sequence of the lights determine the
moisture level in the soil.

3.5.3 Motor pumper interfacing with Arduino

Hawassa university, IOT School of Electrical and Computer Engineering Page 30


Final year project thesis June, 2016

Fig 3.15 Interfacing arduino with pumps

The pump control segment consists of a 1k resistor , an NPN transistor and 12Vdc relay.
The 12 Vac is attached to the common of the relay while the pump is attached to the normally
open pin of the relay. A transistor is connected across the energizing coil of the relay to bias the
relay while the microcontroller controls the biasing of the relay by sending logic 1 or logic 0 to
the base of the NPN transistor, which in turn biases the relay.

The microcontroller was connected to the relay via an NPN transistor. To protect the
transistor; while turning it on, a resistor was used. The resistor limits the current flowing through
the transistor. As was the case with LEDs ohms law was used as shown below.

Rmin = (5 – 0.7) V / 40mA = 107.5𝛺 A resistor of 470𝛺 was selected and thus the current
through the transistor was limited to; 4.3V / 470𝛺 =9.12 mA .To protect the microcontroller
from back e.m.f during switching a diode was connected across the relay.

Hawassa university, IOT School of Electrical and Computer Engineering Page 31


Final year project thesis June, 2016

3.5.4 Whole system interfacing

Fig 3.16 Overall interfacing with arduino

The circuit Diagram works as a sensor the POT meter or variable resistance measures the
moisture level depending on the amount of water in soil. When the amount of water in the soil
high the conductivity is high and resistivity low visversal. Depending on this way the moisture
sensor measures the amount of Relative Humidity (RH) in the soil. The output of POT connects
to analog input pin of Arduino Uno. If the soil or plant needs the water, POT sends the signals to
Arduino Uno R3 then the relay become energized. When the relay energized the motor pump
start to pump water to plant until the required moisture level is reached.

Hawassa university, IOT School of Electrical and Computer Engineering Page 32


Final year project thesis June, 2016

The three LED indicates that RH ranges, RED LED indicates high range of RH, GREEN LED
indicates that suitable RH range and YELLOW LED shows that low ranges of RH values. The
LCD display RH values in the soil and the motor pump state or condition. There are three
conditions that the system implements.
The sensor was calibrated and three states defined. When the dry state was achieved the control
unit (micro controller) switched the water pump on via a relay circuit. The three states were indicated
using three different LEDs and an LCD. The LCD also indicated when the pump was running.

Hawassa university, IOT School of Electrical and Computer Engineering Page 33


Final year project thesis June, 2016

CHAPTER FOUR

4. SIMULATION RESULTS ANALYSIS


The design of project is to determine humidity of the soil and pumps the water to the
agricultural lands depending on the conditions.

This project also shows the present state of the liquid by using level sensors inserted in
different levels inside the tank. We used switch to sense presence of water in that particular level
where the switch are inserted in the tank.

First the switch sensor checks the level of liquid in the tank weather there is liquid in the
tank or not. On the other hand in this work, the microcontroller for the automatic water level
monitor with feedback, having passed the necessary tests with the other components interfaced to
it, is hereby presented. With this implemented system, it is possible to monitor the water level in
an over-head tank, switch on the water pump when the tank is empty and switch off the same
pump when the tank is full without any need for human intervention. By so doing, the incidence
of water wastage is eliminated and abrupt cut-off of water supply is equally also eliminated.

The conditions that our project includes are presented as follows:


Condition1: This is the normal condition meaning the soil moisture is at suitable to the plant. In
this condition the motor pumper1 on and fills the tank. At this condition there are other sub
conditions are present as shown below. In other words in the normal condition (RH=50) the
pumper fills the tank.

Hawassa university, IOT School of Electrical and Computer Engineering Page 34


Final year project thesis June, 2016

Condition 1.1: at initial level, that is when the tank is empty the LCD displays the word
„EMPTY‟, then the motor start pumping as shown below.

Fig4.1 First condition of simulation results when tank is empty

Hawassa university, IOT School of Electrical and Computer Engineering Page 35


Final year project thesis June, 2016

Condition 1.2: At this position the liquid level reach at LOW and motor is running to fill the
overhead tank. The LCD displays „LOW‟ as shown in the simulation result below.
At this time the two LED‟s on.

Fig4.2 First condition of simulation results when tank is low

Hawassa university, IOT School of Electrical and Computer Engineering Page 36


Final year project thesis June, 2016

Condition 1.3: the level of the liquid is now at half position of the overhead tank, in this case the
motor still running and the LCD displays „AVERAGE‟.

The LED‟s become low.

Fig4.3 First condition of simulation results when tank reach average level

Hawassa university, IOT School of Electrical and Computer Engineering Page 37


Final year project thesis June, 2016

Condition 1.4: There is full liquid in the overhead tank.when this happens there is no need of
liquid pumping or starting of the motor so the operation stands still;the LCD displays „HIGH‟.
All the LED‟s become low.

Fig4.4 First condition of simulation results when tank full

Hawassa university, IOT School of Electrical and Computer Engineering Page 38


Final year project thesis June, 2016

Condition 2: This is the condition to which pumping activity takes places, meaning the soil
moisture is low or the temperature is above the desired point.so the plant needs water. In this
condition the motor pump on the water pump until the desired point reached. Green LED
indicates this condition.
All the LED‟s become high.

Fig4.5 Second Condition of simulation result

Hawassa university, IOT School of Electrical and Computer Engineering Page 39


Final year project thesis June, 2016

Condition 3: This condition is problem indicator by Red LED. Even if the moisture sensor sends
a signal to arduino to pump water but there is no response to signal, in this time the temperature
rises above the desired ranges.

Fig4.6 Third Condition of simulation result.

Hawassa university, IOT School of Electrical and Computer Engineering Page 40


Final year project thesis June, 2016

CHAPTER FIVE
5 CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion

Thus the “Microcontroller based Automatic Humidity Monitoring and Pumping System ”
has been designed successfully. It has been developed by integrated features of all the hardware
components used. Presence of every module has been reasoned out and placed carefully, thus
contributing to the best working of the unit. The system has been tested to function
automatically. The moisture sensors measure the moisture level (water content) of the different
plants. If the moisture level is found to be below the desired level, the moisture sensor sends the
signal to the Arduino board which triggers the Water Pump to turn ON and supply the water to
the desired moisture level is reached, the system halts on its own and the Water Pump is turned
OFF. Thus, the functionality of the entire system has been tested thoroughly and it is said to
function successfully. Auto-based agriculture monitoring system serves as a reliable and efficient
system for monitoring agricultural parameters. The corrective action can be taken. Wireless
monitoring of field not only allows user to reduce the human power, but it also allows user to see
accurate changes in it. It is cheaper in cost and consumes less power. In this paper we present
automatic controlling access of irrigation motor. This includes sensor, controller. The sensor is
used in irrigation field for sensing soil moisture value and the data is sent to controller. On
receiving sensor value the controller checks it with required soil moisture value. When soil
moisture in irrigation field is above the required level then the motor is switched on and below
the required level the motor switch off by using automatic relay.

On the hand Automatic liquid level control system employs the use of different technologies
in its design, development, and implementation. The system used microcontroller to automate
the process of liquid pumping in storage tank system and has the ability to detect the level of
water in a tank, switch on/off the pump accordingly and indicator. This project has successfully
provided an improvement on existing liquid level controllers by its use of calibrated circuit to
indicate the liquid level and use of DC instead of AC power there by eliminating risk of electro
caution.

Hawassa university, IOT School of Electrical and Computer Engineering Page 41


Final year project thesis June, 2016

Additionally what makes our project better and more improved than the technologies which
are using in our country is, it is not manual, all the processes work automatically without any
human interference, and it is less time consuming and economical.

5.2 Recommendation

This project can be enhanced in such a way as to control automatically the signals
depending on relative humidity using moisture sensors. Water pump motor automatic turn off
when RH range value at high level because RH value and soil moisture directly relation which
helps in power consumption saving. In future this system can be used to inform people about
different places. This can be done through Data transfer between the microcontroller and
computer can also be done through telephone network, data call activated SIM this technique
allows the operator to gather the recorded data from a far end to his home computer or phone
without going site and also used to GSM technology for fault indication.
Generally to improve on the effectiveness and efficiency of the system the following
recommendations can be put into considerations:

 Integrating GSM technology can be used, such that whenever the water pump switches
ON/OFF, an SMS is sent to the concerned person regarding the status of the pump.
 The pump should also be controlled via SMS.

The water level controller designed in this project can be used to control water flow.
However, there is no way of knowing the rate of input and output, therefore the rate of water
input must always be equal to or greater than the rate of water output. To make this happen we
could use a speed regulator and valve at the input and at the output. If these issues are taken care
of then a more efficient and reliable performance can be achieved.

Hawassa university, IOT School of Electrical and Computer Engineering Page 42


Final year project thesis June, 2016

REFERANCES

[1]. www.arduino.cc

[2]. www.ijsr.net

[3].http://www.ijettjournal.org

[4].Micro Electronics from General Instrument Corporation

[5].Intelligent Humidity Sensor for - Wireless Sensor Network


Agricultural Application.
[6]. http://www.microchip.com/downloads/en/devicedoc
[7]. Greenfield, J. (2000). Digital Design using Integrated Circuits.

[8]. Rohit, M. (2008): Principles of Electronics.

[9]. Javanmard, M., Abbas, K. A., & Arvin, F. (2009). A Microcontroller-Based Monitoring
System for Batch Tea Dryer, CCSE Journal of Agricultural Science, Vol. 1.
[10]. S.Jatmiko, A B.Mutiara, Indriati ―Prototype of water level detection system Journal of
Theoretical and Applied Information Technology Vol. 37 pp 52-59, 2012.
[11]. Khaled Reza, S.M., Shah Ahsanuzzaman Md. Tariq, S.M. Mohsin Reza (2010),
„Microcontroller Based Automated Water Level Sensing and Controlling: Design and
Implementation Issue‟. Proceedings of the World Congress on Engineering and Computer
Science, pp 220-224.
[12]. Venkata Naga Rohit Gunturi (2013), „Micro Controller Based Automatic Plant Irrigation
System‟, International Journal of Advancements in Research & Technology, Vol. 2, Iss. 4, ISSN
2278-7763.

Hawassa university, IOT School of Electrical and Computer Engineering Page 43


Final year project thesis June, 2016

APPENDIX
CODES
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte sensorPin[] = {1, 6, 7};

byte ledPin[] = {8, 9, 10}; // number of leds = numbers of sensors

const byte sensors = 3;

int level = 0;

int RELAYPIN1 = 13;

int RELAYPIN2=0;

float RH;

void setup() {

lcd.begin(16, 2);

for(int i = 0; i < sensors; i++) {

pinMode(sensorPin[i], INPUT);

pinMode(ledPin[i], OUTPUT);

pinMode(RELAYPIN1, OUTPUT);

pinMode(RELAYPIN2,OUTPUT);

lcd.setCursor(0,0);

lcd.print("RH=");

Hawassa university, IOT School of Electrical and Computer Engineering Page 44


Final year project thesis June, 2016

void loop() {

level = 0;

for(int i = 0; i < sensors; i++) {

if(digitalRead(sensorPin[i]) == LOW) {

digitalWrite(ledPin[i], HIGH);

level = sensors - i;

} else {

digitalWrite(ledPin[i], LOW);

lcd.setCursor(0, 1);

float u= analogRead(A1);

RH=map(u,0,1023,0,50);

lcd.setCursor(3,0);

lcd.print(RH);

if(RH>=50){

lcd.clear();

lcd.print("RH=50");

lcd.setCursor(0,1);

switch(level) {

case 1:

lcd.print("EMPTY");

digitalWrite(RELAYPIN1, HIGH);

Hawassa university, IOT School of Electrical and Computer Engineering Page 45


Final year project thesis June, 2016

digitalWrite(RELAYPIN2,LOW);

break;

case 2:

lcd.print("LOW");

digitalWrite(RELAYPIN1, HIGH);

digitalWrite(RELAYPIN2,LOW);

break;

case 3:

lcd.print("AVERAGE");

digitalWrite(RELAYPIN1,HIGH);

digitalWrite(RELAYPIN2,LOW);

break;

default:

lcd.print("HIGH");

digitalWrite(RELAYPIN1, LOW);

digitalWrite(RELAYPIN2,LOW);

break;

delay(1000);

else if(RH<50&&RH>=40){

digitalWrite(RELAYPIN1,LOW);

Hawassa university, IOT School of Electrical and Computer Engineering Page 46


Final year project thesis June, 2016

digitalWrite(RELAYPIN2,HIGH);

digitalWrite(ledPin[level], HIGH);

lcd.setCursor(0,1);

lcd.print("MOTOR2.PUMPER-ON ");

else

digitalWrite(RELAYPIN1,LOW);

digitalWrite(RELAYPIN2,LOW);

digitalWrite(ledPin[level],LOW);

lcd.setCursor(0,1);

lcd.print("MOTORS.OFF");

Hawassa university, IOT School of Electrical and Computer Engineering Page 47

You might also like