กลับไปหน้ารวมไฟล์
yl69-soil-moisture-sensor-with-arduino-sheekar-banerjee-e2d9ca-en.md

Analog Probes: Interfacing the YL-69 Sensor

The YL-69 Sensor (often packaged with the LM393 comparator chip) is the introductory standard for all agricultural Arduino projects. While the "Automatic Watering System" controls the pumps, this foundational lesson taught by engineers like Sheekar Banerjee focuses purely on safely reading and mapping the raw electrical conductivity of the dirt itself.

stock_counter_lcd_setup_1772706693516.png

Analog-to-Digital Conversion (ADC)

The YL-69 is essentially just a giant variable resistor made of two exposed aluminum prongs.

  1. The Circuitry: The two prongs are pushed deep into the soil. Because water conducts electricity, the wetter the soil, the lower the resistance between the two prongs.
  2. The current flows down to the LM393 analog amplifier board.
  3. The analogRead() Math: The signal travels to Arduino pin A0 where the 10-bit ADC translates the 0-5V signal into a number from 0 to 1023.
    • 0 suggests a short circuit (You dropped the sensor in a glass of pure water).
    • 1023 suggests infinite resistance (Bone dry sand).

Preventing Galvanic Corrosion

The biggest failure of the YL-69 is that it dissolves within 3 days if left powered on in wet dirt.

  • This is called Galvanic Corrosion (electrolysis tears the copper traces right off the fiberglass board).
  • The Engineer's Solution: Do NOT wire the sensor's VCC pin directly to the 5V pin on the Arduino.
  • Wire the sensor's VCC to a digital pin (e.g., Pin 7).
  • In the code: digitalWrite(7, HIGH); delay(100); moisture = analogRead(A0); digitalWrite(7, LOW); delay(600000);
  • By only powering the sensor for a tenth of a second every 10 minutes, the sensor will physically survive buried in the dirt for years instead of days!

Setup List

  • Arduino Uno/Nano.
  • YL-69 / HL-69 Soil Moisture Probes with LM393 Comparator module.
  • (Warning: Ensure the probe prongs are pushed beneath the root level of the plant for accurate moisture readings, not just the topsoil).

ข้อมูล Frontmatter ดั้งเดิม

title: "YL69 Soil Moisture Sensor with Arduino | Sheekar Banerjee"
description: "Precision dirt metrics! Properly interface the sensitive YL-69 analog sensor to read deeper soil conductivity thresholds and prevent rapid galvanic corrosion."
category: "Sensors & Environment"
difficulty: "Easy"