DETECTION OF SOIL MOISTURE USING ARDUINO
COURSE BASED PROJECT
submitted to the
APJ ABDUL KaLAM TechNOLOgICAL UNIveRsITy
in partial fulfilment of the requirements
for the award of the Degree of
MASTER OF TECHNOLOGY
in
ELECTRONICS and COMMUNICATION
with specialisation
Applied Electronics and Instrumentation
Submitted by
SUSHMI RAJAN
KTU ID: TVE24ECAI13
Subject code: 222TEC101
Course Name: DESIGN OF EMBEDDED SYSTEM
2025-2026
DepaRTMENT Of ELECTRONICs aND COMMUNICATION
COLLEge Of ENgINEERINg TRIvaNDRUM
Thiruvananthapuram
DECLARATION
I, SUSHMI RAJAN, do hereby declare that the course based project work entitled
“ DETECTION OF SOIL MOISTURE USING ARDUINO” is based on the
original work done by me under the supervision of Prof. SANOJ VISWASOM ,
Associate Professor, Department of ELECTRONICS, College of Engineering Trivan-
drum and has not been submitted previously for the award of any degree.
SUSHMI RAJAN
College of Engineering Trivandrum
Thiruvananthapuram
CERTIFICATE
This is to certify that this Project report entitled “DETECTION OF SOIL
MOISTURE USING ARDUINO” is a bonafide record of the project presented by Ms.
Sushmi Rajan, Reg. No TVE24ECAI13 of second Semester for the requirement of the
award of the M.Tech degree in ELECTRONICS and COMMUNICATION Engineering
with specialisation Applied Electronics and Instrumentation of APJ Abdul Kalam
Technological University during the year 2025-26.
Prof. SANOJ VISWASOM
Associate Professor
Department of ELECTRONICS AND COMMUNICATION
College of Engineering Trivandrum
Thiruvananthapuram, Kerala
ACKNOWLEDGMENT
It is my proud privilege and duty to acknowledge the kind help and guidance
re- ceived from several people in the preparation of this report. It would not
have been possible to prepare this report in this form without their valuable
help, cooperation and guidance. I would like to extend my sincere thanks to
all of them.
SUSHMI RAJAN
ABSTRACT
This project presents the design and implementation of a Soil Moisture
Monitoring System using an Arduino Uno and a soil moisture sensor. The system
aims to automate irrigation and optimize water usage in agriculture by
continuously monitoring soil moisture levels and providing real-time feedback.
The Arduino Uno microcontroller processes data from the soil moisture sensor
and triggers appropriate actions, such as activating a water pump when moisture
levels fall below a predefined threshold. The system can also incorporate an LCD
display or IoT-based alerts for remote monitoring. This cost-effective and energy-
efficient solution enhances agricultural productivity by ensuring optimal soil
hydration while conserving water resources.
Contents
1 INTRODUCTION 1
2 COMPONENTS AND HARDWARE DESCRIPTION 2-6
2.1 COMPONENTS .......................................................................................... 2
2.2 Components and Hardware Description ........................................................ 2
2.2.1 Arduino Uno/Nano .......................................................................... 2
3 CIRCUIT DIAGRAM AND BLOCK DIAGRAM 7-9
v
Contents vi
4 Software Implementation 10
4.0.1 Development Environment ..................................................................................10
4.0.2 Working Principle ...............................................................................................10
4.0.3 Code Explanation ................................................................................................13
5 APPLICATIONS 14
6 RESULT 16
6.1 Results and Discussion ................................................................................19
Bibliography 20
ChapTER 1
INTRODUCTION
Monitoring soil moisture is essential for efficient irrigation and plant health. Using an Arduino
Uno and a soil moisture sensor, this project enables real-time measurement of soil moisture
levels, making it ideal for smart gardening and automated irrigation systems. The setup is
simple, cost-effective, and easy to implement for beginners and enthusiasts alike.
Soil moisture monitoring is crucial for efficient water management in agriculture and gardening.
Traditional irrigation methods often lead to excessive water usage or inadequate hydration,
affecting crop health and yield. This project introduces a Soil Moisture Monitoring System
using an Arduino Uno and a soil moisture sensor to provide an automated solution for
maintaining optimal soil moisture levels.
The sensor continuously measures the soil's moisture content and sends data to the Arduino
Uno, which processes the readings and triggers actions, such as turning on a water pump when
necessary. This system helps conserve water, reduce manual labor, and improve plant growth
by ensuring precise irrigation control.
1
ChapTER 2
COMPONENTS AND HARDWARE
DESCRIPTION
2.1 COMPONENTS
2.2 Components and Hardware Description
This project involves an Arduino-based soil moisture that utilizes the dry soil to wet
soil reading using soil moisture detecting sensor. The following components are used in
this project:
2.2.1 Arduino Uno
The Arduino Uno is a microcontroller board based on the ATmega328P micro- controller.
It is responsible for processing the input from the and controlling the output device.
Arduino board is a microcontroller that is used to accept inputs from sensors connected and
provide an output action on the desired device connected to it. The sensor inputs can be that
from light-detecting sensors, flame sensors, temperature sensors, etc. The output function
done on the devices can be turning on an LED, the sound of a buzzer, or a Serial monitor
display.
2.2.2 Soil Moisture Sensor
The sensor (also called a Hygrometer sensor) is used to measure the volumetric quantity of
water in the soil through the probes provided.
3
A soil moisture sensor measures the volumetric water content in soil. It helps determine
how wet or dry the soil is, which is especially useful in agriculture, gardening, and
environmental monitoring.
Capacitive Soil Moisture Sensor:
Working Principle
Measures changes in capacitance caused by water in the soil.
Dry Soil → Low dielectric constant
Wet Soil → High dielectric constant
Output
Analog voltage that varies with moisture.
The FC-28 sensor contains an IC on the board which is an LM323 comparator.
The sensor also contains a potentiometer embedded in it which will hold the threshold value
of the moisture set by the user.
Sensor specifications.
Input voltage: 3.3V - 5V
Output voltage: 0V - 4.2V
Input current: 35 mAmps
Output: Analog or Digital (Analog Range 0 - 1023 and Digital outputs 0 or 1)
4
2.2.3 Jumper Wires
These are the main components that are used to establish the connections between different
devices of the circuit.
5
ChapTER 3
CIRCUIT DIAGRAM AND BLOCK
DIAGRAM
3.1 Circuit Diagram and Description
The circuit diagram below shows the necessary connections from the Arduino to the FC-
28 Soil Moisture Sensor.
6
The Soil Moisture sensor is connected to the Arduino board with the help of Jumper wires.
The sensor contains a set of pins on two sides. The set of pins on one side are Ground (Gnd),
voltage input (Vcc), Digital output(D0), and Analog output(A0). These pins are connected
to the Arduino chip in the following manner. The Ground pin of the Sensor is connected to
the Ground pin of the Arduino chip. The Vcc pin on the sensor is connected to the 5V
supply pin of the Arduino chip.
When there is a requirement for Analog output, the A0 pin of the sensor is connected to the
A0 pin of the Arduino chip. The range of output values for Analog output is 0 - 1023. Else,
when Digital output is required, the D0 pin of the sensor can be connected to any of the
digital output pins of the Arduino chip. The digital outputs as we know will be either 0 or
The second set of pins present on the other side of the sensor are connected to the probes
that will be measuring the moisture of the soil when placed physically in it. The conducting
probes are the basic sensor devices of this circuit.
As mentioned earlier, the sensor has a potentiometer and a comparator embedded on it
whose functions are to hold the threshold value and compare the input value from the sensor
to the threshold value fixed by the user respectively. The detailed working will be discussed
in the working of the circuit.
7
3.2 Working Principle
The circuit, when switched ON and OFF, is shown below.
Circuit switched OFF
When the connections are done, the conducting probes connected to the Soil moisture
sensor must be inserted into the soil whose Moisture value is desired to be known. The
circuit must simultaneously be interfaced with Arduino IDE.
Circuit switched ON
8
When the circuit is switched ON, the sensor reads the values that the probes conduct. The
potentiometer actually holds the threshold value fixed by the user. The LM323 comparator
present on the sensor chip compares the threshold value to the sensor input value. The
glowing of the LED in the sensor indicates the functioning of the sensor.
Finally, the output, that is the value of moisture content in the soil is displayed on the Serial
Monitor of the Arduino IDE.
ChapTER 4
Software Implementation
4.1 Soil Moisture Code for Arduino Uno
4.1.1 Steps in software implementation
1. Initialize Pins
Define the analog input pin connected to the sensor (e.g., A0).
If using digital output or relay, define that too.
2. Read Sensor Value
Use analogRead() to get moisture level as a value between 0 (wet) and 1023 (dry).
3. Process Data
Convert sensor value to a readable moisture percentage.
Use map() or custom scaling depending on sensor range.
4. Display/Action
Print data to Serial Monitor, LCD, or send it to IoT platforms.
Optionally turn on a buzzer, LED, or motor/pump if soil is too dry.
10
4.2 Arduino Code for Working
// Define pin
const int sensorPin = A0; // Soil moisture sensor output pin
void setup() {
Serial.begin(9600); // Start serial communication
void loop() {
int moistureValue = analogRead(sensorPin); // Read analog value
int moisturePercent = map(moistureValue, 1023, 0, 0, 100); // Map to % (Optional)
Serial.print("Soil Moisture Value: ");
Serial.print(moistureValue);
Serial.print(" | Moisture (%): ");
Serial.println(moisturePercent);
delay(1000); // Wait for 1 second before next reading
4.3 Code Explanation
const int sensorPin = A0;
Purpose: Declares a constant named sensorPin, which represents the analog pin A0 where
the soil moisture sensor is connected.
A0 is one of Arduino’s analog input pins.
11
void setup()
Purpose: setup() runs once when the Arduino is powered on or reset.
Serial.begin(9600);
Initializes serial communication between Arduino and your computer at a speed of 9600
bits per second.
Used to send data to the Serial Monitor (for debugging or data display).
void loop()
The loop() function runs continuously after setup().
int moistureValue = analogRead(sensorPin);
Reads the raw analog value from the sensor (between 0 and 1023).
A lower value typically means wetter soil, and a higher value means drier soil.
int moisturePercent = map(moistureValue, 1023, 0, 0, 100);
Converts the raw analog value to a percentage.
map() is a built-in Arduino function that scales a value from one range to another.
Here, 1023 (dry) becomes 0%, and 0 (wet) becomes 100%.
Serial.print("Soil Moisture Value: ");
Prints the label text (not a variable) to the Serial Monitor.
12
Serial.print(moistureValue);
Prints the raw analog value read from the sensor.
Serial.print(" | Moisture (%): ");
Serial.println(moisturePercent);
Prints the moisture percentage and moves the cursor to the next line.
Prints a separator and label for the moisture percentage
delay(1000);
Waits 1 second (1000 ms) before repeating the loop.
Prevents flooding the Serial Monitor with too much data too quickly.
4.4Measure soil moisture using Arduino Uno
The analog output of soil moisture sensor is processed using ADC. The moisture content
in terms of percentage is displayed on the serial monitor.The output of the soil moisture
sensor changes in the range of ADC value from 0 to 1023.
This can be represented as moisture value in terms of percentage using formula given
below.
Moisture in percentage = 100 – (Analog output * 100)For zero moisture, we get maximum
value of 10-bit ADC, i.e. 1023. This, in turn, gives 0% moisture.
13
ChapTER 5
APPLICATIONS
5.1 Automatic Irrigation System
Automatically waters the plants when the soil moisture drops below a threshold.
Saves water and ensures optimal plant growth.
Can control pumps, solenoids, or sprinklers using a relay.
5.2 Smart Gardening
Monitors soil conditions in home gardens, greenhouses, or vertical gardens.
Sends alerts or notifications to mobile apps (via Wi-Fi or Bluetooth).
Helps hobbyists and urban gardeners care for plants more efficiently.
5.3 Precision Agriculture
Used in farms for data-driven irrigation based on real-time soil moisture data.
Helps reduce water wastage and improve crop yield.
Can be integrated with weather sensors and GPS for advanced solutions.
5.4 Environmental Monitoring
Measures soil moisture in forests, wetlands, and research sites.
Used in ecological studies, climate change research, and land conservation.
14
5.5 IoT-Based Soil Monitoring Systems
Sends moisture data to platforms like Blynk, ThingSpeak, or Firebase.
Farmers or gardeners can access data remotely via smartphone or web apps.
Can be part of a larger IoT smart farming system
5.6 Educational Projects
Used in STEM and robotics projects to teach students about sensors, automation,
and sustainable tech.
Often included in Arduino and Raspberry Pi beginner kits.
5.7 Greenhouse Automation
Controls humidity and soil moisture in a greenhouse.
Can be connected to fans, heaters, and water systems to maintain ideal growing
conditions.
5.8 Disaster Prevention Systems
Combined with rain sensors to monitor flood risks or landslide-prone areas by tracking
oversaturated soil.
15
ChapTER 6
RESULT
6.1. Sensor Output Value
When the soil moisture sensor is connected to an analog pin (like A0), it gives a value
between:
0 (fully wet) → high water content
1023 (completely dry) → very dry soil
The output of the soil moisture sensor changes in the range of ADC value from 0 to
1023. This can be represented as moisture value in terms of percentage using formula
given below. For zero moisture, we get maximum value of 10-bit ADC, i.e. 1023. This,
in turn, gives 0% moisture.
6.2 Moisture Level Interpretation
Moisture % Soil Condition Action Needed
80–100% Very wet No watering needed
60–79% Moist (good) No watering needed
40–59% Moderate/Dry Water if needed
16
20–39% Dry Start watering
Moisture % Soil Condition Action Needed
0–19% Very Dry Immediate watering
6.3 Result E
After interfacing the soil moisture sensor with the Arduino, the system successfully reads
and displays real-time soil moisture levels. The sensor provides an analog output that the
Arduino reads through its analog input pin (usually A0). This raw value, which ranges from
0 (wet) to 1023 (dry), is then converted into a percentage using the map() function to make
it more human-readable. For example, if the sensor reads a value of 300, it might correspond
to approximately 70% moisture, indicating that the soil is adequately moist. These readings
are displayed on the Serial Monitor or can be shown on an LCD or sent to a cloud platform
for remote monitoring. Based on the moisture percentage, the system can determine
whether the soil is wet, moderately moist, or dry. If the moisture level drops below a
predefined threshold (e.g., 30%), the Arduino can be programmed to trigger an automatic
watering system by activating a water pump via a relay. Overall, the results confirm that
the system effectively monitors soil moisture levels and can be used for smart irrigation,
environmental monitoring, or IoT-based farming applications.
6.4 Limitations
Sensor Corrosion (Resistive Type):
Resistive sensors have exposed electrodes that corrode over time when placed in moist soil,
reducing accuracy and lifespan.
17
Limited Accuracy:
Basic sensors provide approximate moisture levels but not precise volumetric water
content.
No Temperature Compensation:
Sensor readings can be affected by temperature changes, leading to inaccurate moisture
detection.
Short Range (Wired Setup):
Arduino and sensor are often close together with wired connections, limiting installation in
large or remote areas.
Lack of Real-Time Alerts:
Without integration to a network or app, there's no remote notification or control.
No Multi-Zone Monitoring:
Basic setup monitors only one location, which is insufficient for large gardens or farms.
Manual Calibration Required:
Readings vary by soil type and require manual calibration for accurate results.
6.5 Future Enhancement
Use of Capacitive Sensors:
Replace resistive sensors with capacitive ones to avoid corrosion and increase
durability.
18
Wireless Connectivity:
Integrate Wi-Fi (ESP8266/ESP32) or LoRa for remote monitoring and control via
smartphone or web dashboard.
Mobile Notifications:
Add IoT features to send alerts via SMS, email, or apps when soil gets too dry or
watering is activated.
Multi-Sensor Deployment:
Expand to multiple sensors for zone-based monitoring in larger fields or gardens.
Automatic Irrigation System:
Connect to relays and pumps for fully automated watering based on real-time soil
data.
Data Logging and Analysis:
Store data on SD cards or in the cloud for long-term analysis and crop optimization.
Integration with Weather APIs:
Combine sensor data with weather forecasts to intelligently plan watering
schedules.
Power Optimization with Solar:
Use solar panels and low-power components to make the system self-sustainable
and off-grid.
19
Bibliography
J. John, V. S. Palaparthy, S. Sarik, M. S. Baghini and G. S. Kasbekar, "Design and
implementation of a soil moisture wireless sensor network," 2015 Twenty First
National Conference on Communications (NCC), Mumbai, India, 2015, pp. 1-6,
doi: 10.1109/NCC.2015.7084901.
keywords: {Temperature sensors;Soil moisture;Humidity;Temperature
measurement;Data collection;Synchroni
A. Kumar, K. Kamal, M. O. Arshad, S. Mathavan and T. Vadamala, "Smart
irrigation using low-cost moisture sensors and XBee-based communication," IEEE
Global Humanitarian Technology Conference (GHTC 2014), San Jose, CA, USA,
2014, pp. 333-337, doi: 10.1109/GHTC.2014.6970301.
keywords: {Sensors;Moisture;Wireless sensor networks;Wireless
communication;Irrigation;Electrodes;Soil;smart irrigation;moisture sensors;Xbee
communication},
20