Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
A simple DIY soil-moisture sensor is easy to build, but a two-probe circuit measures electrical conductivity—not water content directly. Use the inexpensive resistive version below to learn or run a short-term experiment; choose an insulated capacitive sensor for longer-term plant monitoring. Whichever design you use, calibrate it in the soil and at the depth where it will operate.
Choose a sensor for the job
| Need | Suitable choice | Important trade-off |
|---|---|---|
| Cheapest educational demonstration | Two probes, a resistor, and an analog-input microcontroller | Exposed probes can corrode, and readings vary with soil salts and composition. |
| Long-term plant monitoring | Insulated capacitive sensor | It still needs application-specific calibration and suitable sealing. |
| Raspberry Pi without an external ADC | I²C capacitive sensor | Check board compatibility and installation requirements. |
| Automated irrigation | Capacitive sensor plus filtering and independent pump safeguards | A single probe samples only the soil around its sensing area. |
| Soil science or irrigation scheduling | A documented, calibrated professional soil-water sensor | A hobby sensor’s relative reading is not a substitute for validated measurement. |
A basic resistive sensor is useful for learning how a sensor and microcontroller work together. It is a poor choice for a permanent, unattended installation because current through wet soil can drive electrochemical effects and corrosion. Capacitive sensors avoid direct exposed-electrode conduction through the soil, but are not automatically accurate or waterproof. Adafruit describes the two-prong conductivity approach and its capacitive alternative in its soil sensor guide; SparkFun explains its capacitive design in its sensor documentation.
What the reading means
Resistive sensing measures conductivity
Two conductive probes form a path through the soil. The circuit measures how readily current passes between them; wetter soil generally conducts more, so the analog voltage changes. Fertilizer salts, soil type, compaction, temperature, probe material, spacing, and depth can also change that voltage. Treat the result as a relative wetness indicator for a particular installation—not a universal moisture percentage.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Capacitive sensing responds to the surrounding material
An insulated sensing area detects a change in capacitance associated with the dielectric properties around it. Because the sensing surface is insulated, it avoids the direct exposed-metal path of a resistive probe. Soil differences and placement still affect readings, so calibration remains necessary. Professional soil-water measurement may use frequency-domain or time-domain methods and should not be equated with a low-cost hobby module.
#1 Best Overall
- 【2024 Latest Wi-Fi Gateway Weather Station】: With bulti-in temperature, humidity, and barometric pressure 3-in-1 sensor, the Ecowitt GW1200 Wi-Fi gateway could not only be an indoor weather station but also be a Wi-Fi gateway to connect to Ecowitt all developed sensors/subdevices. An additional 1.5m/3ft USB extension cable for powering the gateway, allowing you to measure more accurate values at any location.
- 【Easy to Install & Easy Wi-Fi Configuration】: Ecowitt GW1200 is powered by USB(2.0 or later). With a cable clip and a USB extension cable, you can place it anywhere in your home. There are 2 methods to finish the Wi-Fi configuration: The Ecowitt APP or the website. It is recommended that you download the Ecowitt APP and finish the Wi-Fi configuration. The details about how to configure Wi-Fi are on the Quick Start Guide.
- 【Upgrade Firmware】: According to your needs decide whether to automatically update the firmware. With the firmware update, you can use the latest function of GW1200. Besides, the original data can be retained. This option is unchecked as a default setting, which means the device will not upgrade firmware by itself. If this option is enabled, it will upgrade firmware automatically (precondition: gateway GW1200 connected to your router with internet access from the network).
- 【Reliable Wireless Soil Moisture Sensor】: Equipped with advanced chip, ECOWITT WH51 wireless soil moisture sensor collect soil moisture data within 72 seconds when totally inserted into the soil. The data can be transmitted via GW1000/GW1100 Wi-Fi gateway( sold separately ) and the live data can be viewed on WS View Plus or Ecowitt APP after Wi-Fi configuration done.
- 【Indoor & Outdoor Use】: The IP66 waterproof moisture sensor can be used for indoor & outdoor potted plants, lawn, garden, farm etc. ★ Please Note : ecowitt WH51 soil moisture sensor is designed to measure soil moisture ONLY. Do not touch the stone or hard rock soil. ★
Build a switched two-probe sensor
Parts
- Arduino Uno or Nano, or another microcontroller with an analog input
- Two stainless-steel probes; stainless is preferable for a basic build. Avoid bare copper for long-term soil contact.
- One 47 kΩ resistor
- Breadboard and jumper wires
- Optional heat-shrink tubing or an enclosure to protect above-soil connections
Wire an Arduino Uno or Nano
| Part | Connection |
|---|---|
| Probe A | Digital pin D7 |
| Probe B | Analog input A0 |
| 47 kΩ resistor | Between A0 and GND |
| Ground | Common Arduino ground |
The measurement path is D7 → Probe A → soil → Probe B → A0 → 47 kΩ resistor → GND. When D7 is briefly driven HIGH, conductivity through the soil changes the voltage measured at A0. The direction and size of that change depend on the probe geometry, soil, resistor, and board voltage; calibrate the assembled sensor rather than assuming a reading.
Upload this Arduino sketch
const int POWER_PIN = 7; // Probe A
const int SENSOR_PIN = A0; // Probe B
// Replace these after calibration.
int dryValue = 120;
int wetValue = 700;
int readSoilRaw() {
digitalWrite(POWER_PIN, HIGH);
delay(20); // Allow the reading to settle
long total = 0;
const int samples = 16;
for (int i = 0; i < samples; i++) {
total += analogRead(SENSOR_PIN);
delay(2);
}
digitalWrite(POWER_PIN, LOW);
return total / samples;
}
void setup() {
Serial.begin(115200);
pinMode(POWER_PIN, OUTPUT);
digitalWrite(POWER_PIN, LOW);
}
void loop() {
int raw = readSoilRaw();
int moisturePercent = map(raw, dryValue, wetValue, 0, 100);
moisturePercent = constrain(moisturePercent, 0, 100);
Serial.print("Raw: ");
Serial.print(raw);
Serial.print(" Relative moisture: ");
Serial.print(moisturePercent);
Serial.println("%");
delay(5000);
}
Open the Arduino Serial Monitor at 115200 baud to see the raw analog reading and a normalized display value. The code’s dryValue and wetValue are placeholders, not readings to copy. The displayed percent is a relative, user-calibrated index, not measured volumetric water content.
Calibrate in the actual soil
- Assemble the circuit and insert the probes at the intended root-zone depth. Keep their spacing and insertion depth fixed.
- Record readings in soil at the plant’s dry-but-not-neglected condition. Do not use completely dry soil as the target unless that is genuinely appropriate for the plant.
- Water thoroughly, let excess drain, and wait until the soil reaches the condition you want to define as fully watered.
- Record the wet reading and enter the two observed values as
dryValueandwetValue. - Repeat the dry-to-wet observation if possible, then set a watering threshold based on the plant and observed soil condition.
Calibrate for the actual plant and medium: a succulent, seedling, tropical houseplant, and raised-bed vegetable may need different watering thresholds. Place the probe near the active root zone, not against the pot wall or immediately under the water outlet. A water-glass test does not calibrate soil: soil contains air gaps and organic matter, packs unevenly, and may contain dissolved salts. Adafruit’s guide reports readings below 100 for dry soil and above 600 for wet soil with its own simple sensor; those example values are specific to that product and are not calibration points for another circuit (Adafruit guide).
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallRank #2
- ✹✹Capacitive Sensor: Operating voltage: 3.3 ~ 5.5 VDC; Output voltage: 0 ~ 3.0 VDC; Interface: PH2.54-3P; Pin: Analog signal output, GND, VCC
- ✹✹UMLIFE automated watering DIY Kit is extremely popular since it automatically waters your plants and flowers according to monitor the soil moisture in a very efficient way.
- ✹✹Mini Water Pump: 1pcs , Rated voltage: DC3V or 4.5V; No load of water discharge capacity: 100L / H ; Load rated current: 0.18A, Use: diving type
- ✹✹Vinyl Tubing: Material: PVC ; I.D. Size: 0.22"/5.54mm; O.D. Size: 0.32"/8.20mm ; total Length:1M*2PCS
- ✹✹UMLIFE Combine Pump, Tubing, Soil Moisture Sensor and 1Channel 5V Relay Module in one plant watering system, including kits for a whole for Arduino DIY drip irrigating system.
Reduce corrosion and improve stability
Power a resistive probe only while measuring
The sketch switches the probe supply off between readings, reducing the time current flows through soil. This can reduce exposure to electrochemical effects but does not make bare electrodes corrosion-proof. Stainless probes are a practical choice; if a probe still corrodes quickly, use shorter measurement intervals or switch to an insulated capacitive design. A board finish such as ENIG can improve corrosion resistance without eliminating the underlying conductivity measurement or its electrochemical effects, as SparkFun’s resistive sensor documentation makes clear.
Filter noise without mistaking it for accuracy
- Average multiple samples; 8–32 readings is a practical starting range for reducing random ADC noise.
- Allow a settling interval after switching power on. Start around 10–50 ms and inspect the readings for your circuit.
- Consider a median of several samples to reject an occasional spike.
- Keep analog wiring short and away from pump, relay, and motor wiring. Use twisted or shielded cable where longer runs are unavoidable.
- Keep a common ground and add suitable supply bypass capacitance near the sensor and microcontroller. Espressif discusses multisampling and bypass capacitors for ADC noise reduction in its ADC documentation.
Filtering can reduce random noise; it cannot correct poor placement, changing soil composition, or the wrong threshold.
Adapt the circuit to your controller
ESP32
Use 3.3 V for the probe supply, connect the sense node only to an ADC-capable GPIO, and ensure the input never exceeds the selected board’s permitted voltage. ADC-capable pins, Wi-Fi-related restrictions, attenuation, and measurable voltage range vary by ESP32 family and board. Arduino-ESP32 documents analogRead() as a raw ADC reading and analogReadMilliVolts() as a calibrated millivolt estimate; its default resolution is generally 12 bits (nominally 0–4095), but verify the exact chip and board behavior in the current ADC documentation. Espressif notes that reference-voltage variation makes calibration relevant when voltage accuracy matters (ADC calibration documentation). Voltage calibration does not replace calibration in your soil.
Rank #3
- Through adjusting the potentiometer to control the soil humidity threshold,can automatic watering the vegetable garden, garden, control the flower pot soil moisture.
- Include Relay module, Mini water pump, Plastic Battery Storage Case Holder, USB power cable, Jumper wires, 0.5m Vinyl Tubing and Soil Moisture Detector Module.
- Note:Do not pour water directly on the sensor. The humidity of the water will rust the sensor.
- Easy assemble, make your life more automated, particularly suitable for people who travel frequently!
Raspberry Pi
A Raspberry Pi generally has no built-in analog input. For an analog probe, add an external ADC such as an MCP3008 or ADS1115; alternatively, use a compatible I²C capacitive sensor. Adafruit explicitly warns that its simple analog sensor is not a direct Raspberry Pi input and presents a capacitive option for that use case (guide; STEMMA sensor).
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →When to switch to a capacitive sensor
Choose a capacitive design for unattended monitoring, outdoor installations, or battery-powered nodes where exposed resistive probes are a poor fit. The sensing area should be insulated and sealed, with electronics kept above the soil line; low-cost modules vary in construction and sealing, so inspect the actual module and installation. Capacitive outputs can be analog, I²C, or another digital interface. SparkFun’s Qwiic sensor uses a capacitive controller and has documented calibration plus Arduino and MicroPython support (guide; library documentation). Adafruit’s STEMMA Soil Sensor uses capacitive measurement over a four-pin I²C connection (product page). Neither type guarantees a universal moisture percentage.
Use safeguards for automated watering
A sensor reports conditions near one point, not throughout a whole pot or garden bed. Large containers can be wet beside the probe and dry elsewhere. Do not let one threshold directly run a pump without independent protections.
Rank #4
- Soil Moisture Sensor Module:10Pcs Soil Moisture Sensor Module Kit
- Soil Moisture Sensor Size:30*16*6.3mm
- Soil Moisture Meter Detection Module Size:59*19.5mm
- Volts:3.3V-5V
- Comparator Chip:LM393
- Require several consecutive low readings before starting a watering cycle.
- Use hysteresis: set separate start and stop thresholds so the pump does not chatter near one boundary. For example, start below a calibrated 30% relative index and stop above 45%; these are examples only, not recommended universal values.
- Set a minimum delay between cycles and a maximum pump runtime.
- Stop the pump if the reservoir is low; provide a manual override and a physical overflow or leak safeguard.
- Use a relay or MOSFET rated for the pump’s voltage and current, flyback protection for inductive loads, and a pump supply appropriate to the load rather than powering the pump from the microcontroller supply.
- Take post-watering readings after drainage and equilibration instead of assuming one immediate measurement proves the watering succeeded.
Troubleshoot common readings
Reading stays at zero
Check common ground, probe continuity, the selected analog pin, the switched pin’s output, and the resistor connection from the sense node to ground. Confirm that the code’s pin numbers match the board’s pin convention.
Reading stays at maximum
Look for a sense node shorted to supply, missing pull-down resistor, probe wires touching, or an incorrectly configured analog pin. If the input may be above the ADC’s allowed range, disconnect the sensor before further testing.
Recommended Free Tools
Reading changes when the cable moves or ESP32 values jump
Inspect loose breadboard connections and ground first. Shorten analog wiring, separate it from noisy loads, allow settling time, and average readings. On an ESP32, verify the exact ADC-capable pin, attenuation, Wi-Fi restrictions, and input range; consult the Arduino-ESP32 ADC documentation if calibrated millivolt readings are needed.
Best Value
- Automatic Irrigation DIY Kit: LM393 Soil Moisture Detect Sensor,Mini Water Pump, Tubing, Battery Case,One Channel 5V Relay Module and Jumper Wires in One Plant Watering System, It Can Water Plants and Flowers Automatically ,According to Monitor the Soil Moisture
- LM393 Soil Moisture Detect Sensor: Used LM393 Chip and Stabilizes. Operating Voltage: 3.3V to 5V; PCB Size: 32mm x 14mm/ 1.26 inch x 0.55 inch; Equipped with a Fixed Bolt Hole that is Easy to Install
- 1 Channel 5V Relay Module: Maximum Load: AC 250V/10A, DC 30V/10A; Operating Voltage 12V; Power Indicator (Green), Relay Status Indicator (Red)
- Mini Water Pump: Rated Voltage: DC 3V or 4.5V; No Load of Water Discharge Capacity: 100L / H ; Load Rated Current: 0.18A; Use: Diving Type
- Wide Application: This Submersible Pump Can be Used for Small Size Aquarium, Fish Tank, Pond, Tabletop Fountains, Water Gardens and Hydroponic Systems
Reading changes after fertilizer
Dissolved salts alter conductivity independently of moisture, so this is expected with resistive probes. Recalibrate in the actual soil and fertilizer conditions or move to a capacitive sensor.
Reading stays wet after watering
Check for water pooling at the probe, poor drainage, placement too close to the outlet, or a probe depth that does not represent the root zone. Let excess water drain and the soil settle before deciding that the threshold is wrong.
Bottom line on DIY soil sensing
Build the two-probe circuit when the aim is an inexpensive, understandable experiment. For unattended monitoring, use an insulated capacitive sensor and calibrate it at its actual installation depth. In either case, base watering decisions on observed plant needs and soil conditions—not a raw ADC number presented as a universal percentage.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.


Leave a Reply