Vous êtes sur la page 1sur 44

DEGREE PROJECT, IN MECHATRONICS , FIRST LEVEL

STOCKHOLM, SWEDEN 2015

Automated Greenhouse
TEMPERATURE AND SOIL MOISTURE
CONTROL
DANIELA ATTALLA, JENNIFER TANNFELT WU

KTH ROYAL INSTITUTE OF TECHNOLOGY


INDUSTRIAL ENGINEERING AND MANAGEMENT

Automated Greenhouse

DANIELA ATTALLA
JENNIFER TANNFELT WU

Bacherlors Thesis in Mechatronics


Supervisor:
Examiner:
Approved:

Baha Alhaj Hasan


Martin Edin Grimheden
2015-05-19

TRITA MMK 2015:22 MDAB075

Abstract
In this thesis an automated greenhouse was built with the purpose of investigating the watering systems reliability and if a desired range of temperatures
can be maintained.
The microcontroller used to create the automated greenhouse was an Arduino UNO. This project utilizes two different sensors, a soil moisture sensor
and a temperature sensor. The sensors are controlling the two actuators which
are a heating fan and a pump. The heating fan is used to change the temperature and the pump is used to water the plant.
The watering system and the temperature control system was tested both
separately and together. The result showed that the temperature could be
maintained in the desired range. Results from the soil moisture sensor were
uneven and therefore interpret as unreliable.

iii

Sammanfattning
Automatiserat Vxthus
I denna tes byggdes ett automatiserat vxthus med syftet att underska dess
bevattningssystems plitlighet samt om ett nskat temperaturspann kan bibehllas.
Microkontrollern fr att bygga detta automatiserade vxthus var en Arduino UNO. Detta projekt anvnder sig av tv olika sensorer, en jordfuktsensor
och en temperatursensor. Sensorerna kontrollerar en vrmeflkt och en pump.
Vrmeflkten anvnds fr att ndra temperaturen och pumpen fr att vattna
plantan.
Bevattningssystemet och temperaturstyrningen har testats bde separat
och tillsammans. Resultatet visar att temperaturen kan bibehllas inom det
nskade spannet. Resultaten frn jordfuktsensorn var ojmna och drfr tolkats
som oplitliga.

Preface
We have been working on this project during the spring of 2015, and we would not
have been able to finish it without the help and support from our supervisor Baha
Alhaj Hasan, Staffan Qvarnstrm and the lab assistants Jimmy Karls, Sebastian
Quiroga and Tobias Gustafsson. Another thanks to Ylva Steffner for giving us
feedback on the report. Finally, we would like to add a special thank you to Martin
Edin Grimheden for making this project a fun experience.
Daniela Attalla
Jennifer Tannfelt Wu
Stockholm, May, 2015

vii

Contents
Abstract

iii

Sammanfattning

Preface

vii

Contents

ix

Nomenclature

xi

1 Introduction
1.1 Background
1.2 Purpose . .
1.3 Scope . . .
1.4 Method . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

1
1
1
2
2

2 Theory
2.1 Automated Greenhouse Projects
2.2 Sensors . . . . . . . . . . . . . .
2.3 Heating Fan . . . . . . . . . . . .
2.4 Watering System . . . . . . . . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

5
5
5
7
8

.
.
.
.
.

11
11
13
13
16
18

4 Discussion and conclusions


4.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23
23
24

5 Recommendations and future work


5.1 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25
25

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

3 Demonstrator
3.1 Problem Formulation
3.2 Software . . . . . . .
3.3 Electronics . . . . .
3.4 Hardware . . . . . .
3.5 Test Results . . . . .

.
.
.
.

.
.
.
.
.

.
.
.
.

.
.
.
.
.

.
.
.
.

.
.
.
.
.

.
.
.
.

.
.
.
.
.

.
.
.
.

.
.
.
.
.

.
.
.
.

.
.
.
.
.

.
.
.
.
.

ix

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

5.2

Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Bibliography

25
27

Appendices
A Draft of Nozzle

29

Nomenclature
Symbols
Symbols

Description

L
A
V CC
Tp
U
t
d
T
p
I
P

Resistance ()
Resistivity (m)
Length of element (m)
Cross-section area (m2 )
Positive voltage supply (V)
Preferred temperature (C)
Voltage (V)
Time (s)
Duty cycle (%)
Period (s)
Pulse (s)
Current (A)
Power (W)

Abbreviations
Abbreviation Description
GND
PWM
NTC
DC
RPM
RTD
PTC
NO
NC
SD

Ground
Pulse Width Modulation
Negative Temperature Coefficient
Direct Current
Revolutions Per Minute
Resistance Temperature Detector
Positive Temperature Coefficient
Normally Open
Normally Closed
Standard Deviation

xi

Chapter 1

Introduction
This chapter introduces the background, purpose, scope and method of the project.

1.1

Background

In modern society, the consumption of fruits and vegetables has become the norm.
A variety of fresh fruits and vegetables should be accessible at all times. However,
the northern climate prevents the growth of certain fruits and vegetables, especially
during winter. This results in import from southern countries, which in turn has
some drawbacks.
Not only does the shipping of imported goods affect the environment negatively
but imported food or vegetables are also less flavourful [ISAAA, 2014] and sold to a
higher price. The crops must be harvested prematurely when importing food. This
is to delay the ripening process so that it is possible for the fruits or vegetables to
reach their destination before they are considered inedible. The ripening process
is later resumed by spraying the food with ethylene gas, a gas that is deemed
to promote ripening in certain fruits and vegetables. However, this postharvest
ripening can lead to poor taste.
In the past couple of years, an increased interest in organic and locally produced
food has become a growing trend [EkoWeb, 2014]. Locally grown foods are picked
at their peak of ripeness and are therefore full of flavor. Furthermore, growing food
at home assures truly organic food. On the other hand it takes a lot of time and
effort, and time is something that most people lack today.

1.2

Purpose

The purpose of this project was therefore to make it easier to grow food at home.
This can be achieved with the use of an automated greenhouse. A greenhouse makes
it possible to replicate a different climate and consequently grow food that would not
typically grow in the area. Additionally, making the greenhouse automated enables
people to grow their own food or plants at home without having to constantly look
1

CHAPTER 1. INTRODUCTION

after them. It can be reassuring to know that the plants are taken care of while one
is on vacation or not around the house for a longer period of time.
The research question of this study was to analyze if it is possible to maintain
the greenhouse temperature in a desired range for optimal plant growth using a
temperature control system. Another objective was to investigate if the watering
system is reliable, that is whether or not it can obtain a perfect soil moisture level
for the chosen plant.

1.3

Scope

The automated greenhouse in this project is meant for domestic use. This means
that the greenhouse will be somewhat small, about 42cmx30cmx21cm. If it was
made to be bigger, more components would be needed in the greenhouse in order
to obtain the desired climate.
This project focuses on one plant only, which is basil. This is because basil is a
common herb that some people have in their windowsill. The size of it is suitable
for a small greenhouse used at home. A specific plant is needed as a reference so
that the temperature control system can be built around its preferences. However,
this reference can be changed into any other plant.
The greenhouse has to be able to create a microclimate suitable for basil. Some
factors have to be controlled in order to do that. In this project the temperature
and soil moisture were measured and a control loop including a heating fan and a
watering system was actuated. This project does not cover all of the factors that
can be taken into considerations to create as much of a favourable environment as
possible. Other factors could be light and carbon dioxide.
The room temperature is assumed to be at 21C. Another assumption that has
been made is that the temperature outside of the greenhouse, the room temperature,
will always be colder or equal to the temperature inside of the greenhouse. The plant
that will be put in the greenhouse will therefore have a preferred temperature at
room temperature or above.
The result of the research questions is based on time restricted experiments.
This result could be different in the long run and it is therefore not valid in that
case.
The values for when the soil is considered to be too wet or too dry is dependant
on the type of soil used. These values cannot be used on other types of soils, which
have to be individually set with the help of the tests.

1.4

Method

An automated greenhouse, with a temperature control system and a watering system, was built in order to answer the research questions. The microcontroller used
to create the automated greenhouse was an Arduino UNO. The temperature control
system consists of a temperature sensor, a computer fan and a power resistor with
2

1.4. METHOD

a heat sink. The fan and heater were controlled separately to adjust the temperature. The watering system consists of a soil moisture sensor, a water tank, a water
circulator pump and a hose. The watering was turned on or turn off based on the
soil moisture level read from the sensor.

Temperature Control System


A temperature control loop, where the fan was running at different speeds at different temperatures, was implemented to keep the temperature in the accepted range.
This temperature range was chosen with regard to the preferences of the basil plant.
The greenhouse was put to test by changing the room temperature and the temperature of the greenhouse. The tests were conducted to observe if the temperature
inside the greenhouse would stabilize and stay in the accepted temperature range.
The temperature control system underwent three tests to investigate its ability
to maintain the temperature in the desired range. The first test was to cool down
the greenhouse. The greenhouse temperature was warmer than the accepted range
at the beginning of the test. The second test was to warm up the greenhouse.
The surrounding temperature, the room temperature, in this test was colder than
the accepted range. The last test was to let the control system operate for a long
period of time to control that it can stabilize in the accepted range. These tests
were executed three times each to make sure that the results were reliable.

Watering System
The watering system underwent two tests to analyze the reliability of the system.
The first test was to examine whether the circulator pump gives the same amount
of water each time to determine the reliability of the pump. The second test was
about measuring the soil moisture level at the same spot during a long period of
time. If the moisture level is stable around the same value the sensor could be seen
as reliable.
The accepted range of soil moisture values was determined by sampling values
when the soil was estimated through hand contact with the soil to be too dry or
too wet. A flower pot with soil was used to do the measurements. The plant was
watered until it got to the exact point where it was determined to be too wet. The
value from the sensor became the upper limit. The pot was then exposed to heat
in order to speed up the evaporation. The soil was too dry at this point. It was
therefore watered until it got to the exact point were it was determined not to be
dry anymore. This value became the lower limit.
The watering system was put through its tests until they showed similar results
to minimize the possible error sources. If both of these tests were approved, the
system was deemed reliable.

Chapter 2

Theory
This chapter introduces the theory behind the thesis project and presents similar
projects that have been done before.

2.1

Automated Greenhouse Projects

Plenty of projects involving gardening and Arduinos have been done. An Arduino
is a prototyping platform which is well suited for interactive projects since it can
sense its surroundings with the help of sensors and subsequently affect the same
surroundings by controlling actuators [Arduino, 2015].
There is in fact a term for gardening Arduinos, Garduinos. Some previous
projects are simple and others are complex. What can count as Garduino is not
defined but most commonly they all have a watering system. Other features can
be carbon dioxide and light regulation. This project differs from other Garduinos
since it focuses more on temperature control.

2.2

Sensors

This section presents the two sensors needed to build the automated greenhouse
and to answer the research question.

Soil Moisture
The soil moisture sensor is a resistive sensor. That is, the soil moisture level is
determined by measuring the electrical resistivity between two electrodes placed in
the soil. The final output from the sensor is the voltage over the electrodes. A low
electrical resistivity means that electricity is easily conducted through the soil. This
resistance is based on water resistivity and is calculated according to the following
formula [Johansson, 2013]
R=
5

L
A

(2.1)

CHAPTER 2. THEORY

Where R is the resistance, is the materials resistivity, L the length of the


material and A the cross section area. This equation indicates that a high resistivity
will lead to a high resistance and vice versa. According to [AEMC Instruments,
2008], dry top soil has a resistivity greater than 109 cm, while top soil with a
2.5% moisture content has a resistivity of 250,000 cm. Hence, the more water the
soil contains the easier it is for the soil to conduct electricity. To put it simply, dry
soil conducts electricity poorly because of a high resistance while moist soil conducts
electricity more easily because of a lower resistance. This is the basis of how the
soil moisture level is determined. A current is sent through one of the electrodes
and the voltage between the electrodes is measured.

Temperature
Temperature sensing can be accomplished by two different methods, either with
contact or non-contact. Contact temperature sensors require physical contact with
the substance or object that is being sensed. This type of sensor can be used
on solids, liquids and gases. Non-contact type of temperature sensors detects the
emitted infrared energy from an object or substance and can be used on solids and
liquids [Watlow, 2015]. The focus will therefore be put on contact temperature
sensors seeing as non-contact temperature sensors cannot be used on gases. The
most common contact temperature sensors, such as thermocouples or thermistors,
use either voltage signals or resistance values to determine the temperature.
A thermocouple uses voltage signals to measure the temperature. It consists of
two junctions of dissimilar metal wires. The temperature is measured at the junction where the wires are welded. A voltage signal is generated when the junction
experiences a temperature change. The temperature can then be calculated using
thermocouple reference tables to interpret the voltage [REOTEMP Instruments,
2011]. Thermocouples can determine temperatures ranging from below 200C to
about 2000C, making it the sensor with the widest range of temperatures [Electronics Tutorials, 2014b].
A thermistor is a thermally sensitive resistor that uses resistance values to determine the temperature. It is made of a semiconductor and changes its physical
resistance when exposed to temperature changes [National Instruments, 2013]. The
price of a thermistor is relatively low and the accuracy is high within its operating
range [European Virtual Institute for Thermal Metrology, 2012]. Thermistors generally have a NTC, a negative temperature coefficient, which means that it decreases
its resistance with an increased temperature. They can, however, also have a PTC,
a positive temperature coefficient. A current has to be sent through the thermistor
in order to get a measurable voltage, which makes the thermistor a passive resistive
device [Electronics Tutorials, 2014b].
Due to the fact that thermocouples have a wide range of temperature, they
are well suited for both high and low temperatures as well as highly fluctuating
temperatures. Thermistors have a much smaller range of temperatures than thermocouples. They are on the other hand highly sensitive, which gives a high accuracy
6

2.3. HEATING FAN

over a small temperature range. This project does not require a wide range of temperatures since the greenhouse is placed in an environment where the temperature
barely fluctuates. Consequently, the chosen type of sensor is a thermistor. The fact
that this kind of temperature sensor is both cheap and readily available has also
added to the reasoning behind the decision.

2.3

Heating Fan

The building components of the heating fan are a computer fan, a heat sink and
a power resistor. A Pulse Width Modulation, PWM, signal is used to control the
speed of the fan and a power resistor to generate the heat.

Computer Fan Control


Small computer fans are powered by brushless DC motors. They typically have three
or four pins. The red and black are normally positive and negative power supply.
The third pin is usually yellow and is a tachometer output that counts revolutions.
The fourth pin is usually blue and enable PWM control [Giorgos Lazaridis, 2010].
With a four pin fan the PWM signal can be controlled. The PWM duty cycle
match the speed of the fan, 100% duty cycle is equal to full speed of the fan.
Most fans has an area where the signal is undetermined and the RPM can not be
controlled, this is below 30% of maximum RPM [Intel Corporation, 2004].
To avoid the undetermined area and be able to set the duty cycle to 0% a
transistor can be used to block the current, since they can act as switches.
The two most common types of transistors are bipolar junction transistors and
field effect transistors. They can control the current passing though the transistors.
A bipolar junction transistor is controlled by an direct current while the field effect
transistors is controlled by a voltage. In this project a bipolar transistor is used
since it can easily be controlled from the Arduino 5 V pin [Johansson, 2013].
A bipolar junction transistor has three leads for connection, called base, emitter
and collector. The emitter is the negative lead, the collector is the positive lead and
the base activates the transistor [V. Ryan, 2002].

PWM
PWM is a technique used to feed a load a pulsing voltage signal that will be perceived as a direct current, DC, voltage. By switching the voltage on and off, an
average voltage is achieved. This method is illustrated in figure 2.1.

CHAPTER 2. THEORY

Figure 2.1. PWM-signal with definitions

The average value is dependant on the duty cycle, d which is the percentage
of the period where the load is fed a voltage. The following equation shows the
relation between the duty cycle, pulse width and the period, T [Johansson, 2013].
p
(2.2)
T
By changing the pulse width, p, the average voltage seen by the circuit is
changed. In short, PWM is a method used to get analog results from digital signals.
d=

Power Resistor
The heat is generated from a power resistor and transferred to a heat sink. The
given parameters for all power resistors are the resistance, maximum power and temperature range. By combining the resistance and the power the maximum voltage
and current can be calculated by using

and

Umax = RImax

(2.3)

Pmax = Umax Imax

(2.4)

where Umax are the maximum voltage, R the resistance, Imax the maximum current
and Pmax the maximum power.

2.4

Watering System

The watering system is made up of a water tank, a hose, a nozzle, a relay and a
circulator pump.

Circulator Pump
Circulator pumps look different depending on the substance they will pump or
circulate or what their function will be. These kinds of pumps can be used on both
8

2.4. WATERING SYSTEM

liquids and gases. Some pumps are made for closed circuits and others are made
for open [Grundfos, 2009]. Common areas of use are in heating or cooling systems,
but they can also be found in aquariums. This project requires a circulator pump
that is made for liquids since the pump will supply water to the plants.

Relay
A relay operates as an electromagnetic switch. It can control a high voltage circuit by using only a low voltage control signal. The building components of an
electromechanical relay are basically a fixed coil, a movable armature, a spring and
contacts. The number of contacts varies from one pair to several. The coil generates
a magnetic field when a low voltage control signal has been sent. As a consequence
of this, the armature is attracted by the magnetic field so that it pushes the contact
pair towards each other. This completes the high voltage circuit. The spring is
attached between the coil and the armature. When the control signal is no longer
sent to the circuit the spring pulls the armature back to its original position.
Electromechanical relays are categorized into two types, Normally Open (NO)
and Normally Closed (NC). The contacts on a NO relay are only closed when a
current is sent through the relay. In a similar way, the contacts on a NC relay are
only open when a current is sent through the relay. A NO relay is preferred when
the controlled circuit will be off most of the time and a NC is preferred when the
circuit will mostly be on [Electronics Tutorials, 2014a].
The number of pins depends on the required connections for the circuit. When
AC is used, both of its leads have to be connected to the relay since the current can
flow in either direction.

Chapter 3

Demonstrator
This chapter presents the construction of the greenhouse and how the theory was
implemented.

3.1

Problem Formulation

To obtain and retain a perfect temperature in the greenhouse the fan and heater
was used. The fan was running when the temperature was above the upper limit
of an accepted range, as well as when the temperature fell below the lower limit.
The heat was also turned on when the temperature was below the lower limit. This
range was divided into five states with two grey areas, and these are illustrated in
figure 3.1. The accepted range was used to create smoother transitions between the
states. Depending on the detected temperature, different states of the actuators
was entered.

Figure 3.1. Fan and heating control at different temperature

11

CHAPTER 3. DEMONSTRATOR

The microcontroller enters state one when it is too cold in the greenhouse. This
state initially activates the heat and the fan is later run at its full speed to increase
the temperature. After a while, when the temperature is at Tp 2 , the microcontroller
will enter state two, in which the speed of the fan decreases to 40% and the heat
remains on. This allows a slow and steady heating of the whole greenhouse, and
not only the air.
The temperature eventually reaches Tp , where state three is entered and both the
fan and the heater are turned off. However, the heater wont cool down immediately
which can result in a small increase of temperature. Additionally, walls and other
solid materials in the greenhouse cool down slower because of more mass than the
air which could also result in temperature stabilisation due to walls emitting extra
heat.
If the temperature in the greenhouse rises above Tp+ 2 the microcontroller will
enter state five, and the fan will operate at full speed. When the temperature has
decreased to Tp+ 2 , state four is entered and the speed of the fan is decreased to
60%. This is similar to state two, where a slow and steady change of temperature
is desired, but in this case it concerns the cooling of the greenhouse. Eventually the
temperature will fall to Tp , which implies that state three has been entered, and the
fan is turned off. This ensures that the temperature will not stop decreasing until
it reaches the preferred temperature in the third state.
The two grey areas are at Tp 1 and Tp+ 1 . These areas are undefined and the
actions of the actuators will remain the same as they were in the preceding state.
If the temperature rises to Tp 1 from state two, and consequently enter the first
grey area, the fan will still run at 40% and the heat will stay on. If the first grey
area has been entered through a temperature decrease from state three, the fan and
heater will both be off. The same goes for the second grey area between the third
and fourth state. If the grey areas are entered without a previous state, the grey
areas are considered the same as the third state.
The algorithm ensures that the temperature will stay around state three. In
figure 3.1 this is illustrated by arrows enclosing state three and parts of state two
and four as the accepted temperature area. By doing this, the energy consumption
of the greenhouse will be reduced because both the fan and the heat are turned off
in state three.
The preferred temperature for basil is presented as Tp in table 3.1 [Stodola and
Volk, 2000].
Table 3.1. Preferred temperature for basil

Tp 2
21

Tp 1
23

Tp
24

Tp+ 1
25

Tp+ 2
27

unit
C

These values were not used until the final test of the whole system of the greenhouse.
12

3.2. SOFTWARE

3.2

Software

The control loop of the system is dependent of the five states earlier discussed and
follows the flow chart displayed in figure 3.2. The program starts without being in
a state but after the first run a state has been entered.

Figure 3.2. Flow chart of the heating fan

At first the temperature is read and depending of its value a state is entered and
an action of the fan and heater are actuated. The loop saves the previous state so
if a grey area is entered the correct action can operate. In the end of the loop the
soil moisture value is read and if the value is below the measured limit the pump
will be operated.
The first time state one or two is entered the loop is delayed for three and a half
minute to let the power resistor to heat up before the fan is tuned on for 15 seconds.
If state two is entered from state one or two the delay is set to 45 seconds and if
state one is entered the delay is set to one minute. State one has a longer delay
than state two because the fan is set to full speed which will further cool down the
power resistor. The temperature is read every 15 second and an action will operate
during those 15 seconds.

3.3

Electronics

Sensors
The air temperature was measured by using the sensor DHT11 [D-Robotics UK,
2010], which is a combined temperature and humidity sensor. It can measure tem13

CHAPTER 3. DEMONSTRATOR

peratures between 0C and 50C and the relative humidity range in 25C is 20-90%.
This project only utilizes the temperature sensing part of the sensor.
The sensor is connected through single-wire serial interface with the microcontroller. One transmission between the sensor and Arduino takes about 40 ms and
contains 40 bit of data. Every bit transmission starts with a low-voltage and depending on the length of the following high-voltage a 1 or 0 is determined.

Power Resistor
For heat generation, 20 watts of power was chosen but for safety margin a 25 watts
power resistor was used. An important factor for the resistor is the temperature
range and a higher maximum temperature is preferred. The used one has a maximum temperature of 200C. The last chosen parameter was the resistance. A higher
resistance gives less current which gives higher voltage according to equation (2.4)
combined with equation (2.3). The used power resistor has the resistance of 12 .
This results in maximum voltage of 15.5 V and maximum current of 1.29 A. The
used aluminum housed resistor is a HS25 manufactured by Arcol [Arcol, 2012]. A
transistor was used to control the power supply to the power resistor so that it could
be turned off and on at the specified temperatures.

Transistor
A PWM signal will be sent to the base of the transistor and it will switch on and
off depending on the signal. A TIP152 transistor was determined to be appropriate
for this project with its maximum voltage of 12 V and maximum current of 1.2 A
[SPC Multicomp, 2008].

Relay
This project used G2R-2A relay with flux protection [OMRON Corporation, 2012].
Considering the fact that the relay will act as a switch for the pump, which will be
turned off most of the time, a NO relay was chosen.
The relay was connected to the cord of the pump by first cutting the cord in
half. It is also connected to a diode, a transistor and a resistor. This is illustrated
in the electrical circuit in Figure 3.3.

14

3.3. ELECTRONICS

Figure 3.3. Electrical circuit of the relay, resistor, transistor and the diode

System Setup
The whole system is connected to one Arduino board with common ground. The
temperature control system is connected to the Arduino in figure 3.4. The DHT11
sensor is connected to a digital pin and the 5 V pin on Arduino. The fan is powered
by an external 5 V power source and is controlled by a signal from a digital output
through a transistor. The power resistor is, similarly to the fan, controlled by a
digital signal through a transistor and powered by an external power source.

15

CHAPTER 3. DEMONSTRATOR

Figure 3.4. Schematic over temperature control

The electronic part of watering system consists of the soil moisture sensor and
the relay for the pump. Both of these components share the same power source as
the temperature sensor, the Arduino 5 V pin. The relay is connected to a digital
pin while the soil moist sensor is connected to an anolog pin.

3.4

Hardware

The greenhouse is constructed with a cut-out in one of its short sides where the
heater is placed. The pump and fan are placed on the outside of the greenhouse.
The basil was watered from the tank by a hose that enters the greenhouse through
the same short side as where the heater is placed. The soil moisture sensor is placed
in the basil pot and the temperature sensor is placed inside the greenhouse on the
opposite side of the heater. This is illustrated in figure 3.5.

16

3.4. HARDWARE

Figure 3.5. 1) Temperature control system, 2) hose, 3) greenhouse, 4) soil moisture


sensor, 5) temperature sensor and 6) basil pot.

The Arduino and the remaining electronic components are all placed on the
outside of the greenhouse.

Temperature Control
A pipe, a power resistor, a heat sink and a fan are used to manipulate the greenhouse
temperature. The power resistor is attached to the heat sink by wrapping a wire
around the resistor and the heat sink. A pipe that encloses the fan and the heat
sink with the power resistor was made. By using a pipe, the airflow from the fan is
directed towards the warm heat sink and warm air flows into the greenhouse. The
power resistor attached to the heat sink is faced towards the fan. Figure 3.6 shows
how these components are set up.

Figure 3.6. 1) Computer fan, 2) pipe, 3) heat sink and 4) power resistor

17

CHAPTER 3. DEMONSTRATOR

Watering System
The utilized circulator pump was an EHEIM compact 600 [EHEIM, 2015] and is
commonly used in aquariums. It can pump up to 600 litres of water per hour and
raise the water up to 1.3 metres. The operating voltage of the pump is 230 V.
A hose was used in order to water the plant with the pump. The hose was made
of transparent PVC, and has an inner diameter of 5 mm and an outer diameter of
7 mm. The diameter of the outflow of the pump is 13 mm. Consequently, a nozzle
was made so that the hose could be connected to the pump. The draft with exact
measurements of the nozzle can be found in Appendix A. Figure 3.7 illustrates the
setup of the pumping system. The relay, however, is not included in the figure.

Figure 3.7. 1) Water tank, 2) circulator pump, 3) nozzle 4) hose

3.5

Test Results

The executed tests can be divided into the testing of the watering system, the temperature control system and the whole system. The tool used to collect data from
the soil moister sensor is MATLAB with an Arduino support package [MathWorks,
2014]. The sensor values was saved and plotted in a graph over time. CoolTerm
is another program used to save values and set a timestamp on the saved values
[Roger Meier, 2015].

Soil Moisture Limits


This test resulted in the limit for dry soil and wet soil presented in table 3.2 as a
mean value with standard deviation.
The values were sampled 12 times from different spots in soil that was estimated
to be too dry or too wet through hand contact with the soil.
18

3.5. TEST RESULTS

Table 3.2. Limits of tested soil moisture values

Soil
Dry
Wet

Mean Value [V]


1.75
0.119

SD [V]
0.195
0.0445

Reliability of Soil Moisture Sensor


The soil moisture sensor was tested by a simple test of letting the sensor stay in
the same soil at the same spot for a period of time. The soil in this particular test
was dry. Samples were taken every ten seconds and the moisture values over time
is plotted in figure 3.8.

Figure 3.8. Soil moisture level at a fixed point in dry soil

Reliability of the Pump


The pump was tested by setting it up at the right height and position in the greenhouse with the hose leading to the position of a flower pot. The length of the hose
from the outflow to the point where the height was the same as the pump was 50
cm. The pump was turned on for two seconds three times and a cup was filled. This
resulted in an average volume of 100 ml with a standard deviation, SD, of 1.7 ml.
This test was repeated three times to receive the data. With this data the water
flow in the hose was calculated to 21.6 ml/s on a minimum speed.
This test was also applied to test the amount of water suitable for the tested
basil plant. An appropriate amount of water to the basil plant was determined to
19

CHAPTER 3. DEMONSTRATOR

be 10 ml. The tested operating time for the pump was therefore set to 750 ms and
the cup was weighed after each pump. The scale had an accuracy of 1 gram. This
test was repeated twelve times and the mean value was 9.58 ml with a SD of 0.90
ml.

Cool Down of the Greenhouse


The ability to cool down the temperature in the greenhouse was tested by warming
the greenhouse up and setting the preferred temperature to one degree below the
room temperature at the time of the test. In figure 3.9 the change of the temperature
is illustrated over time.

Figure 3.9. Decreasing temperature over time

At the starting point of the test, state 5 was entered and the fan was on full
speed. When the temperature fell below 30C state 4 was entered and the fan slowed
down to 60%. State 3 was entered at 27C but the fan was not turned off until it
reached 26C which was the preferred temperature, Tp .

Warm Up of the Greenhouse


The ability to warm up the greenhouse was tested by setting Tp to a temperature
above the room temperature, in this case 28 C. This is illustrated in figure 3.10.

20

3.5. TEST RESULTS

Figure 3.10. Increasing temperature over time

At the starting point of the test, state 2 was entered. The first time state one
or two is entered the control loop allows the power resistor to heat up for three and
a half minutes before the fan is turned on and blows hot air into the greenhouse for
15 seconds. In this test, state 2 was reentered in the second loop but this time the
power resistor was heated up for 45 seconds. The heater was not turned off until
it reached 28C which was the set Tp . The temperature was then stabilized around
27C in state 3.

Final Test
The last test was to test the whole system at the same time. The room temperature was colder than the preferred temperature range for basil. In figure 3.11 the
temperature is plotted over time.

Figure 3.11. Temperature over time

At the starting point of the temperature graph the greenhouse had obtained the
21

CHAPTER 3. DEMONSTRATOR

room temperature at 21C. The preferred temperature was 24C. When the control
loop was operating the temperature varies from 22C to 24C.
The watering system was tested by placing a dry basil plant in the greenhouse.
This test is similar to the reliability test of the soil moisture sensor but with watering
of a plant. In figure 3.11 the moist values are illustrated over time.

Figure 3.12. Soil moisture values over time

The plant was watered at the beginning of the control loop, which resulted in
a decrease in the moisture value. After some time the water spread in the pot and
the basil absorbed some, this resulted in an increase of the value. The data from
this test was sampled at the same time as the temperature in figure 3.11.

22

Chapter 4

Discussion and conclusions


The results of the tests are discussed in this chapter and conclusions are made as
well.

4.1

Discussion

The discussion is divided between the two different control systems.

Watering System
The assessment of the soil moisture limits have been dependant on the estimation
of two people. This does not ensure an accurate estimation and another way of
finding the limits should be used instead. Alternatively, using the estimation of a
handful of people to set the limits.
In the result of the soil moisture sensor reliability test, plot in Figure 3.8. The
voltage has dropped about 0.6 V over the course of about one hour at a fixed point
in the soil. This result is strange since this means that the soil moisture level
increased. The result makes the sensor seem unreliable. However, the plot seems
fine in Figure 3.12. The sensor gives more reliable values for wet soils than dry.
Further tests should be executed in order to gain a proper opinion of the sensor
reliability.
Different watering systems can be used and most of these systems will be dependant on a soil moisture sensor. However, the soil moisture sensor reads different
values depending on its position in the soil. This makes it difficult to find a position
where the moisture level represents the state of the entire flower pot. This problem
could possibly be solved by using several sensors instead or changing the way the
water is poured into the soil. In these tests, the water has been poured directly
from the opening of the hose. Another way could be to form the hose into a circle
placed on top of the soil. The hose could have holes in it so that the soil is watered
from several smaller holes in a circular pattern.
23

CHAPTER 4. DISCUSSION AND CONCLUSIONS

The reliability test of the pump shows good results since the standard deviation
is less than 0.9 ml. Figure 3.12 shows that the soil moisture level never reaches a
value below the lower limit. This implies that the pump gives an accurate amount
of water.

Temperature Control System


The two tests of the temperature control can be considered successful, the temperature decreased when it was too hot at the beginning and increased when it was too
cold at the beginning. The scope of this project was limited to room temperatures
colder than the preferred temperature but the test of cooling the greenhouse down
can be useful if the sun has warmed up the greenhouse. On the other hand the test
of warming the greenhouse up will be of more importance according to the scope.
In the long run test presented in figure 3.11 it can be seen that the system is
stable at 23C but varies between 22C and 24C. This range is within the accepted
temperature range of basil.
In the problem formulation it is mentioned that a small increase of temperature
could be seen when the heater is turned off. This has not shown in any of the tests.
The reasons to this is most likely that the increment is to small to be discovered by
the sensor since the accuracy is 1C.

4.2

Conclusions

The watering system is not fully developed. The pumping part can be seen as
reliable since it will pump the same amount of water each time. The sensing of the
soil moisture has to undergo some development to be considered reliable.
The temperature control system is successful. The temperature can be stabilized
in the desired range for an optimal climate for basil.

24

Chapter 5

Recommendations and future work


This chapter presents some recommendations and a couple of examples on how this
project could be further developed.

5.1

Recommendations

Testing different ways of distributing the water into the flower pot is recommended
to find the most accurate method. Instead of measuring the soil moisture limits
with the sensor another tool could be used to get more exact values. Doing this
could improve the watering system.
A thermocamera would have been a good tool to have when optimizing the
temperature control system since that would allow an overview of the temperature
dissipation. This would enable a surveillance of the temperature around the power
resistor so that its operating time could be optimized before turning the fan on.

5.2

Future work

Light, carbon dioxide and air humidity regulation would have been added to the
project if more time was given. This will make for a good climate control system.
Furthermore, most plants have one temperature preference during the day and a
different one at nighttime. The temperature control system could therefore be further developed by introducing a third sensor that can sense the amount of daylight
that is present in a room. This would make it possible to change the preferred
temperature range during the course of the day.

25

Bibliography
[AEMC Instruments, 2008] AEMC Instruments (2008).
Why Measure Soil Resistivity?
Available from:
http://www.pema.ie/PDFs/
App-Ground-SoilResistivity.pdf [cited 2015-03-07].
[Arcol, 2012] Arcol (2012).
HS Aluminium Housed Resistors.
Available from: http://www.arcolresistors.com/wp-content/uploads/2014/03/
HS-Datasheet6.pdf [cited 2015-05-07].
[Arduino, 2015] Arduino (2015). Available from: http://www.arduino.cc/ [cited
2015-03-08].
[D-Robotics UK, 2010] D-Robotics UK (2010). DHT11 Humidity and Temperature
Sensor. Available from: http://www.micro4you.com/files/sensor/DHT11.pdf
[cited 2015-03-08].
[EHEIM, 2015] EHEIM (2015). Small and powerful, quiet and adjustable. Available from:
https://www.eheim.com/en_GB/products/technology/pumps/
compact-600#technology [cited 2015-05-06].
[EkoWeb, 2014] EkoWeb (2014). Half-year Report For The Organic Food Market
in Sweden. In Ekogalan, pages 1,4, Stockholm, Sweden.
[Electronics Tutorials, 2014a] Electronics Tutorials (2014a).
Electrical Relay.
Available from: http://www.electronics-tutorials.ws/io/io_5.html [cited
2015-05-11].
[Electronics Tutorials, 2014b] Electronics Tutorials (2014b). Temperature Sensors.
Available from: http://www.electronics-tutorials.ws/io/io_3.html [cited
2015-05-10].
[European Virtual Institute for Thermal Metrology, 2012] European Virtual Institute for Thermal Metrology (2012). Thermistor. Available from: http://www.
evitherm.org/default.asp?lan=1&ID=1000&Menu1=1000 [cited 2015-05-11].
[Giorgos Lazaridis, 2010] Giorgos Lazaridis (2010). How PC Fans Work. Available
from: http://pcbheaven.com/wikipages/How_PC_Fans_Work/ [cited 2015-0506].
27

BIBLIOGRAPHY

[Grundfos, 2009] Grundfos (2009). Cirkulationspump. Available from: http://


www.veab.se/docs/Doc218.pdf [cited 2015-05-12].
[Intel Corporation, 2004] Intel Corporation (2004). 4-Wire Pulse Width Modulation (PWM) Controlled Fans . Available from: http://www.formfactors.org/
developer%5Cspecs%5Crev1_2_public.pdf [cited 2015-05-06].
[ISAAA, 2014] ISAAA (2014). Delayed Ripening Technology. Pocket K, (12):1.
[Johansson, 2013] Johansson, H. (2013).
Elektroteknik.
Maskinkonstruktion Mekatronik, KTH, 2013 edition.

Institutionen for

[MathWorks, 2014] MathWorks (2014). Arduino Support from MATLAB. Available from: http://se.mathworks.com/hardware-support/arduino-matlab.
html [cited 2015-05-07].
[National Instruments, 2013] National Instruments (2013). Understanding and
Choosing Thermistors. Available from: http://www.ni.com/white-paper/
4925/en/ [cited 2015-05-10].
[OMRON Corporation, 2012] OMRON Corporation (2012). Cirkulationspump.
Available from: http://www.farnell.com/datasheets/1702858.pdf [cited
2015-05-13].
[REOTEMP Instruments, 2011] REOTEMP Instruments (2011). What Is a Thermocouple? Available from: http://www.thermocoupleinfo.com/ [cited 201505-10].
[Roger Meier, 2015] Roger Meier (2015). Roger Meiers Freeware. Available from:
http://freeware.the-meiers.org [cited 2015-05-13].
[SPC Multicomp, 2008] SPC Multicomp (2008). TIP152. Available from: http:
//www.farnell.com/datasheets/48233.pdf [cited 2015-05-06].
[Stodola and Volk, 2000] Stodola, J. and Volk, J. (2000). Tidens stora bok om
Lkevxter. Prisma, 2000 edition.
[V. Ryan, 2002] V. Ryan (2002). Transistors. Available from: http://www.
technologystudent.com/elec1/transis1.htm [cited 2015-05-06].
[Watlow, 2015] Watlow (2015). Sensor Selection Guides. Available from: http:
//watlow.com/products/guides/sensor/ [cited 2015-05-10].

28

Appendix A

Draft of Nozzle
The exact measurements of the nozzle are seen in figure A.1. The measurements
are in mm.

31,36

17,4

13,4
1,7

12

29,97

12
DRAWN
CHECKED

NAME
D. Attalla
J. Tannfelt Wu

DATE
2015-05-07
2015-05-07

UNLESS OTHERWISE SPECIFIED


DIMENSIONS ARE IN MILLIMETERS
ANGLES X.X
2 PL X.XX 3 PL X.XXX

Figure A.1. Draft of Nozzle

29

TITLE
SIZE DWG NO

A4
FILE NAME: nozzle
SCALE: 3:1

KTH
Nozzle
REV

SHEET 1 OF 1

TRITA MMK 2015:22 MDAB075

www.kth.se