You are on page 1of 59

Jimma University

Jimma Institute of Technology


Faculty of Electrical and Computer Engineering
Industrial Control Stream

AGRICULTURE MONITORING SYSTEM BASED ON MIT ROBOT

A Thesis Submitted to Jimma Institute of Technology, Faculty of


Electrical and Computer Engineering, Jimma University
In Partial Fulfillment of the Requirement for the Degree of Bachelor of Science in
Electrical and Computer Engineering (Industrial Control Engineering)

By
Name ID_NO
1. Asnakech Tekle RU1133/10
2. Kalkidan Mahtabe RU1743/10
3. Rediat Berhanu RU2093/10
4. Tedy Wandiye RU2271/10
5. Tesfaye Baynesagn RU2286/10

Advisor: Mr. Zewde T.

JIMMA, ETHIOPIA
June, 2022
Agriculture Monitoring System Based on MIT Robot

Declaration
This is to certify that the thesis entitled “AGRICULTURE MONITORING SYSTEM BASED
ON MIT ROBOT” has been carried out by the below group members, which submitted to
Faculty of Electrical and Computer Engineering, Jimma Institute of Technology(JIT),
Jimma University, in partial fulfillment for the award of the Degree of Bachelor of
Science(B.Sc.) in Electrical and Computer Engineering, specialized in Industrial Control
Engineering. We declared that all sources of materials contained in the thesis are fully
acknowledged.

Student’s Name: Signature


Asnakech Tekle __________________

Kalkidan Mahtabe __________________

Rediat Berhanu __________________

Tedy Wandiye __________________

Tesfaye Baynesagn __________________

This final thesis has been approved for examination with our approval:

Advisor’s Name: Signature

Mr. Zewde T. __________________

Jimma University, JIT, Faculty of Electrical and Computer Engineering i


Agriculture Monitoring System Based on MIT Robot

Acknowledgement
First of all, we would like to thank God for the guidance and strength given to us to complete
this thesis. And we would like to thanks, To Jimma Institute of Technology, Faculty of
Electrical and Computer Engineering, for giving us the opportunity to carry out this final thesis.
Next, we would like to express the deepest gratitude to our advisor Mr. Zewde T. for the
guidance, inspiration and constructive suggestions that helpful us in the preparation of this final
thesis. Also, we the students of this group endeavored more to finalize this final project.
Therefore, we thank one another for our mutual supports. Finally, we extend our gratefulness to
one and all who are directly or indirectly involved in the successful completion of this project
work.

Jimma University, JIT, Faculty of Electrical and Computer Engineering ii


Agriculture Monitoring System Based on MIT Robot

Abstract
About 80% of Ethiopia’s economy is dependent on agriculture, but only 33% of the land is
suitable for agricultural purposes. Agriculture is the art and science of cultivating plants and the
soil to grow crops as well as raise livestock. Especially in Ethiopia, where agriculture has been
done by hand since ancient times. As the world is trending into new technologies and
implementations, it is a necessary goal to trend with agriculture also, but, in our country, there is
still nothing. Therefore, the objective of this work provides a model of an agriculture monitoring
system based on the MIT App Inventor robot, which helps the farmers carry out plant monitoring
on a farm robotically without the use of much manual inspection. Android applications are
capable of providing information about agriculture fields. This system has been proposed as an
MIT Robot Monitor agriculture system. The MIT Robot based Agriculture Monitoring System
makes use of wireless sensor networks that collect data from different sensors deployed at
various nodes and send it through the wireless protocol. This robotic monitor of agriculture uses
the MIT App Inventor system is powered by Arduino. It consists of a temperature sensor, soil
moisture sensor, soil PH sensor, soil EC sensor, CO2 sensor, LDR sensor, humidity sensor, DC
motor, DC motor driver, and Arduino Uno. The agricultural field monitoring system based on
the MIT robot starts and checks the humidity, temperature, CO2 concentration, and EC value of
the conditions to monitor the health of plants and for their flourishing growth. It also checks the
moisture level in the soil, the PH of the soil, and light intensity to monitor the nutrition of the soil
for plant growth and plant production. It sends information to the Android phone about the levels
of all the sensors and displays the conditions of the plant. If the level of water in the soil goes
down, it automatically starts the water pump. If the temperature goes above the set level, the fan
starts, and if light intensity is in abnormal conditions, the light source starts. If the level of
humidity goes down, it automatically starts the water spray. All these are displayed on the LCD
display module and are also seen in the Android application which has been developed by MIT
App Inventor.

Jimma University, JIT, Faculty of Electrical and Computer Engineering iii


Agriculture Monitoring System Based on MIT Robot

Keywords: MIT App, temperature sensor, soil moisture sensor, soil PH sensor, soil EC sensor,
CO2 sensor, LDR sensor, humidity sensor, DC motor, DC motor driver, Bluetooth, Android
phone, and Arduino Uno.

Table of Contents
Declaration ....................................................................................................................................... i
Acknowledgement .......................................................................................................................... ii
Abstract .......................................................................................................................................... iii
List of Figure.................................................................................................................................. vi
List of Tables ................................................................................................................................ vii
Acronyms and Symbols ............................................................................................................... viii
CHAPTER ONE ............................................................................................................................. 1
INTRODUCTION .......................................................................................................................... 1
1.1 Background of Study ............................................................................................................ 1

1.2 Statement of Problems .......................................................................................................... 6

1.3 Objective ............................................................................................................................... 7

1.3.1 General Objective .......................................................................................................... 7


1.3.2 Specific Objective .......................................................................................................... 7
1.4 Scope of Study ...................................................................................................................... 7

1.5 Significance of Study ............................................................................................................ 8

1.6 Limitation of study................................................................................................................ 8

1.7 Methodology ......................................................................................................................... 9

CHAPTER TWO .......................................................................................................................... 10


LITERATURE REVIEW ............................................................................................................. 10
CHAPTER THREE ...................................................................................................................... 12
METHODOLOGY AND SYSTEM BLOCK DIAGRAM .......................................................... 12
3.1 System Block Diagram ....................................................................................................... 12

3. 2 Flow Chart of overall System ............................................................................................ 14

Jimma University, JIT, Faculty of Electrical and Computer Engineering iv


Agriculture Monitoring System Based on MIT Robot

3.3 Hardware Component Description ..................................................................................... 17

3.3.1 Arduino Uno ATmega328 ........................................................................................... 17


3.3.2 DHT11 Sensor ............................................................................................................. 19
3.3.3 Soil Moisture Sensor .................................................................................................... 20
3.3.4 LDR (Light Dependent Resistors) ............................................................................... 20
3.3.5 Soil PH Sensor ............................................................................................................. 21
3.3.6 Soil Electrical Conductivity (EC) Sensor .................................................................... 22
3.3.7 Carbon Dioxide Sensor ................................................................................................ 22
3.3.8 Bluetooth Module ........................................................................................................ 23
3.3.9 LCD (Liquid Crystal Display) ..................................................................................... 24
3.3.10 L293D Motor Driver Shield....................................................................................... 25
3.3.11 DC Motor ................................................................................................................... 26
3.3. 12 Relay ......................................................................................................................... 26
3.3. 13 Pump ......................................................................................................................... 26
3.3.14 Fans ............................................................................................................................ 27
3.3.15 Serial Communication ............................................................................................... 27
3.3.16 Robots ........................................................................................................................ 27
3.4 Software Description .......................................................................................................... 28

3.4.1 MIT App Inventor ........................................................................................................ 28


3.4.2 Arduino IDE................................................................................................................. 29
3.4.3 Proteus.......................................................................................................................... 29
CHAPTER FOUR ......................................................................................................................... 30
RESULT AND DISCUSSION ..................................................................................................... 30
CHAPTER FIVE .......................................................................................................................... 40
CONCLUSION AND RECOMMENDATION ............................................................................ 40
5.1 Conclusion .......................................................................................................................... 40

5.2 Recommendation ................................................................................................................ 41

References ..................................................................................................................................... 42
APPENDIX ................................................................................................................................... 44

Jimma University, JIT, Faculty of Electrical and Computer Engineering v


Agriculture Monitoring System Based on MIT Robot

List of Figure
Figure 1. 1 System methodology .................................................................................................... 9
Figure 3. 1 Block diagram of the overall system. ......................................................................... 12
Figure 3. 2 Flowchart of overall system. ...................................................................................... 16
Figure 3. 3 Arduino hardware. ...................................................................................................... 18
Figure 3. 4 DH11 sensor. .............................................................................................................. 20
Figure 3. 5 Soil moisture sensor. .................................................................................................. 20
Figure 3. 6 Light dependent resistor. ............................................................................................ 21
Figure 3. 7 Soil PH sensor ............................................................................................................ 21
Figure 3. 8 Soil EC sensor ............................................................................................................ 22
Figure 3. 9 MQ-135 sensor ........................................................................................................... 23
Figure 3. 10 Bluetooth module ..................................................................................................... 24
Figure 3. 11 LCD .......................................................................................................................... 25
Figure 3. 12 L293D motor driver .................................................................................................. 26
Figure 3. 13 Design of robot ......................................................................................................... 28
Figure 3. 14 Product structure diagram of Proteus software ....................................................... 30
Figure 4. 1 Overall Proteus simulation of the systems. ................................................................ 31
Figure 4. 2 The result of temperature, humidity, 𝐶𝑂2 and moisture at not normal conditions. .. 32
Figure 4. 3 System monitoring circuits. ........................................................................................ 35
Figure 4. 4 The result of plant at good conditions. ....................................................................... 35
Figure 4. 5 The result of moisture, 𝐶𝑂2 and PH at not normal .................................................... 36
Figure 4. 6 Android applications developed in MIT App ............................................................. 37
Figure 4. 7 The result of overall system with hardware. .............................................................. 38

Jimma University, JIT, Faculty of Electrical and Computer Engineering vi


Agriculture Monitoring System Based on MIT Robot

List of Tables
Table 1. 1 Recommendation value of most plants .......................................................................... 2
Table 3. 1 Specifications of Arduino UNO. ................................................................................. 19
Table 3. 2 Specifications of LCD ................................................................................................. 24
Table 4. 1 DH11 sensor reading and state of fan and heater ........................................................ 33
Table 4. 2 Humidity sensor reading and state of sprinkler ......................................................... 33
Table 4. 3 LRD sensor reading and the state of lamp ................................................................... 33
Table 4. 4 Soil moisture sensor reading and state of watering pump ........................................... 34

Jimma University, JIT, Faculty of Electrical and Computer Engineering vii


Agriculture Monitoring System Based on MIT Robot

Acronyms and Symbols


CPU Central Processing Unit
DC Direct Current
DHT Digital Humidity and Temperature
EC Electrical Conductivity.
FHSS Frequency Hopping Spread Spectrum
GDP Gross Domestic Product
GLCD Graphical Liquid Crystal Display
IDE Integrated Development Environment.
IC Integrated Chip
ICSP In-Circuit Serial Programming.
IoT Internet of Things
LED Light Emitting Diode.
LDR Light Dependent Resistor
LCD Liquid Crystal Display)
MIT Massachusetts Institute of Technology.
NTC Negative Temperature Coefficient.
OS Operating Systems.
PIC Peripheral Interface Controller
PH Potential of Hydrogen.
PWM Pulse-Width Modulation.
RAM Random Access Memory
ROM Read Only Memory
UI User Interface.
USB Universal Serial Bus.
UART Universal Asynchronous Receiver Transmitter.
𝐶𝑎𝐶𝑂3 Calcium Carbonate
𝐶𝑂2 Carbon Dioxide
H+ Hydrogen ions.

Jimma University, JIT, Faculty of Electrical and Computer Engineering vii


i
Agriculture Monitoring System Based on MIT Robot

NH3 Ammonia.
S Sulfur.
𝐶6 𝐻6 Benzene.

Jimma University, JIT, Faculty of Electrical and Computer Engineering ix


Agriculture Monitoring System Based on MIT Robot

CHAPTER ONE
INTRODUCTION
1.1 Background of Study
In Ethiopia, agriculture started during the Neolithic Revolution era, ten thousand years ago [1]. It
began with the domestication of crops and animals. So, agriculture is the largest economic sector
of Ethiopians, and it plays a great role in the economy of every nation. According to the statistics
of the Gross Domestic Product (GDP) of the country, accounting for half of the gross domestic
product, 83% of exports, and 80% of total employment, it contributes about 50% of the country’s
gross domestic product (GDP) and more than 80% of its exports [2, 3]. And agriculture is still
the backbone of the country, which represents about 33.88% of its GDP in 2020. In Ethiopia,
even today, traditionally, farming is done by humans with the help of bullock carts, oxen, and
tractors. However, these farms are facing various constraints that hamper crop productivity.
Major constraints include poor soil fertility; severe land degradation; high dependence on
rainfall; low availability and poor quality of seeds and fertilizers; economic constraints like low
income and lack of financial support; as well as insufficient policies and guidelines [4]. In the
modern era, the main problems in the agricultural field include lack of labor availability, lack of
knowledge regarding soil testing, increase in labor wages, wastage of seeds, and more wastage of
water [5]. To overcome these problems, automation technology was used in agriculture. To solve
these various problems, it developed and implemented a robot for an agriculture monitoring
system based on MIT and which is controlled by our Android phones. The main aim of this
thesis, which means robot for agriculture monitoring system, is to apply robotic technology and
to overcome problems that are related to plant farming in the agricultural field, which includes
monitoring climate (environmental) change, soil fertility, and soil health to plant growth and
crop production. These systems apply different automation solutions to diverse agricultural tasks
(e.g., irrigating, environmental monitoring, supply of water and nutrients, soil health, and
detection and treatment of plants). Agriculture monitoring robots can be used in a variety of field
operations and can be applied to facilitate capturing and processing high quantities of data. It can
provide the capabilities needed to operate not only at some plant levels, but also at the field level
[6]. A robot is a mechanical device which is capable of performing various tasks with minimal
human intervention. It means the robot works based on commands given by the controller. This

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 1
Agriculture Monitoring System Based on MIT Robot

system uses various sensors for sensing various parameters, such as temperature, soil moisture,
soil PH, soil EC, concentration, LDR or light intensity, and humidity. After sensing the above
parameters, it also recommended the farmer if the plant is not in good condition, and
recommended which plant is suitable in the field of that farmer. A motor driver circuit has been
used to drive the DC motor, which in turn controls the wheel motion. The control of the
agriculture monitoring robots mainly requires some means of communication. One of the
communication means is wireless Bluetooth connectivity. HC-06 is the Bluetooth module that is
used to control the agriculture monitoring robots using smartphones developed by MIT Apps. In
this system, the Arduino Uno (ATMEGA 328) microcontroller is the heart of the system, and it
receives data from sensors and generates an actuating signal to control the devices, namely, the
fan, heater, spray, and motor pump. Generally, agriculture monitoring robots mainly test the soil
health using soil moisture, soil PH, and soil EC and environmental or climate change using
DH11 and LDR sensors to monitor growth, health, and crop production of plants. These are also
significant environmental factors for the quality and better productivity of plant.
Plant Farming Systems
Ethiopia’s agriculture heavily relies on oxen plow and rain-fed by neglecting other alternative
technologies since the time of the Neolithic era [7]. As a result, traditional farming systems and
low production and productivity accurately reflect Ethiopian agriculture today. According to [7]
reference, the practice of mechanized agriculture in Ethiopia is estimated at 0.7% for land
preparation while it is less than 0.8% for crop thresher machines. These still indicated very little
transformation in the utilization of technologies in production. This system can develop
agriculture monitoring systems for plant farming. Plant farming is often a suitable field for
applying the technologies of automation, computing, and robotics [8]. The environmental
monitoring of plant farming is interesting not only to control the growth of crops but also to
determine the traceability of products [9]. Monitoring of these models determined the input,
output, and disturbance variables described below.

The input variables allow the system to actuate the plant farming and change the environmental
conditions. The most relevant variables considered by the system are the ventilation, heating,
pumping (shading), and spraying (fogging) systems. The ventilation or fan systems control the
exchange of air between the plant, and the environment, which has an impact on the air
temperature, humidity, and composition. The heating systems are used to compensate for the

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 2
Agriculture Monitoring System Based on MIT Robot

heat losses and keep the temperatures in an adequate range. The fogging systems spray water
into the air to increase the humidity and reduce the temperature. The shading systems control the
irradiation of the covers to avoid the overheating of the plant. Finally, the injection systems are
used to promote the photosynthesis of the plants. The MIT App application that we created
controls or toggles the above input variables on the Android phone.

The output variables define the state of the farm, and can be measured by the appropriate sensors
and are the target of climate control. The most relevant variables collected by the literature are
air temperature, air humidity, light intensity, and concentration. In addition, there are some
variables that have an influence on the state of the fields, and should be measured and controlled.
These are temperature, humidity, CO2 concentration, and light intensity. The above output
variable result is displayed on the Android phone application was developed on MIT Apps.
Another task in plant farming where robots can help is detecting soil health and fertility using
soil PH, soil EC, and soil moisture sensors for plant crop inspection and treatment to improve
precision and rationalize products. For more information, refer to "Info Center" on Android
phones.

Table 1. 1 Recommendation value of most plants

Plant Temperatu Humidity Moisture Light Soil PH Soil EC 𝐶𝑂2


re (°C) (%) (%) (%) (PH) (dS/m) (PPM)
Tomato 26 50-65 65-75 > 90 5.5-6.5 2.2-2.8 800-1000
Maize 8.9-28 70-85 40-80 > 90 6.0-7.5 1.2-2.8 400-1000
Rice 28-32 55-80 40-80 > 90 5.0-6.5 1.7-2.1 400-1000
Barely 15-25 60-80 40-80 > 90 6.0-7.0 4.5-5.5 400-1000
Wheat 15-30 55-75 40-80 > 90 6.0-7.0 3.9-5.0 400-1000
Potato 20-27 85-95 40-80 > 90 4.5-6.0 1.7-2.5 400-1000
Bean 22 -26 70-80 40-80 > 90 6.0-7.0 1.2-2.8 400-1000
Carrot 22-30 80-90 80-90 > 90 5.5-7.0 1.0-1.7 400-1000
Pea 25 -30 70-80 40-80 > 90 6.0-7.5 1.4-1.8 400-1000
Sugarcane 38 60-70 70-80 > 90 1.2-2.8 400-1000
Onion 24 65 40-80 > 90 6.0-7.0 1.8-2.2 400-1000

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 3
Agriculture Monitoring System Based on MIT Robot

Sweet 13-30 60-80 40-80 > 90 5.5-6.0 1.2-2.8 400-1000


potato
Cotton 13-30 80 65 > 90 5.5-7.0 4.3-5.5 400-1000

The Effect of Soil PH in Plant Farming.


Soil pH is a measure of the acidity or alkalinity of soils. On the pH scale, pH 7.0 is neutral.
Below 7.0 is acidic and above 7.0 is basic or alkaline. Soil pH affects nutrients available for plant
growth. In highly acidic soil, aluminum and manganese can become more available and more
toxic to plants, while calcium, phosphorus, and magnesium are less available to the plants. In
highly alkaline soil, phosphorus and most micronutrients become less available. A soil’s PH is
directly connected to its concentration of major nutrients as well as the composition of
microelements available for uptake by plants. When soil pH is extremely high or low, the plants
growing in it may suffer from nutrient deficiencies or toxicities. The desirable soil pH range for
optimum plant growth varies among crops. Most plants prefer soil pH ranges of 6.0 to 7.5
because most nutrients become available in this range. Soil pH is important because it affects the
availability of nutrients to plants. Nitrogen, phosphorus, and potassium are the primary nutrients
needed in fairly large quantities. Calcium, magnesium, and sulfur are secondary nutrients
required by the plant in lesser quantities. Zinc and manganese are micronutrients required by the
plant in very small amounts. Most secondary and micronutrient deficiencies are easily corrected
by keeping the soil at the optimum pH value [10].
What happens when pH is too low?
Common nutrient deficiencies associated with low pH, namely those of magnesium, phosphorus,
and calcium, since plants need access to a balanced diet of all the nutrients listed, it follows that a
low pH will lead to
 Low PH occurs when the soil PH is less than 5.5 PH.
 Nutritional imbalances that will harm your plants' health.
 The situation is allowed to persist. Persisting low pH is also thought to have knock-on
effects.
 There is a decrease in water uptake activity in plants.
 Disruption in the photosynthesis process

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 4
Agriculture Monitoring System Based on MIT Robot

How to increase pH value?


If you take a pH measurement and the reading is too low or too acidic, you'll need to increase the
pH by making it more alkaline. What you use to increase soil pH is the following.
 Adding calcium carbonate (CaCO3 ).
 Applying nitrogen and sulfur according to the needs of the crop grown.
 Wood ashes Wood ashes contain high amounts of potassium and calcium, and small
amounts of phosphate, boron, and other nutrients.
What happens when pH is too high?
Within an alkaline pH range, a number of nutrients become less soluble or available in high PH
soils. If your plants are dealing with a higher-than-optimal pH range, this could lead to the
toxicity of some nutrients and a deficiency of others. The most common nutrient deficiencies
associated with a higher pH include calcium, phosphorus, iron, and copper, but your plants are
likely to be experiencing a combination of nutrient deficiencies at the same time. These
deficiencies occur when the high pH causes some nutrients, such as iron and calcium, to
precipitate out, thereby becoming unavailable to your plants.

How to reduce pH value?


In soil, you'll also need to introduce a form of acid in order to lower the soil PH. To lower pH,
there are many options, depending on how urgently you need to lower your soil PH.
 Sulfur: is most commonly added to lower soil pH, although this breaks down slowly
over time, which means that your soil pH will only lower very gradually for the
bacteria in the soil to break down the sulfur into sulfuric acid.
 Ammonium: based fertilizers and organic matter.
 Aluminum sulfate: is preferred as it changes the soil pH as soon as it dissolves in the
soil because of the aluminum.
The Effect of Soil EC in Plant Farming.
EC stands for electrical conductivity, and it's seen as a measure of the total amount of food
available to your plants. When nutrients dissolve in water, they split into ions. Each of these ions
carries an electrical charge, which creates the potential for electricity to move through that
solution. Pure water, on the other hand, is a poor conductor of electricity as it doesn't contain
ions. The more ions a solution contains, the better it can conduct electricity.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 5
Agriculture Monitoring System Based on MIT Robot

What happens when EC value is too low?


If your EC is too low, your plants won't be able to get enough food, which could result in the
following symptoms:
 Leaf discoloration (leaves turn yellow or brown).
 Holes in the leaves or brown spots of necrosis.
 Stunted roots, leaves, and growth.
 Difference in crop yield.
 Studded, twisted, or misshapen leaves.
What happens when EC value is too high?
If your EC is too high, this can cause a number of issues, such as
 Nutrients or salt burn.
 Nutrient toxicities
 Leaf discoloration.
 High EC prevent plants from being able to get enough water.
1.2 Statement of Problems
As mentioned, agriculture plays a vital role in the economy of every nation. Especially for our
country, agriculture is our largest source of economy and has been one of the significant earnings
for producing food for human utilization since ancient times and still now. But as agriculture has
been our largest economic sector, it hasn’t change until now from the ancient strategical system.
Ethiopian agriculture outputs are challenged by the complex production constraints of abiotic
and biotic factors. Waterlogging in wetland areas, salinity in arid and semi-arid areas, acidity in
high rainfall areas, and erratic rainfall distribution are the common problems. In addition, the
country’s agriculture highly depends on rain-fed. The agricultural sector of Ethiopia has shown
remarkable resilience over many centuries, though it is now increasingly failing. The country is
known for the regular food shortages that occur due to droughts, sudden outbreaks of natural
disasters, pests, lack of rainfall, and technological advancement in the past centuries. The rapidly
increasing populations, the depletion of soil fertility, landlessness, climate change, deforestation,
and degradation of natural resources are serious problems for developing nations that need
urgent action. Ethiopia is among those developing countries that have been doing their best to
improve the agricultural sector in the last few decades, though much still remains. Overcoming

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 6
Agriculture Monitoring System Based on MIT Robot

these challenges is not an easy task. But one of the best methods to solve this problem is by
changing our traditional ways of farming into technological ways of farming, such as robot
agriculture monitoring systems and make knowledgeable farmers about the modern farming
system. So, as mentioned in the plant farming, we developed a robot that detecting
environmental or climate change, soil fertility, and soil health using different sensors and
displays the results on the android phones. This system not only detects sensor parameters, it also
treats plants from unbalanced nutrients (such as macronutrients and micronutrients) and
recommends farmers.
1.3 Objective
1.3.1 General Objective
The general objective of this thesis is to design and implement agriculture monitoring system
based on MIT App Inventor robot.
1.3.2 Specific Objective
 To build a battery-operated smart agricultural robot for multipurpose farm activities.
 To create Android apps in MIT App Inventor.
 To develop a system that interfaces plant monitoring systems with Android phones
 To made control pump, heater, and fan relay in android phones.
1.4 Scope of Study
This final thesis concerns agriculture monitoring systems based on MIT App Inventor robots,
which are mainly used for cultivating remotely based areas to save human labor, increase
production capacity, and protect the health and growth cycle of plants. The scope of the system is
to develop a multipurpose wirelessly controlled mobile agriculture monitoring robot. This
agricultural robot is designed and implemented using a wide range of technologies for the
advancement of agricultural automation. This can also make agriculture a zero-loss business. We
designed and implemented a robot that monitors plant health and production through sensors
such as soil PH, soil EC, soil moisture (to soil health), temperature, humidity, carbon dioxide,
and light intensity (climatically changes).

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 7
Agriculture Monitoring System Based on MIT Robot

1.5 Significance of Study


The developed agriculture monitoring system aims to modify all the activities and reduce the
drawbacks that the present system of manual operations faces. The major significances of this
thesis are:

 Speed up agriculture activities.


 Detect and monitor soil fertility and health to improve plant growth and production.
 Monitor environment conditions such as temperature, humidity, light intensity and 𝐶𝑂2
concentration to control the growth of crops and to determine the traceability of products.
 Pumping water/irrigations when soil moisture is dry or lack of rainfall is occurred.
 In farming field if the production capacity of plant can be reduced by organic and
inorganic factor, the system treats it to provide the maximum plant production capacity.
 Improving the effectiveness of soil protection measures, soil PH, soil EC, soil moisture
and raising public awareness on soil degradation.
 Made a system that solved the agriculture problems and recommended farmers.
1.6 Limitation of study
 The system only works within a limited distance due to the use of Bluetooth as wireless
communication.
 Some parameters are not fulfilled in prototype duet to unaffordable in economical and not
available in market ( soil PH sensor, soil EC sensor, Servo motor etc.)

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 8
Agriculture Monitoring System Based on MIT Robot

1.7 Methodology
The methodology which we used are as follows.

Searching and studying related


literature

Studying selecting of the


required material

Determine the specification


of the selecting materials

Design the circuit based on


their specification

Developing simulation
and write code

Developing prototype

Figure 1. 1 System methodology

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 9
Agriculture Monitoring System Based on MIT Robot

CHAPTER TWO
LITERATURE REVIEW
The development of our agricultural robots and the ideas used to implement them started with
the study of various papers. In recent years, many efforts have been made to change the
traditional agriculture system. Any smart agriculture system should operate in a systematic way
to maximize quality and productivity. This agriculture monitoring system based on the MIT App
Inventor robot thesis has been discussed among the previous research projects. Some selected
research papers have been chosen from the previous project as a literature review to identify the
gap and the difference between this thesis.

Chandana R, Nisha M, and Pavithra B [11] Design and implement a multipurpose agricultural
robot for automatic ploughing, seeding and plant health monitoring. The main aim of agricultural
robot is applying robotic technology in agricultural field. The agriculture robot efficiently
performs ploughing, seeding and mud leveling automatically. In this system Arduino Uno
microcontroller being the heart of the robotic system manipulates entire the action of the robotic
system. In addition to this the temperature and humidity sensors also been used. The sensory
data are displayed on LCD display.

Designing IoT based agricultural robot for monitoring plant health and environment [12] they
project is concerned with the farmer and the cultivation land. It uses a camera and all the sensors
which are used to monitor the agricultural land. It can be used from the plantation period to
harvesting period. It detects plant type and calculates the area of the field itself. The robot
monitors the field, checks the soil health based on moisture level and PH level. The plant health
is judged based on its leaf color.

Pushkar I Madrap and Amey Deshmukh [13] developed PIC microcontroller-based greenhouse
monitoring and control system. This paper represents the need of greenhouse and how much
effective they can be in good yield of crops and they automated greenhouse monitoring ignores
the need of human operators to take care of the plants. They monitor the greenhouse parameters
like humidity, temperature, soil moisture and light using PIC18F452 microcontroller and based
on the values stored, the above system will compare the stored values with threshold values set

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 10
Agriculture Monitoring System Based on MIT Robot

for particular plant and control the actions of cooler, heater, and water pump. For displaying the
stored values, they have used GLCD.

Designing IoT Based Plant Monitoring System [14] in this paper, humidity sensor, moisture
sensor, temperature sensors placed in root zone of plant and gateway unit (ESP8266) handles
the sensor information and transmit data to android application. This application is developed
for measure approximate values of temperature sensor, humidity sensor and moisture sensor that
was programmed into a microcontroller to control water quantity.

K.V.Fale and P.Bhure amit et al [15] designed an autonomous intelligent farming robot which
indicates plant health by observing the colour of their leaves and the height of the plant. It also
notes environmental conditions such as temperature, moisture and humidity. The health of the
plant is displayed on the LCD. The robot has also watered mechanism, it will water the plants
according to their needs by observing soil moisture and humidity. The main feature of the robot
is the ability to sense the health of the plants using image processing. Webcam will take the
photo inside the field and analyses the growth according to the height, colour of the leaves, etc.
Vision based row guidance method is used to guide the robot platform driven along crops
planted in row.

As has been literate, research papers all contain some limitations. Firstly, they used a Wi-Fi
module to transmit the data to the web server. But in real life (especially in our country), Wi-Fi is
difficult to find in an agricultural field. To overcome this, it has been using a Bluetooth module
to send data to a web server database. Second, the systems based on the Internet of Things (IOT)
and Artificial Intelligence (AI) are designed solely as immobile devices. But in our system, we
have designed a robot car to overcome both problems, which are unmovable and device-feature.
Finally, most of the systems that have been designed in the last decade and even in recent times
are designed only for detector purposes. But our system not only detects sensor parameters, it
also treats plants at normal environmental conditions, unbalanced nutrients (such as
macronutrients and micronutrients), and recommends the farmer. Generally, the agriculture
monitoring based on the MIT App Inventor robot system gives so many advantages to our farms
because the farms can easily be controlled by an Android phone.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 11
Agriculture Monitoring System Based on MIT Robot

CHAPTER THREE
METHODOLOGY AND SYSTEM BLOCK DIAGRAM
3.1 System Block Diagram
The development of the agricultural monitoring robot consists of the integration of hardware
techniques and software tools. The basic block diagram of the agriculture monitoring system
based on the MIT App Inventor is as show in figure 3.1.

Power supply

Temperature A
sensor 4*5V
L293D gear
R
Motor driver motor
Humidity
sensor D
U
Moisture LCD 20x4
sensor I display

N
Soil PH
sensor O Fan

Soil EC
Pump
sensor U
N Heater
CO2 sensor
O
LDR sensor Spray

Bluetooth Andirod phone

Figure 3. 1 Block diagram of the overall system.


The above figure shows the block diagram of the proposed system where the ATmega328
microcontroller board comprises an ARM-compatible central processing unit (CPU) acting as a
master controller, and it is the most important unit of this system. A microcontroller is a single-

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 12
Agriculture Monitoring System Based on MIT Robot

chip computer that contains the processor (the CPU), non-volatile memory for the program
(ROM or Flash), volatile memory for data input and output (RAM), a clock, and an I/O control
unit. The microcontroller is powered by a 12V DC battery and consists of a voltage regulator,
which is used to regulate the voltage input for the controller. The L293D motor driver is used to
control the bidirectional motion and receive signals from the microcontroller to drive the robots.
The DC motors control wheel motion and other activities of the robot.

In an agricultural monitoring system, there are seven different sensors, such as temperature,
humidity, soil moisture, light intensity, soil PH, soil EC, and CO2 sensor. These sensors act as
inputs to microcontroller systems. The input feed provided to the micro controller is in the form
of analog data, and the input data is converted by the controller into digital forms. The converted
data is shown on the Android phones via Bluetooth, which we developed using MIT App
Inventor, and we can control the robot in every direction via this Android application. There are
output parameters in this system such as fans, heaters, sprays, and water pumps that respond
automatically if the data from the input sensors is outside of the appropriate ranges. In the
system, input parameters such as temperature, humidity, LDR, and carbon dioxide sensors are
monitored climatically. If the results of these sensors are outside of a range that is not good for
the plant, the output parameters such as fans, heaters, spray, and water pumps give response
automatically and treat the conditions. The fan treats the temperature automatically if the result is
above the normal range, and the heater also treats the temperature if it is below the normal range.
The spray is used to spray water when the humidity is below the normal range, and the pump is
used to pump water when the moisture is dry. Another task of the system is monitoring soil
fertility and soil health by using parameters such as soil moisture, soil PH, and soil EC. The soil
PH sensor detects whether the soil is acidic, neutral, or alkaline in order to determine the type of
soil. The electrical conductivity (EC) sensor measures the number of salts in soil (salinity of soil)
in order to know the crop yields, suitability, nutrient availability, and activity of soil
microorganisms. The system will show the results of soil PH and EC values on Android phones
and LCD displays. If the soil PH and soil EC are out of the normal range, the serial monitor will
display the method of treatment, and it recommends more reference. The requirement for water
is identified by the soil moisture sensor. Soil moisture sensors will measure the moisture quantity
in the soil and the conditions of the soil, i.e., whether it is wet or dry. These sensors' output
signals are displayed on Android phones and LCD screens.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 13
Agriculture Monitoring System Based on MIT Robot

3. 2 Flow Chart of overall System

Start

Connect Bluetooth with Arduino

Connect Android phone with Bluetooth

K
Is phone No
connected with
Bluetooth?

Yes

Forward Backward Stop Left Right

Motor driver L293D

Robot Movement
A

Read soil PH Read soil EC Read Temperature

No No No
Ist PH Ist EC Ist Tmp
detect? detect? detect?

Yes Yes Yes


Soil PH Result Soil EC Result Temperature Result

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 14
Agriculture Monitoring System Based on MIT Robot

Is PH,EC &
Temp value
optimum?
No No
Yes
Plant is not at
Good Condition
Plant is at Good
Condition
Check solution in
android phone
K Info Center

Read Moisture Read Humidity Read LDR Read 𝐶𝑂2 Con’

No No No No
Is Moi Is Hu Is LDR Is CO2
Detect? Detect Detect Detect?
? ?

A
Yes Yes Yes Yes
Moisture Result Humidity Result LDR Result 𝐶𝑂2 Result

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 15
Agriculture Monitoring System Based on MIT Robot

Is Moi, Hum,
CO2, LDR at No
optimum
value?

Yes Plant is not at


good Condition

Plant is at good
Condition Check solution in
android phone
Info Center
K

Figure 3. 2 Flowchart of overall system.

The above figure 3.2 shows the overall flow chart that describes how the system program works.
The system program work starts, connecting the Bluetooth module in the Arduino Uno. Then
connect your Android phone with Bluetooth. After connecting your Android phone with
Bluetooth, check the connection between your Android phone and Bluetooth. If the connection is
correct, we can control the movement of the robot based on the button and motor shield. If the
connection between an Android phone and Bluetooth is not correct, it will be back to fix the
connection. Once the robot movement starts, we control the robot with an Android phone to go
to the desired areas and locations. After the robot is at the desired field area, the system will
receive analog data measured by the sensors, then apply all functions of the system's measured
environmental parameters. The functions are called one by one, and each one must be accessed
without any predefined consolation. After the parameter functions are applied, the value of
parameters and the state of the loads are displayed on Android phones if with hardware, and on
LCD if with software of Proteus. Digital data from the ADC of the microcontroller is changed
into or detected temperature, soil PH, soil EC, moisture, humidity, light intensity, and CO2

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 16
Agriculture Monitoring System Based on MIT Robot

concentration values and compared with the maximum preset values and displayed on Android
phones. If the resulted value of temperature, soil PH, soil EC, moisture, humidity, light intensity,
and CO2 concentration values exceeds the preset value, and if the resulted value of temperature,
soil PH, soil EC, moisture, humidity, light intensity, and CO2 concentration values is less than
the preset maximum value, it announces and displays the values, and also solves the problems
with recommendations.

3.3 Hardware Component Description


3.3.1 Arduino Uno ATmega328
ATMEGA 328 microcontroller, The ATmega328 is one kind of single-chip microcontroller
formed by Atmel within the megaAVR family, and it acts as a processor for the Arduino board.
It consists of nearly 28 pins. From these 28 pins, the inputs can be controlled by transmitting and
receiving the inputs to the external device. It also includes pulse width modulation (PWM),
which is used to send the entire signal in a pulse modulation. Input power supplies such as Vcc
and Gnd are used. It has an IC. This IC mainly consists of analog and digital inputs. These
analog and digital inputs are used for the process of certain applications [16]. Arduino Uno is
one kind of microcontroller board based on ATmega328, and this board includes 14 digital I/O
pins, a power jack, 6 analog inputs, ceramic resonator A16 MHz, a USB connection, an RST
button, and an ICSP header. All these can support the microcontroller for further operation by
connecting this board to the computer. The power supply of this board can be done with the help
of an AC to DC adapter, a USB cable, otherwise a battery. Arduino is an open-source platform
used for building electronics projects. Arduino consists of both a physical programmable circuit
board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated
Development Environment) that runs on your computer, used to write and upload computer
code to the physical board. Unlike most previous programmable circuit boards, the Arduino does
not need a separate piece of hardware (called a programmer) in order to load new code onto the
board, it simply uses a USB cable. Additionally, the Arduino IDE uses a simplified
version of C languages, making it easier to learn to program.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 17
Agriculture Monitoring System Based on MIT Robot

Figure 3. 3 Arduino hardware.

Power (USB) and pin configuration


Every Arduino board needs a way to be connected to a power source and it’s not allowed to use a
power supply greater than 20 volts as you will overpower and thereby destroy the Arduino. The
recommended voltage for most Arduino models is between 6 and 12 volts. The Arduino has
several different kinds of pins, each of which is labeled on the board and used for different
functions.
Ground: There are several GND pins on the Arduino, any of which can be used to ground the
circuit.
Power: The 5V pin supplies 5 volts of power, and the 3.3V pin supplies 3.3 volts of power.
Analog Pins: Analog in’ label (A0 to A5 on the UNO) is analog in pins. These pins can read the
signal from an analog sensor and convert it into a digital value that we can read.
Digital Pins: Across from the analog pins are the digital pins (D0 to D13 on the UNO). These
pins can be used for both digital input (like telling if a button is pushed) and digital output (like
powering an LED).
PWM Pins: The digital pins (3, 5, 6, 9, 10, and 11 on the UNO). These pins act as normal digital
pins, but it can also be used for something called Pulse-Width Modulation (PWM).

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 18
Agriculture Monitoring System Based on MIT Robot

AREF (Stands for Analog Reference): Most of the time you can leave this pin alone. It is
sometimes used to set an external reference voltage (between 0 and 5 Volts) as the upper limit
for the analog input pins.
Table 3. 1 Specifications of Arduino UNO.
MCU ATmega328P
Architecture AVR
Operating Voltage 5V
Input Voltage 6V – 20V (limit), 7V – 12V (recommended)
Clock Speed 16 MHz
Flash Memory 32 KB (2 KB of this used by bootloader)
SRAM 2 KB
EEPROM 1 KB
Digital IO Pins 24 (of which 6 can produce PWM)
Analog Input Pins 6

3.3.2 DHT11 Sensor


DHT11 consist of both humidity and temperature sensor. For measuring humidity there are two
electrodes with moisture holding substrate between them. So, when the humidity changes,
the resistance between these electrodes changes and conductivity of the substrate changes.
This change in resistance is measured and processed by the IC which makes it ready to be read
by a microcontroller. On the other side for measuring temperature DHT11 sensor use a
NTC temperature sensor or a thermistor. A thermistor changes its resistance with change of
the temperature because it is variable resistor. These sensors are made by sintering of semi-
conductive materials (ceramic and polymers), which provide large changes in the resistance
with just small changes in temperature. The term “NTC” means “Negative Temperature
Coefficient”, which means that the resistance decreases with increase of the temperature [17].

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 19
Agriculture Monitoring System Based on MIT Robot

Figure 3. 4 DH11 sensor.

3.3.3 Soil Moisture Sensor


The soil moisture sensor is one kind of sensor used to gauge the volumetric content of water
within the soil. As the straight gravimetric dimension of soil moisture needs to be eliminated,
drying as well as sample weighting. These sensors measure the volumetric water content not
directly but with the help of some other rules of soil like dielectric constant, electrical resistance,
interaction with neutrons, and replacement of the moisture content. It has four pins. The VCC pin
is used for power, the A0 pin is an analog output, the D0 pin is a digital output, and the GND pin
is a ground. This sensor mainly utilizes capacitance to gauge the water content of the soil
(dielectric permittivity). The working of this sensor can be done by inserting this sensor into the
earth and the status of the water content in the soil can be reported in the form of a percent [18].

Figure 3. 5 Soil moisture sensor.

3.3.4 LDR (Light Dependent Resistors)


An electronic component like an LDR, or light-dependent resistor, is responsive to light. Once
light rays drop on it, immediately the resistance will be changed. The resistance values of an
LDR may change over several orders of magnitude. The resistance value will be dropped when
the light level increases. The working principle of an LDR is photoconductivity, which is nothing
but an optical phenomenon. When the light is absorbed by the material, the conductivity of the
material is enhanced. When light falls on the LDR, then the electrons in the valence band of the

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 20
Agriculture Monitoring System Based on MIT Robot

material are eager to enter the conduction band. But, the photons in the incident light must have
energy superior to the bandgap of the material to make the electrons jump from one band to
another band (valance to conduction).

Figure 3. 6 Light dependent resistor.

3.3.5 Soil PH Sensor


Soil pH is a measure of the acidity or alkalinity of the soil and affects the amounts of nutrients
and chemicals that are soluble in soil water. Some nutrients are more available under acid
conditions, while others are more available under alkaline conditions. However, most mineral
nutrients are readily available to plants when the soil pH is near neutral. A pH value is actually a
measure of hydrogen ion concentration. Because hydrogen ion concentration varies over a wide
range, a logarithmic scale (pH) is used. When you take a pH measurement, the number you see is
based on the number of ions, specifically hydrogen ions (H + ). The total amount of these
hydrogen ions will determine the acidity or alkalinity; if there are more hydrogen ions present,
then your pH will be acidic (0–7) and if there are fewer H+ relative to hydroxyl groups OH + ),
the pH will be alkaline (7–14). A pH value of 7 is considered to be neutral. The Ph is the acidity
or basicity of a material, measured on a scale between 0 and 14. A Ph value of less than 7 is
considered acidic and greater than 7 is considered basic. If the pH scale is 7, then the material is
neutral and most ideal soil conditions for the growth and development of plants are neutral soil.
The Soil PH Sensor has 4 pins as it needs to be connected to Arduino. The four colored wires are
yellow, blue, black, and brown.

Figure 3. 7 Soil PH sensor

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 21
Agriculture Monitoring System Based on MIT Robot

3.3.6 Soil Electrical Conductivity (EC) Sensor


Soil electrical conductivity (EC) is a measure of the amount of salt in soil (salinity of soil). It is
an important indicator of soil health. It affects crop yields, suitability, nutrient availability, and
the activity of soil microorganisms. In agriculture, EC is used principally as a measure of soil
salinity. Soil salinity is a measure of the minerals and salts that can be dissolved in water. EC is
expressed in Deci Siemens per meter (dS/m), whereas salinity is expressed in mg/kg. EC does
not provide a direct measurement of specific ions or salt compounds but correlates to
concentrations of nitrates, potassium, sodium, chloride, sulfate, and ammonia. This is the reason
why measurement of soil electrical conductivity and soil salinity is important [19]. There are two
types of sensors commercially available to measure soil EC in the field. They represent two
distinct methods for collecting soil EC measurements: contact and non-contact. We use contact
methods in this system. This type of sensor uses electrodes, usually discs or coulters, that make
contact and penetrate the soil to measure the electrical conductivity. In this approach, two to
three pairs of coulters are mounted on a toolbar; one pair applies electrical current to the soil
while the other two pairs measure the voltage drop between them [20]. The Soil EC Sensor has 4
pins as it needs to be connected to an RS485 or MAX485 Module. The four colored wires are
yellow, blue, black, and brown.

Figure 3. 8 Soil EC sensor.

3.3.7 Carbon Dioxide Sensor


Carbon Dioxide (𝐶𝑂2) is a chemical compound that is an odorless, colorless gas at room
temperature. The compound consists of one carbon atom and two oxygen atoms. In the thesis we
use MQ-135 sensor to measured co2. The MQ-135 Gas sensor can detect gases like ammonia

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 22
Agriculture Monitoring System Based on MIT Robot

(NH3 ), sulfur (S), Benzene (𝐶6 𝐻6 ), 𝐶𝑂2, smoke and other harmful gases. Similar to other MQ
series gas sensor, this sensor also has a digital and analog output pin. When the level of these
gases goes beyond a threshold limit in the air the digital pin goes high. This threshold value can
be set by using the on-board potentiometer. The analog output pin, outputs an analog voltage
which can be used to approximate the level of these gases in the atmosphere. The MQ-135 gas
sensor has an inbuilt variable resistor (sense resistor) that changes its resistance value according
to the concentration of gas. If the gas concentration is high, the resistance decreases, and if the
gas concentration is low, the resistance increases. The MQ135 air quality sensor module operates
at 5V and consumes around 150mA. It requires some pre-heating before it could actually give
accurate results. The MQ135 is one of the popular gas sensors from the MQ series of sensors that
are commonly used in air quality control equipment. It operates from 2.5V to 5.0V and can
provide both digital and analog output. The pinouts and important components on an MQ135
module are marked below.

Figure 3. 9 MQ-135 sensor

3.3.8 Bluetooth Module


HC-06 is a Bluetooth module designed for establishing short range wireless data communication
between two microcontrollers or systems. The module works on Bluetooth 2.0 communication
protocol and it can only act as a slave device. This is cheapest method for wireless data
transmission and more flexible compared to other methods and it even can transmit files at speed
up to 2.1Mb/s. HC-06 uses frequency hopping spread spectrum technique (FHSS) to avoid
interference with other devices and to have full duplex transmission. The device works on the
frequency range from 2.402 GHz to 2.480GHz. HC-06 module has six pins as shown in the
pinout. But from them we only need to use four for successfully interfacing the module. The
communication with this HC-06 module is done through UART interface. The data is sent to the

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 23
Agriculture Monitoring System Based on MIT Robot

module or received from the module though this interface. So, we can connect the module to any
microcontroller or directly to PC which has UART interface [21].

Figure 3. 10 Bluetooth module

3.3.9 LCD (Liquid Crystal Display)


A liquid crystal display (LCD) is a thin, flat panel used for electronically displaying information
such as text, images and moving pictures. A typical liquid crystal producing degree shift in the
polarization of the light passing through when there is no electric field present. When a voltage
is applied, an electric field is produced in the liquid, affecting the orientation of the
molecules. In this system we use 20x4 LCD which it can display 20 characters per line and there
are 4 such lines.
LCD pin description
Pin 1 (VSS); is a ground pin and it is certainly needed that this pin should be grounded for LCD
to work properly.
VO and VDD; are given +5 volts normally. However, VEE may have a potentiometer voltage
divider network to get the contrast adjusted. But VDD is always at +5V.
RS, R/W and E: These three pins are numbered 4, 5 and 6 as shown above. RS is used to make
the selection between data and command register. For RS=0, command register is selected and
for RS=1 data register is selected. R/W gives us the choice between writing and reading. If set
(R/W=1) reading is enabled. R/W=0 when writing.
D0-D7; The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents
of LCD's internal register
Table 3. 2 Specifications of LCD

Pin No. Symbol Description

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 24
Agriculture Monitoring System Based on MIT Robot

1 VSS Ground
2 VDD Power supply for logic
3 VO Contrast Adjustment
4 RS Data/ Instruction select signal
5 R/W Read/Write select signal
6 E Enable signal
7~14 DB0~DB7 Data bus line
15 A Power supply for B/L +
16 K Power supply for B/L -

Figure 3. 11 LCD

3.3.10 L293D Motor Driver Shield


L293D is a basic motor driver integrated chip (IC) that enables us to drive a DC motor in either
direction and also control the speed of the motor. The L293D Motor driver shield is one of the
best ways for controlling DC motor, Servo motor, and Stepper motors in a single board. It can
control the rotation direction and speed of four DC motors, two Servo motor, and two Stepper
motors. The L293D is a 16 pin IC, with 8 pins on each side, allowing us to control the motor. It
means that we can use a single L293D to run up to two DC motors. L293D consist of two H-
bridge circuit. H-bridge is the simplest circuit for changing polarity across the load connected to
it. It has IN1, IN2, and IN3, IN4 are input pins used for providing a control signal from the
controller to run the motor in different directions and EN1 and EN2 are enable pins. Connect 5v
DC to EN1 and EN2 pin to operate the motor at its normal speed.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 25
Agriculture Monitoring System Based on MIT Robot

Figure 3. 12 L293D motor driver


Working of L293D Motor Driver IC
There are 4 input pins for direction control in L293D. Pin 2, 7 (1A and 2A) on the left side and
pin 15, 10 (3A and 4A) on the right of the IC. The left side input pins regulate the rotation of the
motor connected across the left end and the right-side input pins regulate the motor on the right-
side. The motors are rotated based on the inputs provided across the input pins as HIGH or LOW
signals.

3.3.11 DC Motor
A direct current (DC) motor is a type of electrical machine that converts electrical energy into
mechanical energy. DC motors takes electrical power through direct current, and convert this
energy into mechanical rotation. It uses magnetic fields that occur from the electrical current
generated, which powers the movement of a rotor fixed within the output shaft. The output
torque and speed depend upon both the electrical input and the design of the rotor.

3.3. 12 Relay
A relay is an electrical switch that opens and closes under the control of another electrical circuit.
In the original form, the switch is operated by an electromagnet to open or close one or many
sets of contacts. Because a relay is able to control an output circuit of higher power than the
input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.

3.3. 13 Pump
A water pump is a machine used to increase the pressure of water in order to move it from one
point to another. Modern water pumps are used throughout the world to supply water for
municipal, agriculture, and residential uses. Water pumps are easily available at a lower cost and

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 26
Agriculture Monitoring System Based on MIT Robot

are used to provide high irrigation efficiency by supplying the proper amount of water to every
area of the field to gain speed in cultivation. These pumps come in a wide range of varieties
where framers can easily buy based on the capacity of the pump as per their needs.

3.3.14 Fans
A fan is a powered machine used to create a flow of air. It consists of a rotating arrangement of
vanes or blades, generally made of wood, plastic, or metal, which act on the air. The rotating
assembly of blades and hub is known as an impeller, rotor, or runner. A fan can be any revolving
vane or vanes used for producing currents of air. It produces air flows with high volume and low
pressure (although higher than ambient pressure), as opposed to compressors, which produce
high pressures at a comparatively low volume. A fan helps replicate the same air movement that
happens naturally outdoors.

3.3.15 Serial Communication


In this model serial communication from modem to microcontroller are done by connecting Txd
and Rxd pins to modem Rxd and Txd pin respectively. And the third pin of modem is grounded.
In our hardware architecture we have interface modem to microcontroller directly without the
use of Max232 or RS232 and having proper results with proper communication. Max232 or
RS232 both are used as logic converter.

3.3.16 Robots
A robot is a type of automated machine that can execute specific tasks with little or no human
intervention and with speed and precision. Robot is reprogrammable, multifunctional
manipulator designed to move materials, tools through variable programmable for the
performance of a variety of tasks.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 27
Agriculture Monitoring System Based on MIT Robot

Figure 3. 13 Design of robot

Specification:
 Size of robot car: 22cmx10cm.
 Wheels diameter: 6cm.
 Thickness of board: 3cm.
 Length of board: 22cm.
 Width of board: 10cm.

Features:
 Mechanical structure is simple, so it is easy to assemble.
 This robot car has 4pcs deceleration DC motor, it can corner well.
 Can use with android phone to realize function of wireless remote control.

3.4 Software Description


3.4.1 MIT App Inventor
MIT App Inventor is a web application integrated development environment (WIDE) originally
provided by Google and now maintained by the Massachusetts Institute of Technology (MIT). It
allows newcomers to computer programming to create application software (apps) for two
operating systems (OS): Android and iOS [22]. MIT App Inventor is an online platform designed
to teach computational thinking concepts through the development of mobile applications, and it
is an online development platform that anyone can leverage to solve real-world problems. It uses

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 28
Agriculture Monitoring System Based on MIT Robot

a block-based programming language built on Google Blockly. The MIT App Inventor user
interface includes two main editors: the design editor and the blocks editor. The design editor, or
designer, is a drag and drop interface to lay out the elements of the application’s user interface
(UI). The Blocks editor is an environment in which app inventors can visually lay out the logic
of their apps using color-coded blocks that snap together like puzzle pieces to describe the
program. To aid in development and testing, app inventor provides a mobile app called the app
inventor companion (or just the companion) that developers can use to test and adjust the
behavior of their apps in real time. A key feature of MIT App Inventor is its live development
environment for mobile applications. App Inventor provides this by means of a companion app
installed on the user’s mobile device. The App Inventor web interface sends code to the
companion app, which interprets the code and displays the app in real time to the developer. This
way, the user can change the app’s interface and behavior in real time [23].

3.4.2 Arduino IDE


The Arduino Integrated Development Environment (IDE) is a cross - platform application (for
windows, macOS, Linux) that is written in functions from C and C++ . It is used to write and
upload programs to Arduino compatible boards and is an integrated development environment,
developed by arduino.cc. The Arduino IDE supports the languages C and C++ using special rules
of code structuring. The Arduino IDE supplies a software library from the wiring project, which
provides many common input and output procedures. User written code only requires two basic
functions, for starting the sketch and the main program loop, that are compiled and linked with a
program stub main () into an executable cyclic executive program with the GNU tool chain , also
included with the IDE distribution. The Arduino IDE employs the program avrdude to convert
the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board
by a loader program in the board's firmware. By default, avrdude is used as the uploading tool to
flash the user code onto official Arduino boards [24].

3.4.3 Proteus
Proteus is a complete development platform from product concept to design completion. Its
advantages are intelligent principal layout, hybrid circuit simulation and accurate analysis,
single-chip software debugging, single-chip and peripheral circuit co-simulation, PCB automatic
layout and wiring.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 29
Agriculture Monitoring System Based on MIT Robot

Figure 3. 14 Product structure diagram of Proteus software


Proteus is a complete embedded system software and hardware design simulation platform,
Proteus ISIS is an intelligent schematic input system, system design and Simulation of the
basic platform to achieve the combination of single-chip microcomputer simulation and
pspice circuit simulation. It has the functions of analog circuit simulation, digital circuit
simulation, system simulation composed of single chip microcomputer and its peripheral
circuit, RS232 dynamic simulation, I2C debugger, SPI debugger, keyboard and LCD system
simulation, and various virtual instruments, such as oscilloscope, logic analyzer, signal
generator, etc. ARES is a high-level PCB wiring editing software [25].

CHAPTER FOUR
RESULT AND DISCUSSION
This chapter deals the result and discussion of design simulation and implementation of a
prototype result of an agriculture monitoring system based on MIT robots. The overall protues
design result is as follow.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 30
Agriculture Monitoring System Based on MIT Robot

Figure 4. 1 Overall Proteus simulation of the systems.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 31
Agriculture Monitoring System Based on MIT Robot

Figure 4. 2 The result of temperature, humidity, 𝐶𝑂2 and moisture at not normal conditions.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 32
Agriculture Monitoring System Based on MIT Robot

Table 4.1 below shows how the output of the DH11 temperatures sensor vary with field plant
temperature variation and state of the fan and heater, as a result of this variation. As the table
shows the fan is automatically turned on when the temperature of the field is raised above the
optimum range of temperature and when the temperature falls below the optimum range the
heater is turned on automatically. At the optimum temperature range both the fan and heater are
turned off.
Table 4. 1 DH11 sensor reading and state of fan and heater
Temperature level displayed on LCD Heater state Fan state
< 15°𝐶 ON OFF
15°𝐶-30°𝐶 OFF OFF
> 30°𝐶 OFF ON

Pulse with different frequencies is used to represent the output of relative humidity sensor
(DH11) and it calculated from the frequency by the Arduino control program and displayed in
the LCD. As in table 4.2 given below the sprays is turned on when the humidity reading is less
than the minimum limit for the most plant, which is 40% humidity in the air, otherwise the
sprinkler is turned off.

Table 4. 2 Humidity sensor reading and state of sprinkler


Humidity level displayed on LCD State of the water spray
< 40% ON
>= 40% OFF

Table 4.3 given below shows the variation of measured light in the field and the state of the lamp
at each level of illumination. As can see from the given table below lamp is off if the light
illumination is rise above the specified maximum value for the most of plant which is above 92%
bright, otherwise the lamp is on.

Table 4. 3 LRD sensor reading and the state of lamp


Light intensity level displayed on LCD Lamp state
>= 90% OFF
< 90 ON

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 33
Agriculture Monitoring System Based on MIT Robot

As shown in the above figure 4.2 𝐶𝑂2, moisture, temperature and humidity are not at normal
range, due to lower range of temperature the relay of heater is activated. And the system is
recommended the appropriate range of parameters for most plants, also displayed current states
of PH and EC.

The soil moisture output is displayed on the LCD after being changed to moisture by the Arduino
control program. As we have seen from table 4.4 shown below, when the moisture reading
becomes less than the minimum limit for most plants, the plant watering pump is turned on,
which is less than 40% of soil moisture. Otherwise, the plant watering pump is turned off.

Table 4. 4 Soil moisture sensor reading and state of watering pump


Soil moisture level displayed on LCD State of the water spray
< 40% ON
>= 40% OFF

As shown the above figure 4.2 the microcontroller is detected the input data of 𝐶𝑂2 sensor, the
sensor output was displayed in the LCD after the voltage of the sensor was changed into CO2
concentrations, which means if the result of the 𝐶𝑂2 is above 1000ppm, serial monitor is
displayed as carbon dioxide, temperature, moisture and humidity are out of the normal ranges.
As a result, the relay of heater and moisture is activated but humidity is over the normal range.
For this task the microcontroller decided whether the value was in optimum conditions or not,
and displayed the result in the serial monitor and LCD.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 34
Agriculture Monitoring System Based on MIT Robot

Figure 4. 3 System monitoring circuits.


In this software result, there is soil PH and soil EC if the soil PH and soil EC are between 5.5-
7.5PH and 1.1-2.8dS/cm respectively displayed on LCD and virtual serial monitor result as
optimum range for plants and it also displayed if the results not optimum, but as shown on the
below all parameters are normal range displayed as normal range. Generally, all parameters of
this system are displayed on the virtual serial monitor of Proteus as below.

Figure 4. 4 The result of plant at good conditions.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 35
Agriculture Monitoring System Based on MIT Robot

Figure 4. 5 The result of moisture, 𝐶𝑂2 and PH at not normal


As shown in the figure 4.5 plant is not in normal conditions, due to abnormality of soil moisture,
𝐶𝑂2, and soil PH variations, as result of moisture motor pump relay is activated, but other
parameters are normal.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 36
Agriculture Monitoring System Based on MIT Robot

Figure 4. 6 Android applications developed in MIT App


In hardware terms, the system is done on the breadboard. In breadboard testing, we checked the
power supply output. All the results were positive, and we got 5V at the output. The system is
interfaced with many sensors, namely temperature and humidity (DH11), LDR, MQ135 and soil
moisture on a breadboard with an Arduino Uno to monitor and control actions. The prototype
testing strategies that were deployed were agile methods where testing was done concurrently
with programming. The implementation was divided into two phases, with phase one focused on

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 37
Agriculture Monitoring System Based on MIT Robot

developing machine-to-machine communication and phase two focused on integrating with the
Android phone developed by MIT APP. Phase 1 of the prototype development was setting up the
board and sensors for data abstraction of environmental parameters. Development for this phase
was done by programming the Arduino Uno board using Arduino software version 1.8.7. The
testing of phase one was done in the field by farmers to test the efficiency of the machine-to-
machine communication between the sensors and the Arduino board.

Figure 4. 7 The result of overall system with hardware.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 38
Agriculture Monitoring System Based on MIT Robot

The system has been tending to control the environmental factors by monitored them through
sensors and turned on and off the respective loads according to the analysis carried out by the
controller. This system displayed the results of monitored sensors and appropriated conditions
for plants based on the plant farming recommendations (which are written or coded in the
Arduino IDE using C++ programming) through Android phones. As shown above sensor
parameter are measured and displayed on the android phones (serial monitor and LCD in Proteus
software), then the overall conditions of the systems are measured. As a result, if the soil health
(soil PH, soil EC, and soil moisture) is in appropriated conditions, the plants are in good health
conditions and the results of the parameters are displayed on android phones. But if the soil
health (soil PH, soil EC, and soil moisture) is not at the appropriated range, the results are
displayed on the android phones, and the system notified the farmer to solve the problems. Then
treatment is initiated through the android by adding organic or biological fertilizer, chemical
fertilizer, and acidic or alkaline elements. To lower the soil PH, we could add sulfur, ammonium-
based fertilizers, or aluminum sulfate, and to raise the soil PH, we could add nitrogen fertilizer,
calcium carbonate, wood ash, or so on. It could treat the unappropriated range of soil EC and soil
moisture using pumped water if the results are under appropriated. Finally, the system is tested
using simulation by Proteus 8.6 professional software tool, which then developed its prototype.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 39
Agriculture Monitoring System Based on MIT Robot

CHAPTER FIVE
CONCLUSION AND RECOMMENDATION
5.1 Conclusion
The present study provides a reliable robotically agriculture monitoring system, which has wide
application in farming fields, and it has been discussed in agriculture plant farming. The main
purpose of this system has been to identify the optimum environmental conditions in a farming
field, and it is the best technology to monitor plant farming. To accomplish the set objectives, the
systems made use of both primary and secondary data. Primary data was used to identify the
optimum environmental parameters such as temperature, humidity, light intensity, soil PH, soil
EC, soil moisture, and carbon dioxide in a plant farming system that faced challenges in the
field. Secondary data was used to compare various plant farming management architectures
deployed and to determine the most appropriate technology to be deployed in plant farming at
any farming fields that had agriculture monitoring systems based on MIT robots because it has
been important for the farmers to record the environmental conditions accurately and recommend
important farming information to ensure growth, health, and higher yield production of plants.
Furthermore, the system automatically monitored and controlled the environmental parameters
of a plant farm in order to provide the best climate, soil health, and soil fertility for plant growth
in the farming fields. The results of the parameters are displayed on the application of the
android phones. If it is not within the range, the controller turns on/off the loads as per the
requirements. For instance, if the temperature is above 30, the system will automatically turn ON
the fans to normalize the level of temperature. If the temperature is below 15, the system will
automatically turn ON the heater. If moisture is below the appropriated level, the relay of the
motor pump is turned ON, then water is pumping and if the light intensity is below the
appropriated level, the relay of the lighting is turned ON. It also turns ON the relay of the motor
pump to spray water if the result of humidity is below the appropriated range. Systems also
control the robot using human voice, turn on/off the relay loads using android phones, treat the
plant's farming problems, recommend farmers through voice assistance, and store some
information on the applications. So, the obtained simulation and prototype results show that the
system's performance is quite consistent and accurate, and the system has overcome many
farming problems successfully.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 40
Agriculture Monitoring System Based on MIT Robot

5.2 Recommendation
This proposed system as much as monitored the plant farming and simplified the work of the
farmers in the field, but it does not fully cover the problems of the farmers. As a result, it can be
expanded in many ways. In the near future, we will develop robots with fully automated tasks
such as mowing, monitoring of pests and disease, harvesting and tilling through collaborations
between ANN and MATLABs based on IoT communication systems.

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 41
Agriculture Monitoring System Based on MIT Robot

References

[1] G. Y. Wendimu, "The challenges and prospects of Ethiopian," Journal homepage:


https://www.tandfonline.com/loi/oafa20, p. 3, 13, 2021.
[2] T. Stellmacher and G. Kelboro, "Family Farms," in Agricultural Productivity, and the
Terrain of Food (In)Security in Ethiopia. Sustainability, 2019,11, p. 4981.
[3] P. Z. J. P. a. G. K. Menale Kassie, "Sustainable Agricultural Practices and Agricultural
Productivity in Ethiopia," in Environment for Development, Swedish International
Development Cooperation Agency (Sida), April 2009.
[4] D. F. D.-G. K. a. B. E.-L. Gebeyanesh Zerssa, Challenges of Smallholder Farming in
Ethiopia and Opportunities by Adopting Climate-Smart Agriculture, MDPI, 26, 2021.
[5] N. M. P. B. a. N. R. N. Chandana R, "A Multipurpose Agricultural Robot for Automatic
Ploughing , Seeding and Plant Health Monitoring," International Journal of Engineering
Research & Technology (IJERT), vol. 8, no. 11, pp. 57-58, 2020.
[6] B. S. a. G. HW., "A future view of precision farming," in In: Berger D, et al., editor.
Proceedings of the PreAgro Precision Agriculture Conference, Muncheberg, Germany,
Center for Agricultural Landscape and Land Use Research (ZALF), 2002, pp. 131-145.
[7] G. Diriba, "Obstacles, triggers and reform considerations policy working pape,"
Agricultural and rural transformation in Ethiopian, 2020. [Online]. Available:
https://media.africaportal.org/documents/Agricultural_and_rural_transformation_in_Ethiop
ia.pdf.
[8] J. d. C. D. G. P. G. M. G. J. d. L. a. A. B. Juan Jesús Roldán, Robots in Agriculture: State
of Art and Practical Experiences, IntechOpen, 2017.
[9] V. H. U. M. Pahuja R, "A wireless sensor network for greenhouse climate control," IEEE
Pervasive Computing, vol. 12, p. 49‐58, 2013.
[10] G. CustServ, "Effects of Soil pH on Plant Growth," [Online]. Available:
https://www.gardenexpress.com.au/soil-ph-plant-growth/. [Accessed 10 February 2020].
[11] N. M. P. B. S. S. N. R. N. Chandana R, "A Multipurpose Agricultural Robot for Automatic
Ploughing , Seeding and Plant Health Monitoring," International Journal of Engineering

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 42
Agriculture Monitoring System Based on MIT Robot

Research & Technology (IJERT), vol. 2278, no. 0181, 2020.


[12] G. S. P. M. D. S. Manjunath P M, "IoT Based Agricultural Robot for Monitoring Plant
Health and Environment," Journal of Emerging Technologies and Innovative Research
(JETIR) www.jetir.org, vol. 6, no. 2, February 2019.
[13] P. I. M. a. A. Deshmukh, "PIC Microcontroller Based Greenhoouse Monitoring and
Control System," International Journal of Advanced Research in Electrical, International
Journal of Advanced Research in Electrical,, vol. 5, no. 9, September 2016.
[14] P. P. K. M. B. M. S. M. R. S. a. M. C. Prof. Likhesh Kolhe, "IoT Based Plant Monitoring
System," International Journal of Interdisciplinary Innovative Research & Development
(IJIIRD), vol. 02, no. 05, 2018.
[15] K. a. P. a. et, Autonomous farming robot with plant health indication, IJATES, 2016.
[16] M. K. A. P. S. R. D. P. S. R.HARI SUDHAN, "ARDUINO ATMEGA-328
MICROCONTROLLER," INTERNATIONAL JOURNAL OF INNOVATIVE RESEARCH
IN ELECTRICAL, ELECTRONICS, INSTRUMENTATION AND CONTROL
ENGINEERING, vol. 3, no. 4, p. 27, 2015.
[17] P. Kamble, "T erna Engineering College," 15 June 2020. [Online]. Available:
https://www.researchgate.net/publication/342175470. [Accessed 2020].
[18] "EIProCus," Electronics | Project |Focus2, 2020. [Online]. Available:
https://www.elprocus.com/soil-moisture-sensor-working-and-applications/.
[19] A. Newton, "DIY Soil EC Salinity Meter using Arduino & Soil EC Sensor," 15 may 2022.
[Online]. Available: https://how2electronics.com/diy-soil-ec-salinity-meter-using-arduino-
soil-ec-sensor/. [Accessed 29 march 2021].
[20] J. F. a. P. Elizabeth Hawkins, "The Ohio State University’s Precision Agriculture website,"
Agriculture and Natural Resources, [Online]. Available:
https://ohioline.osu.edu/factsheet/fabe-565. [Accessed 12 Jan 2017].
[21] "COMPONENTS101," [Online]. Available: https://components101.com/wireless/hc-06-
bluetooth-module-pinout-datasheet. [Accessed 2 November 2018].
[22] H. A. a. M. Friedman, "Wikipedia," [Online]. Available:
https://en.wikipedia.org/wiki/App_Inventor_for_Android#:~:text=MIT%20App%20Invent

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 43
Agriculture Monitoring System Based on MIT Robot

or%20is%20a%20web%20application%20integrated,and%20iOS%2C%20which%2C%20
as%20of%208%20July%202019. [Accessed 26 November 2019].
[23] M. T. a. F. H. Evan W. Patton, "MIT App Inventor: Objectives, Design,," in MIT App
Inventor, Cambridge, MA, USA, Computational Thinking Education, 2019, pp. 1-36.
[24] "Wikipedia," Definitions.net, [Online]. Available:
https://www.definitions.net/definition/arduino+ide.
[25] X. L. R. L. B. S. Chengcheng Fan, "Application of proteus in Experimental Teaching and
Research of Medical Electronic Circuit," Advances in Social Science, Education and
Humanities Research, vol. 215, pp. 512-513, 2018.

APPENDIX
#include <SoftwareSerial.h>
#include "AFMotor.h"
#include "dht.h"

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 44
Agriculture Monitoring System Based on MIT Robot

SoftwareSerial BT(2, 3); // RX, TX


#define dataPin A0
dht DHT;
int Temp;
int Humi;
int RelayTemp1=8;
int RelayTemp2=9;
int RelayHumi=10;
int Moisture_Value;
int Moisture_pin=A1;
int RelayMois=7;
const int mqsensor = A2; //output of mq135 connected to A0 pin of Arduino
int threshold = 250; //Threshold level for Air Quality
int LDRpin=A3;
int LDR;
int RelayLDR=6;
float calibration_value = 20.34;
int PH=0;
unsigned long int averageVal;
int sample_arr[10];
int temp_Val;
int state;
int Speed = 130;
int timer = 0;
const int MOTOR_1 = 1;
const int MOTOR_2 = 2;
const int MOTOR_3 = 3;
const int MOTOR_4 = 4;
AF_DCMotor motor1(MOTOR_1, MOTOR12_64KHZ); // create motor object, 64KHz pwm
AF_DCMotor motor2(MOTOR_2, MOTOR12_64KHZ); // create motor object, 64KHz pwm
AF_DCMotor motor3(MOTOR_3, MOTOR12_64KHZ); // create motor object, 64KHz pwm
AF_DCMotor motor4(MOTOR_4, MOTOR12_64KHZ); // create motor object, 64KHz pwm
void setup() {
Serial.begin(9600);
BT.begin(9600);
pinMode (mqsensor,INPUT); // MQ135 is connected as INPUT to arduino
motor1.setSpeed(Speed); // set the motor speed to 0-255
motor2.setSpeed(Speed);
motor3.setSpeed(Speed);
motor4.setSpeed(Speed);
delay(500);
}

void loop(){
//if some date is sent, reads it and saves in state
if(BT.available() > 0){
state = BT.read();
Serial.println(state);
if(state > 10){
Speed = state;}
}
motor1.setSpeed(Speed); // set the motor speed to 0-255
motor2.setSpeed(Speed);
motor3.setSpeed(Speed);
motor4.setSpeed(Speed);
if(state == 1){

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 45
Agriculture Monitoring System Based on MIT Robot

forward();
}
else if(state == 2){
backward();
}
else if(state == 3){
turnLeft();
}
else if(state == 4){
turnRight();
}
else if(state == 5){
Stop();
}
else if(state==6){
forward();
//state=5;
Serial.println("Forward");
}
else if(state==7){
backward();
//state=5;
Serial.println("Backward");
}
else if(state==8){
turnLeft();
//state=5;
Serial.println("Turn to Left");
}
else if(state==9){
turnRight();
//state=5;
Serial.println("Turn to Right");
}
else if(state==10){
Stop();
Serial.println("Stop");
}
else if((state==11) && (Temp>30)){
digitalWrite(RelayTemp1, HIGH);
}
else if((state==12) && (Temp<=30)){
digitalWrite(RelayTemp1, LOW);
}
else if((state==13) && (Temp<15)){
digitalWrite(RelayTemp2, HIGH);
}
else if((state==14) && (Temp>=15)){
digitalWrite(RelayTemp2, LOW);
}
else if((state==15) && (Humi<40)){
digitalWrite(RelayHumi, HIGH);
}
else if((state==16) && (Humi>=40)){
digitalWrite(RelayHumi, LOW);
}

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 46
Agriculture Monitoring System Based on MIT Robot

else if((state==17) && (moisture<40)){


digitalWrite(RelayMois, HIGH);
}
else if((state==18) && (moisture>=40)){
digitalWrite(RelayMois, LOW);
}
else if((state==19) && (ldrV<=90)){
digitalWrite(RelayLDR, HIGH);
}
else if((state==20) && (ldrV>90)){
digitalWrite(RelayLDR, LOW);
}
int readData = DHT.read11(dataPin);
Temp = DHT.temperature;
Serial.println("Temperature");
Serial.println(Temp);
Humi = DHT.humidity;
Serial.println("Humidity");
Serial.println(Humi);
Moisture_Value=analogRead(Moisture_pin);
int moisture=map(Moisture_Value,0,1023,0,100);
Serial.println("Moisture");
Serial.println(moisture);
int co2ppm = analogRead(mqsensor); //read MQ135 analog outputs at A0 and store it in ppm
co2ppm=30;
Serial.println("Carbon Dioxide");
Serial.println(co2ppm); //print value of ppm in serial monitor
LDR=analogRead(LDRpin);
int ldrV=(LDR/1023)*100;
Serial.println("Light Intensity");
Serial.println(ldrV);
////////////////////PH///
for(int i=0; i<10; i++){
sample_arr[i]=analogRead(A4);
delay(10);
}
for(int i=0; i<9; i++){
for(int j=i+1; j<10; j++){
if(sample_arr[i]>sample_arr[j]){
temp_Val=sample_arr[i];
sample_arr[i]=sample_arr[j];
sample_arr[j]=temp_Val;
}
}
}
averageVal=0;
for(int i=2; i<8; i++)
averageVal=averageVal+sample_arr[i];
float volt=(float)averageVal*5.0/1024/6;
float ph_actual = -5.70 * volt + calibration_value;
Serial.println("Soil PH");
Serial.println(ph_actual);
timer = timer+1;
//Serial.println(timer );
if(timer>400){
BT.println(Temp);

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 47
Agriculture Monitoring System Based on MIT Robot

BT.print(";");
BT.print(Humi);
BT.println(";");
BT.print(moisture);
BT.println(";");
BT.print(co2ppm);
BT.println(";");
BT.print(ldrV);
BT.println(";");
BT.print(ph_actual);
BT.println(";");
}
delay(1000);
}
void forward(){
motor1.run(FORWARD); // turn it on going forward
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void backward(){
motor1.run(BACKWARD); // the other way
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
}
void turnRight(){
motor1.run(FORWARD); // the other right
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
}
void turnLeft(){
motor1.run(BACKWARD); // turn it on going left
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
}
void Stop(){
motor1.run(RELEASE); // stopped
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}

Jimma University, JIT Faculty of Electrical and ComputerJune


Engineering
16, 2022 48

You might also like