Final-year projects / Agriculture

Smart irrigation with soil moisture and weather check

Small farmers often water by habit, wasting water and power in some weeks and stressing crops in others. A low-cost controller that waters only when the soil is dry and skips watering before rain can cut both.

ESP32Mini or Major projectECE, EEE, EIE, CSE, Diploma
ESP32SOILTEMPERRAIN26.9°CFeatured
Parts
₹4,470
Build
12 weeks
Board
ESP32
Objectives
6

Block diagram

Inputs
  • SOIL
    Soil moisture sensorsMeasure how wet the soil is at root depth
  • TEMPER
    Temperature and humidityAdds weather context
  • RAIN
    Rain sensorSkips watering when it rains
Controller
  • ESP32
    ESP32 controllerDecides when to water
Power
  • 12
    12 V supplyPowers pump and board
  • SOLAR
    Solar power unitPanel, charger and cell that keep the node running+
Outputs
  • Relay and pumpSwitches the 12 V pump
  • 23.4°COLED
    OLED displayShows moisture and pump state
  • 4G
    4G modemSends SMS alerts and calls over the mobile network+

Objectives

  1. To measure soil moisture at root depth with capacitive sensors and calibrate them for the field soil.
  2. To switch a pump automatically between set dry and wet levels, with hysteresis.
  3. To skip a watering cycle when rain is detected.
  4. To measure the water saved compared with fixed-time watering over two weeks.
  5. To send SMS alerts through a 4G modem where no Wi-Fi is available.
  6. To power the system from a solar-charged battery and measure its energy budget.

Parts and specifications

Total about ₹4,470 at typical online prices. Tap a part for its pinout and datasheet notes.

Design calculations

Moisture in percent

Calibrate each probe: read ADC in dry air (about 2900) and in water (about 1300). Moisture % = (ADCdry − ADC) / (ADCdry − ADCwet) × 100. A reading of 2100 gives (2900 − 2100) / 1600 × 100 = 50%.

Hysteresis band

Start the pump below 35% and stop above 60%. The 25-point band stops the pump from chattering as water spreads through the soil.

Pump run time

A 1.8 L/min pump and a 4 L target per bed need 4 / 1.8 = 2.2 minutes. Cap each run at 5 minutes as a fail-safe if a sensor fails dry.

Power budget

Pump 12 V × 0.8 A = 9.6 W while running. ESP32 about 0.5 W. A 12 V 2 A (24 W) adapter leaves margin for the pump's start surge.

Pin map

SignalPin or connection
Soil sensor 1 / 2 (analog)GPIO 34 / 35 (ADC1, input only)
DHT22 dataGPIO 4 (10 kΩ pull-up to 3.3 V)
Rain sensor DOGPIO 27
Relay INGPIO 26 (active-low)
OLED SDA / SCLGPIO 21 / 22
PumpRelay NO contact in the 12 V line

Firmware outline

  1. Read each soil probe 10 times and take the median, every 30 s.
  2. Convert to percent with the stored dry and wet calibration values.
  3. If rain is detected or it rained in the last 6 h, skip watering.
  4. State machine: IDLE → WATERING when below 35%, WATERING → SOAK when above 60% or 5 min passed, SOAK waits 10 min before checking again.
  5. Drive the relay pin and show moisture, state and last watering time on the OLED.
  6. Count litres from run time and keep a daily total for the water-saving study.

Test plan

TestExpected result
Probe in dry soil, then wateredReading moves from below 30% to above 60%
Soil below 35%Pump starts within 30 s
Rain sensor wettedWatering skipped and shown on the display
Pump runs 5 minutes without reaching 60%Pump stops and shows a sensor fault
Two weeks against a fixed-time bedLitres used compared in a table

These rows start your results table when you plan the project.

Viva practice

Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 6.

1. Why capacitive and not resistive soil sensors?
2. Why do you use ADC1 pins on the ESP32?
3. What is hysteresis and why do you need it?
4. How would you water a whole farm?
5. How did you calibrate the sensor?
6. What is the main limit of your system?

Make it yours

One or two upgrades for a mini project, two to four for a major one.

Build these first

Datasheets and sources to cite

  • DFRobot capacitive soil moisture sensor v1.2 notes
  • Aosong DHT22 (AM2302) datasheet
  • Espressif ESP32 technical reference manual
  • FAO Irrigation and Drainage Paper 56 (crop water needs)

About this project

How much does the smart irrigation with soil moisture and weather check project cost?

About ₹2,270 for the parts in the base list: ESP32 DevKit V1, Capacitive soil moisture sensor v1.2 × 2, DHT22 temperature and humidity sensor, Rain drop sensor module, 5 V relay module (1 channel), 12 V diaphragm water pump, 12 V 2 A DC adapter, LM2596 buck converter (12 V to 5 V for the board), 0.96 inch OLED (SSD1306, I²C), Breadboard 830 points, Tube, wires and enclosure box.

How long does it take?

About 8 weeks for the base project, built on an ESP32. Each upgrade adds time.

Which branches is it suitable for?

Electronics and Communication, Electrical and Electronics, Instrumentation, Computer Science / IT (IoT, AI), Diploma (any electronics branch), as a mini or major project.

Which pins and design calculations does it use?

Soil sensor 1 / 2 (analog) on GPIO 34 / 35 (ADC1, input only); DHT22 data on GPIO 4 (10 kΩ pull-up to 3.3 V); Rain sensor DO on GPIO 27. Worked calculations on this page: moisture in percent, hysteresis band, pump run time, power budget.

How do I test it?

Probe in dry soil, then watered: Reading moves from below 30% to above 60%. Soil below 35%: Pump starts within 30 s. Rain sensor wetted: Watering skipped and shown on the display. Pump runs 5 minutes without reaching 60%: Pump stops and shows a sensor fault. Two weeks against a fixed-time bed: Litres used compared in a table.

What are the objectives?

To measure soil moisture at root depth with capacitive sensors and calibrate them for the field soil. To switch a pump automatically between set dry and wet levels, with hysteresis. To skip a watering cycle when rain is detected. To measure the water saved compared with fixed-time watering over two weeks.