1
SOIL MOISTURE SENSOR USING -ESP32
Project Report
Submitted in the partial fulfillment of the requirements for the
Course Title: PROCESSORS &
CONTROLLERS
Course code: 23EC2106R
submitted by
V.N.D. VIRAAJITHA 2300031224
UNDER THE GUIDANCE
OF
MR. K. SureshKumar
Assistant Professor
KL UNIVERSITY
Green fields, Vaddeswaram – 522 302
Guntur Dt., AP, India.
2
Declaration
The Project Report entitled “Soil Moisture Testing level” is a record of Bonafide work
of
V.N.D. VIRAAJITHA 2300031224 submitted in partial fulfillment for the subject titled 23EC2106R -
PROCESSORS AND CONTROLLERS in Dept of ECE, KL University.
Student Name: V.N.D. VIRAAJITHA
Student ID :2300031224
3
Certification
This is to certify that the Project Report entitled “SOIL MOISTURE SENOR USING ESP32” is being submitted
by V.N.D. VIRAAJITHA 2300031224 in partial fulfillment for the subject titled (23EC2106R -
PROCESSORS AND CONTROLLERS in Dept of ECE, KL University is a record of Bonafede work carried out
under our guidance and supervision. The results embodied in this report have not been copied from any other
departments/ University/ Institute.
Signature of Examiner Signature of Supervisor
4
Acknowledgement
It is a great pleasure for me to express my gratitude to our honorable President Sri.Koneru
Satyanarayana, for giving me the opportunity and platform with facilities in accomplishing the
project-based laboratory report.
I express my sincere gratitude to our Principal Dr. T Rama Krishna for his
administration towards our academic growth.
I record it as my privilege to deeply thank our pioneer HOD-ECE for providing us with the
efficient faculty and facilities to realize our ideas.
I sincerely thank our project supervisor “MR. K. SureshKumar, Assistant Professor, Dept of ECE”
for his novel association of ideas, encouragement, appreciation, and intellectual zeal which motivated us to
venture into this project successfully.
Finally, it is pleased to acknowledge the indebtedness to all those who devoted
themselves directly or indirectly to making this project report successful.
Name: V.N.D. VIRAAJITHA
ID: 2300031224
5
CONTENTS
Page No
Abstract 6
Chapter 1: Introduction 7
Chapter 2: Block Diagram 8
Chapter 3: Requirements 9
Chapter 4: Theoretical Analysis 10
Chapter 5: Simulation and Results 12
Chapter 6: Hardware implementation 14
Chapter 7: Conclusion and Future scope 16
References 18
6
ABSTRACT
Soil moisture is a critical parameter in agriculture, impacting crop growth, water management,
and soil health. Monitoring soil moisture effectively is essential to ensure sustainable
agricultural practices. This project focuses on designing a soil moisture monitoring system
using an ESP32 microcontroller. The system integrates a soil moisture sensor with the ESP32
to measure water levels in the soil and relay the data to an IoT platform for real-time
monitoring. By automating soil moisture detection, the system aims to optimize irrigation,
reduce water wastage, and improve crop yields. The project includes theoretical analysis,
simulation, and hardware implementation to create a robust and scalable solution. Future
improvements could integrate AI-based predictive irrigation systems and solar-powered
modules for remote application.
7
CHAPTER 1: INTRODUCTION
The agricultural sector is one of the most significant consumers of freshwater
globally, with inefficient irrigation practices leading to water wastage. The need for
precision agriculture has driven the adoption of technologies like IoT and smart
sensors. Soil moisture measurement plays a crucial role in determining irrigation
requirements, preventing overwatering, and maintaining soil health.
This project introduces an IoT-based solution that combines a soil moisture sensor
with the ESP32 microcontroller. The ESP32, a versatile and low-cost microcontroller
with, enables real-time data transmission to a dashboard accessible on mobile devices
or computers. The primary objectives of this project are:
1. To develop a cost-effective, automated soil moisture monitoring system.
2. To reduce manual labor and improve water management efficiency.
3. To facilitate remote monitoring through IoT platforms.
The project bridges the gap between traditional farming methods and modern
technology, offering a scalable and user-friendly solution for farmers and agricultural
researchers.
8
Chapter 2: Block Diagram
9
Chapter 3: Requirements
Hardware Requirements:
1. ESP32 Microcontroller: Low-cost, Wi-Fi-enabled microcontroller for data
processing and transmission.
2. Soil Moisture Sensor: Measures soil water content; capacitive sensors are
preferred for durability.
3. Breadboard and Jumper Wires: For prototyping and circuit connections.
4. Power Supply: Battery or DC adapter for powering components.
5. LEDs/Buzzer: For local indication of soil moisture levels.
Software Requirements:
1. Arduino IDE: For programming the ESP32 microcontroller.
2. IoT Platform: Blynk or ThingsBoard for real-time data visualization.
3. Embedded C/C++: Programming language for writing firmware.
Other requirements include an internet connection for IoT functionality and tools
like multimeters for testing circuit integrity.
10
Chapter 4: Theoretical Analysis
Soil moisture sensors are essential for determining water content in soil,
enabling effective irrigation management. The sensors operate based on
electrical properties like resistance or capacitance:
1) Resistive Soil Moisture Sensors:
These sensors use two probes inserted into the soil. The resistance
between the probes changes depending on the moisture content. Dry
soil has high resistance due to low conductivity, while wet soil has
low resistance due to the presence of water, a good conductor.
However, resistive sensors can corrode over time due to electrolytic
reactions.
2) Capacitive Soil Moisture Sensors:
Capacitive sensors measure the soil’s ability to store electrical charge.
The dielectric constant of water is significantly higher than that of soil
or air, making capacitive sensors more accurate and durable compared
to resistive ones.The ESP32 microcontroller acts as the brain of the
system, featuring:
11
 Analog-to-Digital Converter (ADC): Converts the analog signal from the
soil moisture sensor to digital data.
 Wi-Fi Module: Facilitates data transmission to an IoT platform.
 Low Power Consumption: Makes it ideal for long-term agricultural
applications.
The sensor data is processed by the ESP32 and mapped to user-defined
thresholds to indicate "dry," "moist," or "wet" conditions. This data is then
uploaded to an IoT platform for remote monitoring. Additionally, alerts (e.g.,
turning on an irrigation pump) can be automated based on the readings. The system
can be further enhanced with calibration algorithms to adjust sensor readings based
on soil type and temperature variations.
12
Chapter 5: Simulation and Results
Simulation Overview:
The system was simulated to validate its design before hardware implementation.
Tools like Proteus or Tinkercad were used for testing:
 Circuit connections between the ESP32, soil moisture sensor, and output
devices were created virtually.
 Code for the ESP32 was tested for functionality, including ADC operations,
Wi-Fi connectivity, and IoT communication.
Simulation Results:
1. Sensor Output: The sensor’s analog readings varied proportionally with soil
moisture levels.
o Dry soil: Low readings.
o Wet soil: High readings.
2. Data Processing: The ESP32 processed these readings and converted them
into percentages for easier interpretation.
3. IoT Integration: The data was successfully transmitted to platforms like
Blynk or ThingsBoard. The dashboard displayed:
13
o Real-time soil moisture levels.
o Historical data trends (e.g., hourly or daily).
4. Alerts and Automation: When moisture levels fell below the predefined
threshold, the system triggered:
o Alerts via email or push notifications.
o Activation of virtual irrigation switches during simulation.
Graphs of moisture variations were plotted on the dashboard to provide insights
into soil conditions over time. These results demonstrated the system's reliability
and practicality in real-world applications.
14
Chapter 6: Hardware and implementation
15
IMPLEMENTATION:
#define soil_moisture_pin 4
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(analogRead(soil_moisture_pin));
delay(500);
}
16
Chapter 7: Conclusion and Future scope
Conclusion:
This project successfully developed an IoT-based soil moisture monitoring system
using ESP32. The system provided accurate, real-time soil moisture data, enabling
efficient water management in agriculture. Key achievements include:
1. Seamless integration of hardware and software components.
2. Real-time data visualization and alerts via IoT platforms.
3. Cost-effective and scalable design suitable for small and large farms.
By reducing water wastage and enhancing irrigation precision, the system contributes
to sustainable farming practices. Its flexibility allows for easy customization to suit
different soil types and farming requirements.
Future Scope:
1. Advanced Analytics:
o Integration with AI and machine learning to predict irrigation schedules based on
weather patterns, soil types, and crop requirements.
o Real-time anomaly detection, such as sensor failure or sudden drops in soil
moisture.
2. Energy Efficiency:
o Incorporation of solar-powered ESP32 modules to make the system independent
of external power sources, especially in remote areas.
17
o Use of low-power sensors and communication protocols like LoRa for extended
battery life.
3. Scalability:
o Support for multiple sensors to monitor moisture levels across large agricultural
fields.
o Addition of other environmental sensors (e.g., temperature, humidity, and pH) for
comprehensive farm monitoring.
4. Automation:
o Direct integration with irrigation systems to enable autonomous watering based on
sensor readings.
o Smart water distribution based on zone-specific moisture data.
5. Mobile App Integration:
o Development of user-friendly mobile applications for farmers to access data, set
thresholds, and control irrigation systems remotely.
6. Community Applications:
o Deployment in urban green spaces and public gardens for water-efficient
maintenance.
o Use in educational institutions for research and learning about smart farming
technologies
18
REFERENCES
1. Espressif Systems. (2023). ESP32 Technical Manual. espressif.com
2. Arduino. (2023). ESP32 Setup Guide. arduino.cc
3. Islam, S. S., & Rahman, M. M. (2020). "IoT-Based Smart Irrigation."
Journal of Agricultural Engineering.
4. Dhanaraj, V., & Rajesh, S. (2021). Soil Moisture Sensing Technologies.
Springer.

ESP32-Based Smart Soil Moisture Sensor System

  • 1.
    1 SOIL MOISTURE SENSORUSING -ESP32 Project Report Submitted in the partial fulfillment of the requirements for the Course Title: PROCESSORS & CONTROLLERS Course code: 23EC2106R submitted by V.N.D. VIRAAJITHA 2300031224 UNDER THE GUIDANCE OF MR. K. SureshKumar Assistant Professor KL UNIVERSITY Green fields, Vaddeswaram – 522 302 Guntur Dt., AP, India.
  • 2.
    2 Declaration The Project Reportentitled “Soil Moisture Testing level” is a record of Bonafide work of V.N.D. VIRAAJITHA 2300031224 submitted in partial fulfillment for the subject titled 23EC2106R - PROCESSORS AND CONTROLLERS in Dept of ECE, KL University. Student Name: V.N.D. VIRAAJITHA Student ID :2300031224
  • 3.
    3 Certification This is tocertify that the Project Report entitled “SOIL MOISTURE SENOR USING ESP32” is being submitted by V.N.D. VIRAAJITHA 2300031224 in partial fulfillment for the subject titled (23EC2106R - PROCESSORS AND CONTROLLERS in Dept of ECE, KL University is a record of Bonafede work carried out under our guidance and supervision. The results embodied in this report have not been copied from any other departments/ University/ Institute. Signature of Examiner Signature of Supervisor
  • 4.
    4 Acknowledgement It is agreat pleasure for me to express my gratitude to our honorable President Sri.Koneru Satyanarayana, for giving me the opportunity and platform with facilities in accomplishing the project-based laboratory report. I express my sincere gratitude to our Principal Dr. T Rama Krishna for his administration towards our academic growth. I record it as my privilege to deeply thank our pioneer HOD-ECE for providing us with the efficient faculty and facilities to realize our ideas. I sincerely thank our project supervisor “MR. K. SureshKumar, Assistant Professor, Dept of ECE” for his novel association of ideas, encouragement, appreciation, and intellectual zeal which motivated us to venture into this project successfully. Finally, it is pleased to acknowledge the indebtedness to all those who devoted themselves directly or indirectly to making this project report successful. Name: V.N.D. VIRAAJITHA ID: 2300031224
  • 5.
    5 CONTENTS Page No Abstract 6 Chapter1: Introduction 7 Chapter 2: Block Diagram 8 Chapter 3: Requirements 9 Chapter 4: Theoretical Analysis 10 Chapter 5: Simulation and Results 12 Chapter 6: Hardware implementation 14 Chapter 7: Conclusion and Future scope 16 References 18
  • 6.
    6 ABSTRACT Soil moisture isa critical parameter in agriculture, impacting crop growth, water management, and soil health. Monitoring soil moisture effectively is essential to ensure sustainable agricultural practices. This project focuses on designing a soil moisture monitoring system using an ESP32 microcontroller. The system integrates a soil moisture sensor with the ESP32 to measure water levels in the soil and relay the data to an IoT platform for real-time monitoring. By automating soil moisture detection, the system aims to optimize irrigation, reduce water wastage, and improve crop yields. The project includes theoretical analysis, simulation, and hardware implementation to create a robust and scalable solution. Future improvements could integrate AI-based predictive irrigation systems and solar-powered modules for remote application.
  • 7.
    7 CHAPTER 1: INTRODUCTION Theagricultural sector is one of the most significant consumers of freshwater globally, with inefficient irrigation practices leading to water wastage. The need for precision agriculture has driven the adoption of technologies like IoT and smart sensors. Soil moisture measurement plays a crucial role in determining irrigation requirements, preventing overwatering, and maintaining soil health. This project introduces an IoT-based solution that combines a soil moisture sensor with the ESP32 microcontroller. The ESP32, a versatile and low-cost microcontroller with, enables real-time data transmission to a dashboard accessible on mobile devices or computers. The primary objectives of this project are: 1. To develop a cost-effective, automated soil moisture monitoring system. 2. To reduce manual labor and improve water management efficiency. 3. To facilitate remote monitoring through IoT platforms. The project bridges the gap between traditional farming methods and modern technology, offering a scalable and user-friendly solution for farmers and agricultural researchers.
  • 8.
  • 9.
    9 Chapter 3: Requirements HardwareRequirements: 1. ESP32 Microcontroller: Low-cost, Wi-Fi-enabled microcontroller for data processing and transmission. 2. Soil Moisture Sensor: Measures soil water content; capacitive sensors are preferred for durability. 3. Breadboard and Jumper Wires: For prototyping and circuit connections. 4. Power Supply: Battery or DC adapter for powering components. 5. LEDs/Buzzer: For local indication of soil moisture levels. Software Requirements: 1. Arduino IDE: For programming the ESP32 microcontroller. 2. IoT Platform: Blynk or ThingsBoard for real-time data visualization. 3. Embedded C/C++: Programming language for writing firmware. Other requirements include an internet connection for IoT functionality and tools like multimeters for testing circuit integrity.
  • 10.
    10 Chapter 4: TheoreticalAnalysis Soil moisture sensors are essential for determining water content in soil, enabling effective irrigation management. The sensors operate based on electrical properties like resistance or capacitance: 1) Resistive Soil Moisture Sensors: These sensors use two probes inserted into the soil. The resistance between the probes changes depending on the moisture content. Dry soil has high resistance due to low conductivity, while wet soil has low resistance due to the presence of water, a good conductor. However, resistive sensors can corrode over time due to electrolytic reactions. 2) Capacitive Soil Moisture Sensors: Capacitive sensors measure the soil’s ability to store electrical charge. The dielectric constant of water is significantly higher than that of soil or air, making capacitive sensors more accurate and durable compared to resistive ones.The ESP32 microcontroller acts as the brain of the system, featuring:
  • 11.
    11  Analog-to-Digital Converter(ADC): Converts the analog signal from the soil moisture sensor to digital data.  Wi-Fi Module: Facilitates data transmission to an IoT platform.  Low Power Consumption: Makes it ideal for long-term agricultural applications. The sensor data is processed by the ESP32 and mapped to user-defined thresholds to indicate "dry," "moist," or "wet" conditions. This data is then uploaded to an IoT platform for remote monitoring. Additionally, alerts (e.g., turning on an irrigation pump) can be automated based on the readings. The system can be further enhanced with calibration algorithms to adjust sensor readings based on soil type and temperature variations.
  • 12.
    12 Chapter 5: Simulationand Results Simulation Overview: The system was simulated to validate its design before hardware implementation. Tools like Proteus or Tinkercad were used for testing:  Circuit connections between the ESP32, soil moisture sensor, and output devices were created virtually.  Code for the ESP32 was tested for functionality, including ADC operations, Wi-Fi connectivity, and IoT communication. Simulation Results: 1. Sensor Output: The sensor’s analog readings varied proportionally with soil moisture levels. o Dry soil: Low readings. o Wet soil: High readings. 2. Data Processing: The ESP32 processed these readings and converted them into percentages for easier interpretation. 3. IoT Integration: The data was successfully transmitted to platforms like Blynk or ThingsBoard. The dashboard displayed:
  • 13.
    13 o Real-time soilmoisture levels. o Historical data trends (e.g., hourly or daily). 4. Alerts and Automation: When moisture levels fell below the predefined threshold, the system triggered: o Alerts via email or push notifications. o Activation of virtual irrigation switches during simulation. Graphs of moisture variations were plotted on the dashboard to provide insights into soil conditions over time. These results demonstrated the system's reliability and practicality in real-world applications.
  • 14.
    14 Chapter 6: Hardwareand implementation
  • 15.
    15 IMPLEMENTATION: #define soil_moisture_pin 4 voidsetup() { Serial.begin(9600); } void loop() { Serial.println(analogRead(soil_moisture_pin)); delay(500); }
  • 16.
    16 Chapter 7: Conclusionand Future scope Conclusion: This project successfully developed an IoT-based soil moisture monitoring system using ESP32. The system provided accurate, real-time soil moisture data, enabling efficient water management in agriculture. Key achievements include: 1. Seamless integration of hardware and software components. 2. Real-time data visualization and alerts via IoT platforms. 3. Cost-effective and scalable design suitable for small and large farms. By reducing water wastage and enhancing irrigation precision, the system contributes to sustainable farming practices. Its flexibility allows for easy customization to suit different soil types and farming requirements. Future Scope: 1. Advanced Analytics: o Integration with AI and machine learning to predict irrigation schedules based on weather patterns, soil types, and crop requirements. o Real-time anomaly detection, such as sensor failure or sudden drops in soil moisture. 2. Energy Efficiency: o Incorporation of solar-powered ESP32 modules to make the system independent of external power sources, especially in remote areas.
  • 17.
    17 o Use oflow-power sensors and communication protocols like LoRa for extended battery life. 3. Scalability: o Support for multiple sensors to monitor moisture levels across large agricultural fields. o Addition of other environmental sensors (e.g., temperature, humidity, and pH) for comprehensive farm monitoring. 4. Automation: o Direct integration with irrigation systems to enable autonomous watering based on sensor readings. o Smart water distribution based on zone-specific moisture data. 5. Mobile App Integration: o Development of user-friendly mobile applications for farmers to access data, set thresholds, and control irrigation systems remotely. 6. Community Applications: o Deployment in urban green spaces and public gardens for water-efficient maintenance. o Use in educational institutions for research and learning about smart farming technologies
  • 18.
    18 REFERENCES 1. Espressif Systems.(2023). ESP32 Technical Manual. espressif.com 2. Arduino. (2023). ESP32 Setup Guide. arduino.cc 3. Islam, S. S., & Rahman, M. M. (2020). "IoT-Based Smart Irrigation." Journal of Agricultural Engineering. 4. Dhanaraj, V., & Rajesh, S. (2021). Soil Moisture Sensing Technologies. Springer.