Interfacing Soil Moisture Sensor with Arduino

Arduino Soil Moisture Sensor Circuit
Soil Moisture Level
Dry (0%) Medium (50%) Wet (100%)
0 % Moisture

Instructions

Objective:

Learn to use the Soil Moisture Sensor to measure soil humidity levels and control RGB LED indicators based on moisture content, enabling automated plant watering systems.

Steps to Perform:

  1. Click 'Start Simulation' to power the Arduino and enable the moisture sensor
  2. Use the slider to adjust soil moisture levels from 0% (dry) to 100% (wet)
  3. Observe the RGB LED color changes:
    • Red LED: Dry soil (0-39% moisture) - needs watering
    • Yellow LED: Moderate moisture (40-54% moisture) - optimal level
    • Green LED: High moisture (54-100% moisture) - overwatered
  4. Monitor the moisture percentage displayed below the slider
  5. Notice how the sensor reading maps to 0-255 Arduino analog values

Key Concepts:

  • Soil Moisture Sensor: Measures soil water content using resistance between two probes
  • Analog Reading: Arduino reads sensor values (0-1023) and maps to 0-255 range
  • RGB LED Indication: Visual feedback system with three states (dry/moderate/wet)
  • Threshold Logic: if-else conditions control LED based on moisture ranges
  • Automated Irrigation: Can trigger water pumps when moisture drops below threshold
  • Applications: Smart agriculture, garden automation, greenhouse monitoring

Arduino Code