Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

YL-69 Soil Moisture Sensor with Arduino: Wiring, Code, Calibration and Troubleshooting

A practical YL-69 Arduino guide covering wiring, an analog-reading sketch, calibration, A0 versus D0, fluctuation causes, corrosion, and capacitive alternatives.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect the YL-69 probe’s controller-board A0 pin to an Arduino Uno analog input, then read that pin with analogRead(). The resulting number is a setup-dependent raw value—not a universal moisture percentage. The reliable way to use it is to record readings in your own dry and wet soil, choose a threshold from those observations, and treat the project as a relative wet/dry indicator.

What the YL-69 project uses

Sheekar Banerjee’s Arduino Project Hub example, published May 23, 2022, uses an Arduino Uno Rev3 and a YL-69 soil hygrometer. Its sketch reads the sensor at A0, prints the value over serial at 9,600 baud, compares it with a configurable threshold of 1,000, and waits three seconds between readings. The variable is named rainPin, but the input is the soil-moisture module, not a rain sensor. See the original project and sketch at Arduino Project Hub.

A typical YL-69 kit contains an exposed two-electrode probe and a small controller board. Common boards provide VCC, GND, analog output A0, and comparator output D0. Check the labels on your actual board because generic FC-28/YL-69 kits are not presented identically by every seller.

How the sensor works

The probe is resistive: electrical conduction between its electrodes changes as the surrounding soil becomes wetter or drier. The controller board conditions that signal. Its analog output preserves a range of readings for a sketch to inspect, while the LM393 comparator and adjustment potentiometer create a digital above/below-threshold signal. Technical descriptions are available from the University of Belgrade and Cirkit Designer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HiLetgo 5pcs LM393 3.3V-5V Soil Moisture Detect Sensor Soil Moisture Sensor Soil Hygrometer Detection for Arduino Automatic Watering System Robot Smart car
  • This is a simple moisture sensor can be used to detect soil moisture, when the soil water shortage, the module outputs a high level, whereas the output low.
  • Use this sensor to make an automatic watering device that will keep your garden of plants unmanaged.
  • Module dual output mode, digital output is simple, more accurate analog output.
  • Sensitivity adjustable (Figure blue digital potentiometer adjustment)
  • Comparator using LM393 chip, stable job

Wiring an Arduino Uno

  1. Insert the probe into the controller board’s probe connector.
  2. Connect VCC on the controller to the Uno’s 5V pin.
  3. Connect GND to an Uno GND pin.
  4. Connect controller-board A0 to Arduino A0.
  5. Leave D0 disconnected when you want the full analog reading.

Power the board only after checking the pin labels and ensuring the probe is not shorting against other conductors. The published project uses this 5 V, ground, and A0 arrangement.

Beginner Arduino sketch

const int sensorPin = A0;
const int thresholdValue = 1000;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int reading = analogRead(sensorPin);

  Serial.print("Soil reading: ");
  Serial.println(reading);

  if (reading < thresholdValue) {
    Serial.println("No watering suggested");
  } else {
    Serial.println("Watering suggested");
  }

  delay(3000);
}

Upload the sketch, open Arduino IDE’s Serial Monitor, and select 9600 baud. The comparison reproduces the Project Hub example: values below 1,000 follow its “no watering” branch and values at or above 1,000 follow its “watering suggested” branch. That boundary is an example observed for that project, not a calibrated recommendation for every YL-69, board, supply, soil mix, or plant.

Rank #2
Stemedu 5PCS Capacitive Analog Soil Moisture Sensor Module 3.3~5.5V Corrosion Resistant Humidity Detection Sensors DIY Electronic for Arduino for Raspberry Pi
  • 【Version】This capacitive analog soil moisture sensor is V1.2
  • 【Voltage】Working voltage: 3.3~5.5 VDC, output voltage: 0~3.0 VDC
  • 【Interface】Interface: PH2.54-3P, Pin: Analog signal output, GND, VCC
  • 【Feature】Capacitive humidity sensor has good linearity, good repeatability, small hysteresis, fast response, small size, and can be used at - 10 ℃ - 60 ℃ humidity environment
  • 【Comparision】This capacitive soil humidity sensor is different from most of the resistive sensors. It uses the capacitive sensing principle to detect soil humidity, avoiding the problem that the resistive sensor is easily corroded, and greatly extending its working life.

How to interpret the analog number

analogRead() reports the Arduino’s raw ADC reading. It is meaningful only in the context of your particular probe, wiring, board, supply, soil composition, and placement. Do not label it “percent moisture” unless you have established and validated a conversion for that exact setup.

Calibrate with your actual soil

  1. Place the probe at the same depth and location you will use for monitoring.
  2. Record several readings in soil representing the dry condition at which you want watering considered.
  3. Water the soil thoroughly, allow excess water to drain, and record readings again in the wet condition.
  4. Repeat measurements at the intended plant location rather than relying on a reading taken in a glass of water or a different potting mix.
  5. Choose a threshold between your observed reference ranges, then test it over several watering cycles.

The Czech Technical University’s BMI Wiki guidance likewise recommends dry and wet reference readings for the specific sensor and soil. Check which direction your numbers move before writing “higher means drier” or “higher means wetter”: the project’s code assumes the polarity it observed, but clones and circuits should not be treated as universally identical.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
MTDELE 10Pcs 3.3V Capacitive Soil Moisture Sensor Module
  • Capacitive Soil Moisture Sensor: Compatible with for Arduino Raspberry Pi
  • Size:98*23mm
  • Operating Voltage:3.3V DC;Output Voltage:0-3.0V DC
  • Interface Type:PH2.54 3Pin
  • Commodities include:10Pcs Soil Moisture Sensor;10Pcs connecting wire

Use a range instead of one abrupt switch

For a gentler controller, map the calibrated endpoints to a display range or use two thresholds: one to request watering and a second, wetter threshold to stop the request. This prevents rapid switching when a reading hovers around one boundary. Keep the raw value visible during setup so you can diagnose changes instead of hiding them behind a percentage.

Analog A0 versus digital D0

Output What it provides Best use
A0 A changing analog reading from the probe circuit Calibration, logging, displays, and graduated control
D0 A comparator state set by the module’s potentiometer Simple dry/wet indication or an on/off trigger

Turning the potentiometer changes the D0 switching point; it does not create a universal moisture percentage. Use A0 when the sketch needs to see how far the reading has moved.

Rank #4
VKLSVAN 3PCS Capacitive Analog Soil Moisture Sensor 3.3-5.5V Corrosion Resistant Humidity Detection Sensors Garden Watering DIY for Arduino for Raspberry Pi
  • 【Specifications】Operating voltage: DC3.3-5.5V, output voltage: DC0-3.0V, size: 98*23mm,Interface:PH2.0-3P, The sensor has a 3-pin "gravity" interface, which can be directly connected to the gravity I/O expansion baffle.
  • 【Capacitive sensing】Soil moisture content is measured by capacitive sensing. Instead of measuring soil moisture by resistive sensing like other types of humidity sensors,It avoids the problem of resistive sensors and their easy corrosion, greatly extending its working life.
  • 【DIY watering system】 If you combine this soil moisture sensor with a small water pump, hose, relay module, etc., you can create an automatic watering device. DIY kit for a device that waters when the soil is dry, freeing you from daily watering and making things easier. Rest assured when you are away for work or travel.
  • 【Easy to use】Insert the soil and detect the output of real-time soil moisture data. This soil moisture meter has a built-in constant voltage chip and supports a 3.3V voltage operating environment, so it will work normally with a 3.3V master board. Micro PCs can be operated by simply connecting one external ADC (analog signal to digital signal) conversion module.
  • 【Application in Various Occasions】Connect the screen and the motherboard to obtain real-time soil moisture data. Suitable for automatic watering system robots, etc. Commonly used in garden plants, humidity detection, and smart agriculture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why YL-69 readings fluctuate

  • Probe placement: Moving the electrodes even a short distance changes the soil they measure. Keep depth, orientation, and location consistent.
  • Soil composition: Salts, fertilizer, clay, organic matter, and compaction alter conductivity. Two pots with the same apparent dampness can produce different values.
  • Probe variation: Nominally identical low-cost probes and controller boards can produce different raw readings.
  • Electrical noise and timing: Read after the circuit has powered up, avoid loose jumper connections, and average several samples if the display is visibly unstable.
  • Corrosion: The exposed electrodes can degrade, changing the response over time. The Arduino Forum discussion documents fluctuation and corrosion concerns.

A simple software average can make a demonstration steadier:

long total = 0;
for (int i = 0; i < 10; i++) {
  total += analogRead(A0);
  delay(20);
}
int averagedReading = total / 10;

Averaging reduces short-term noise; it cannot correct a corroded probe, a loose connection, or a threshold copied from another soil.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value

Practical limitations and alternatives

The YL-69 is inexpensive and useful for learning, alarms, and short demonstrations. It is not established by the cited sources as a precision agricultural instrument: no validated accuracy percentage, service-life number, or universal soil-moisture conversion is available for the exact kit. Because the electrodes contact wet soil, long-term installations should account for corrosion and periodic recalibration.

A capacitive soil-moisture module is an alternative when avoiding exposed conductive electrodes is important. It is a different sensor, not a drop-in claim of guaranteed accuracy or maintenance-free operation; calibrate it in the same installation-specific way. The trade-off is discussed in the ShillehTek manual and the Arduino Forum discussion.

Quick Recap

Bestseller No. 1
HiLetgo 5pcs LM393 3.3V-5V Soil Moisture Detect Sensor Soil Moisture Sensor Soil Hygrometer Detection for Arduino Automatic Watering System Robot Smart car
HiLetgo 5pcs LM393 3.3V-5V Soil Moisture Detect Sensor Soil Moisture Sensor Soil Hygrometer Detection for Arduino Automatic Watering System Robot Smart car
Module dual output mode, digital output is simple, more accurate analog output.; Sensitivity adjustable (Figure blue digital potentiometer adjustment)
$7.89
Bestseller No. 2
Stemedu 5PCS Capacitive Analog Soil Moisture Sensor Module 3.3~5.5V Corrosion Resistant Humidity Detection Sensors DIY Electronic for Arduino for Raspberry Pi
Stemedu 5PCS Capacitive Analog Soil Moisture Sensor Module 3.3~5.5V Corrosion Resistant Humidity Detection Sensors DIY Electronic for Arduino for Raspberry Pi
【Version】This capacitive analog soil moisture sensor is V1.2; 【Voltage】Working voltage: 3.3~5.5 VDC, output voltage: 0~3.0 VDC
$8.98
Bestseller No. 3
MTDELE 10Pcs 3.3V Capacitive Soil Moisture Sensor Module
MTDELE 10Pcs 3.3V Capacitive Soil Moisture Sensor Module
Capacitive Soil Moisture Sensor: Compatible with for Arduino Raspberry Pi; Size:98*23mm
$12.99
Bestseller No. 5
Songhe Capacitive Soil Moisture Sensor Module Corrosion Resistant Moisture Detection Garden Watering for Arduino DIY 3.3~5.5V 5pcs
Songhe Capacitive Soil Moisture Sensor Module Corrosion Resistant Moisture Detection Garden Watering for Arduino DIY 3.3~5.5V 5pcs
Chip is TL555; Operating Voltage: 3.3 ~ 5.5 VDC; Output Voltage: 0 ~ 3.0 VDC; PH:2.54MM
$12.99

Quick troubleshooting checklist

  • No serial output: Confirm the sketch uploaded, the correct board and port are selected, and Serial Monitor is set to 9600 baud.
  • Always zero or fixed: Recheck VCC, GND, the A0 wire, and the probe connector; test without bending or damaging the probe cable.
  • Values move in the opposite direction: Record dry and wet readings and reverse the comparison if your circuit’s observed polarity differs from the example.
  • Unstable values: Keep placement fixed, tighten connections, wait between samples, and average readings.
  • Threshold never works after moving the sensor: Recalibrate in the new soil, pot, depth, and supply arrangement.

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

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.