0% found this document useful (0 votes)
36 views9 pages

Soil Moisture Sensor

The document outlines a project on interfacing a soil moisture sensor with a Raspberry Pi, detailing its components, working principles, and applications. It describes how the sensor measures soil moisture using electrical conductivity and provides a Python code example for implementation. Applications include automatic irrigation, precision agriculture, and environmental monitoring.

Uploaded by

Kaushek Joshii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views9 pages

Soil Moisture Sensor

The document outlines a project on interfacing a soil moisture sensor with a Raspberry Pi, detailing its components, working principles, and applications. It describes how the sensor measures soil moisture using electrical conductivity and provides a Python code example for implementation. Applications include automatic irrigation, precision agriculture, and environmental monitoring.

Uploaded by

Kaushek Joshii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Pimpri Chinchwad College of Engineering

Nigdi, Pune

Course: OE-III Designing with Raspberry Pi

Soil Moisture Sensor Interfacing with


Raspberry Pi

Guided by: Dr. Satyashil Nagarale


Name of students PRN
Mihir Deshwandikar 122B1G039
Gunmay Shetty 122B1G171
Pratik Ghodke 122B1G054
Kaushek Joshii 122B1G073
Shriram Nimbalkar 123B2G229
Yashraj Haridas 122B1D023
Introduction to Soil Moisture Sensor
● A soil moisture sensor is a device that measures the amount of
water present in the soil, typically by detecting changes in
electrical conductivity or dielectric constant.

● It allows precise monitoring of soil moisture levels.


● Primarily used in agriculture to optimize irrigation scheduling and
conserve water by only watering when necessary.
Hardware Overview
A typical soil moisture sensor consists of two parts. Sensor + Sensor -
Sensing Probe
1. The Probe
● The probe senses the level of moisture
● It consists of two exposed conductors that are inserted into the soil
● It acts as a variable resistor, with resistance varying according to soil
moisture.
1. The Module
● The module connects the probe to the RPi board
● The module generates an output voltage based on the resistance of the
probe, which is available at an Analog Output (AO) pin Sensor Module
● LM393 High Precision Comparator digitizes it and makes it available at a
Potentiometer for Power LED
Digital Output (DO) pin sensitivity adjustment
● The potentiometer on the module is used for adjusting the sensitivity of the
VCC
digital output (DO) Sensor + GND
Sensor - Digital out
● You can use it to set a threshold, so that when the soil moisture level
Analog out
exceeds the threshold, the module outputs LOW otherwise HIGH.
LM393 Moisture detect
● Rotate the knob clockwise to increase sensitivity and
comparator LED
counterclockwise to decrease it.
Specifications:
Components Used:-

• Soil Moisture sensor – Analog and resistance based


• Raspberry Pi
• Module (Analog-to-Digital Converter)- LM393 High Precision Comparator
• Jumper Wires
• Power Supply – 3.3V or 5V

● Operating Current: 15mA


● Output Digital - 0V to 5V, Adjustable trigger level from preset
● Output Analog - 0V to 5V
● LEDs indicating output and power
How Does a Resistive Soil Moisture Sensor Work?
Basic Principle – Electrical Conductivity & Resistance

• WORKING PRINCIPLE : The sensor applies a small voltage across its probes and measures
the current flow to determine soil moisture level.
• As water is a good conductor of electricity therefore the soil with water content has low
resistance whereas the dry soil has large resistance.
• Ohm’s Law (V=IR) is used to calculate resistance
• More water content → Higher conductivity (Lower resistance).
• Dry soil → Lower conductivity (Higher resistance).

• The sensor outputs an analog voltage proportional to soil moisture.

• Requires an ADC (Analog-to-Digital Converter) to interface with a Raspberry Pi.


• (If we want to measure exact moisture content)
Step-by-Step Process of Measuring Soil Moisture
1. Insert the probes into the soil.

1. Apply a small voltage (~5V) across the probes.

1. Measure resistance across probes:


Wet soil → Low resistance → High current flow.
Dry soil → High resistance → Low current flow.

4.Convert resistance into voltage output (proportional to moisture level).

5.Microcontroller (Arduino/Raspberry Pi) processes the voltage and displays the moisture percentage.
Interfacing diagram
Python Code
import RPi.GPIO as GPIO # Main loop
import time try:
while True:
# Use BOARD numbering (physical pin numbers) moisture = GPIO.input(SOIL_SENSOR_PIN) # Read digital output

GPIO.setmode(GPIO.BOARD) if moisture == GPIO.LOW: # LOW means dry


print("Soil is DRY! RGB LED = Red")
# Define pins using BOARD numbering GPIO.output(RED_LED, GPIO.HIGH) # Turn on Red LED
GPIO.output(GREEN_LED, GPIO.LOW) # Turn off Green LED
SOIL_SENSOR_PIN = 16 # Physical pin 16 (corresponds to BCM GPIO 23)
RED_LED = 8 # Physical pin 8 (corresponds to BCM GPIO 14) else: # HIGH means wet
GREEN_LED = 10 # Physical pin 10 (corresponds to BCM GPIO 15) print("Soil has moisture. RGB LED = Green")
GPIO.output(RED_LED, GPIO.LOW). # Turn off Red LED
# Set up GPIO pins GPIO.output(GREEN_LED, GPIO.HIGH) # Turn on Green LED

GPIO.setup(SOIL_SENSOR_PIN, GPIO.IN) # Set soil sensor pin as input time.sleep(1) # Wait 1 second before reading again
GPIO.setup(RED_LED, GPIO.OUT) # Set Red LED as output
GPIO.setup(GREEN_LED, GPIO.OUT) # Set Green LED as output except KeyboardInterrupt:
print("\nExiting program")
GPIO.cleanup() # Reset GPIO settings before exiting
Applications:
• Automatic irrigation systems :Automatically waters plants when soil moisture is low, saving water
and improving plant health.
• Precision Agriculture – Optimizes irrigation in farms by monitoring soil moisture at different
locations.
• Greenhouse Monitoring System – Controls irrigation, humidity, and temperature for ideal plant
growth in greenhouses.
• Urban Gardening & Smart Home Gardens – Automates watering for home gardens and integrates
with smart home systems.
• Environmental Monitoring & Research – Tracks soil moisture in forests, wetlands, and
conservation areas for ecological studies.
• Landslide & Flood Prediction System – Detects high soil moisture levels to predict and warn about
landslides or floods.
• Disaster Recovery & Drought Monitoring – Collects long-term soil moisture data to aid in drought
prediction and response planning.

You might also like