You are on page 1of 17

Arduino-based system for soil moisture measurement

PRESENTED BY:
AMMAR MAHMOUD, HAIDER ABDUL JABBAR, & ABDUL
MUHAIMIN SAAD
2ND STAGE (EVENING STUDY)
DR. OMAR YOUSSEF
Table of Contents:

Introduction………….…………………………. 2-4

Goal of Project:…………………………………………. 4-5

Component…………………….…………………….5-6

Assemble ………………………………….………….……..6-8

Wiring …………………….…….9

OUTPUT ……………………….10-11

CONCLUSION …………………….…………..…..…..11-12

CODE………….……………………………………..13-16

16
Arduino-based system for soil moisture measurement

Intro:

DEVELOPMENTS in technology, science and medicine

have allowed a much better quality and longevity of a man’s

life, leading to a continuous increase in population.

Consequently, requirements for adequate quantities of food

and drinking water has increased, as well as the need to

improve its quality, especially in third world countries where

each of these recourses are limited. Through the usage of the

"smart" irrigation systems and monitoring of soils we are

heading in the right direction to meet these requirements.

Soil moisture measurement is of great importance for

applications in the field of agriculture, allowing farmers to

more efficiently manage irrigation systems. Knowing the

exact properties of the soil, farmers are not only able to use

less water to grow crops, but also increase production and

quality, irrigating the plants in the critical periods of its

growth. Moisture sensors are commonly used in combination

16
with irrigation system controllers. Connecting a moisture

sensor to an ordinary timer irrigation system, it gets some

"smart" features, stopping irrigation when the soil is already

wet enough. Soil moisture sensors also found diverse

applications in scientific research of agriculture and

horticulture, climate and environment related research and

many other areas of science. For example, on golf courses

these sensors are used to prevent excessive soaking, as well

as to prevent runoff of fertilizers and other chemicals into the

deeper layers of the soil. Purpose of this work was to design a

simple system for soil moisture monitoring, using affordable

components that provide reliable and accurate measurement.

The system is intended primarily for application in

agricultural activities. Although there are a number of soil

moisture monitoring systems on the market, numerous

disadvantages limit the scope of their application. Systems

that provide data in the form suitable for agricultural

applications (soil moisture volume percentage / soil moisture

16
content) are very expensive and require sophisticated

electronic equipment for their operation. On the other hand,

affordable systems usually display data in unsuitable form

(voltage, resistivity, frequency, suction force, ...). The sensor

used in our system measures suction force (water potential),

while the water content mostly depends on physical

characteristics of the soil. To draw a correlation between

these two parameters (water potential and moisture content),

we need to determine the soil moisture retention curve (SMR).

The accurate SMR determination is usually performed by

laboratory analysis, which we will substitute with a complex

mathematical model. Due to certain model approximations

and the specificities of different soil types, additional

calibrations are necessary for very precise measurements.

Goal of Project:

16
this project is a simple and functional way to test the

moisture content of soil and display it without needing to

have your Arduino connected to a computer. This means it

can sit on the shelf with your other household tools and when

it’s time to water the plants you can give them exactly as

much water as they need.

Components used in this project:

1-Arduino Uno

2-Single Digit 7 Segment Display

16
3-Soil Moisture Sensor with Control Unit

4-Male Male Jumper Wires

5- External Phone Charger (must have USB out)

Assemble:

Our design is based on the Arduino UNO microcontroller

platform, equipped with the soil moisture sensor Watermark

200SS The sensor is connected to a built-in 10-bit analog-

to-digital converter (ADC) of the Arduino platform. The

platform measures output voltage of the moisture sensor,

processes obtained data and sends it Single Digit 7 Segment

16
Display. In order to properly measure the water potential

using the Watermark sensor, it is necessary to provide an

alternating current (AC) power source, because long exposure

to the direct current polarize sensor electrodes. This has a

negative impact on the measured results, and leads to the

degradation of the sensor over time. The AC power source is

emulated by digital output ports of the microcontroller.

Alternating the status of the digital pins D0 and D1 to HIGH

(5V) and LOW (0V) digital levels, rectangular signal is

generated. Initially, D0 is set to HIGH, while D1 is set to LOW,

so the current flows in one direction.

16
We then measure the voltage drop on the sensor and

perform the necessary calculations. The voltage polarity is

then reversed, putting D0 to LOW and D1 to HIGH. The

current now flows in the opposite direction and the

measurement starts again.

16
Wiring:

The wiring is a little bit complicated for the seven segment

display but must be exactly as shown. There was no

component for Moisture sensor but the Soil Moisture sensor is

well labeled so this diagram should be a good explanation.

16
OUTPUT:

We learned quite a bit by using this regularly. While the top

1/2" appeared very dry, many plants were actually extremely

moist under the surface and we learned about the drainage

on each of our plants through this system.

16
CONCLUSION:

In this paper we described design of the microcontroller

system for soil moisture measurement using Watermark

200SS soil moisture sensor. The idea was to develop a

modular, flexible system using affordable components.

Proposed solution is designed to measure water potential

from 0kPa to 200kPa, and to be used for agricultural

purposes. System is flexible, low cost, simple to use and

16
offers real-time monitoring. It is a suitable alternative to

similar expensive systems, especially in case of multiple

monitoring locations. Future work on the system will include

several different activities. Main point of interest will be to

evaluate the recorded data and compare it to high accuracy

systems. Attention will also be focused to autonomy of the

system, which can be achieved through autonomous power

supply consisting of solar energy or batteries and

implementation of attention (AT) commands. This greatly

improves flexibility and manageability of the system as it

allows us to control the system from a central point

wirelessly, without the need of field work. Another important

issue is to implement a temperature sensor for increased

precision and calibration of the moisture sensor.

16
Code:

//Library
#include "SevenSeg.h"

//Defines the segments A-G: SevenSeg(A, B, C, D, E, F,


G);
SevenSeg disp (10,9,8,7,6,11,12);
//Number of 7 segments
const int numOfDigits =1;
//CC(or CA) pins of segment
int digitPins [numOfDigits]={4};

//Variables
int number=0; //Default number
int flag;
int sensorPin = A0;
int sensorValue;
int limit = 300;

void setup() {

Serial.begin(9600);
//Defines the number of digits to be "numOfDigits" and
the digit pins to be the elements of the array "digitPins"
disp.setDigitPins ( numOfDigits , digitPins );
//Only for common cathode 7segments
disp.setCommonCathode();
//Control brightness (values 0-100);
disp.setDutyCycle(50);
Serial.begin(9600);

16
}

void loop()
{
/*
This section will need to be calibrated based on what you
want each moisture level to display.
For me, most outside plants after a light rain will display
a 9 and will decrease after it drys out to a 1 after about a
week!
To calibrate I took two dry plants and watered one. I
measured each using Serial Monitor in this code
(Cntrl+Shift+M) and adjusted
the sensorValue so that the highest and lowest values set
to these measurements.
This took 2 tries before it worked well!
I also used an external phone charger as a power source
after uploading the code to the arduino so it could work
remotely.
*/
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
//Check if incoming data is available:
if (Serial.available() > 0)
{
number = Serial.parseInt();
flag=0;
}

if (sensorValue >= 330){


//Print number to 7 segment display
disp.writeDigit(1);
}
if (sensorValue >300 && sensorValue <=330){

16
//Print number to 7 segment display
disp.writeDigit(2);
}
if (sensorValue >270 && sensorValue <=300){
//Print number to 7 segment display
disp.writeDigit(3);
}
if (sensorValue >240 && sensorValue <=270){
//Print number to 7 segment display
disp.writeDigit(4);
}
if (sensorValue >210 && sensorValue <=240){
//Print number to 7 segment display
disp.writeDigit(5);
}
if (sensorValue >180 && sensorValue <=210){
//Print number to 7 segment display
disp.writeDigit(6);
}
if (sensorValue >150 && sensorValue <=180){
//Print number to 7 segment display
disp.writeDigit(7);
}
if (sensorValue >120 && sensorValue <=150){
//Print number to 7 segment display
disp.writeDigit(6);
}
if (sensorValue >90 && sensorValue <=120){
//Print number to 7 segment display
disp.writeDigit(7);
}
if (sensorValue >60 && sensorValue <=90){
//Print number to 7 segment display
disp.writeDigit(8);

16
}
if (sensorValue <=60){
//Print number to 7 segment display
disp.writeDigit(9);
}
delay(500);
// for stability
}

16

You might also like