Instructions

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 7

DownloadInstructions
Open PDF In BrowserView PDF
Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

randomnerdtutorials.com

Guide for Soil Moisture Sensor
YL-69 or HL-69 with the Arduino
4-5 minutes

The soil moisture sensor or the hygrometer is usually used
to detect the humidity of the soil. So, it is perfect to build an
automatic watering system or to monitor the soil moisture of
your plants.
The sensor is set up by two pieces: the electronic board (at
the right), and the probe with two pads, that detects the
water content (at the left).

The sensor has a built-in potentiometer for sensitivity
1 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

adjustment of the digital output (D0), a power LED and a
digital output LED, as you can see in the following figure.

You can also read this guide for the Rain Sensor FC-37 or
YL-83 with Arduino.

How does it work?
The voltage that the sensor outputs changes accordingly to
the water content in the soil.
When the soil is:
Wet: the output voltage decreases
Dry: the output voltage increases

2 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

The output can be a digital signal (D0) LOW or HIGH,
depending on the water content. If the soil humidity
exceeds a certain predefined threshold value, the modules
outputs LOW, otherwise it outputs HIGH. The threshold
value for the digital signal can be adjusted using the
potentiometer.
The output can be a analog signal and so you’ll get a value
between 0 and 1023.

Example: Soil Moisture Sensor with the
Arduino
This is a simple example for you to understand how you can
use the soil moisture sensor in your projects with Arduino.
In this example, you’ll read the analog sensor output values
using the Arduino and print those readings in the Arduino
IDE serial monitor.
Parts required
For this example, you’ll need the following components:
1x YL-69 moisture sensor (view on eBay)
1x Arduino (view on eBay)
1x Breadboard
2x 220 Ohm Resistors
1x Red LED
1x Green LED
3 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

Jumper wires
Pin Wiring
Wiring your sensor to the Arduino is pretty simple:
Pin

Wiring to Arduino Uno

A0

Analog Pins

D0

Digital Pins

GND

GND

VCC

5V

Schematics
To complete the project, follow these schematics:

Code
Upload the following sketch to your Arduino board:
/*
All the resources for this project:

4 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

http://randomnerdtutorials.com/
*/
int rainPin = A0;
int greenLED = 6;
int redLED = 7;
// you can adjust the threshold value
int thresholdValue = 800;void setup(){
pinMode(rainPin, INPUT);
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
digitalWrite(greenLED, LOW);
digitalWrite(redLED, LOW);
Serial.begin(9600);
}void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(rainPin);
Serial.print(sensorValue);
if(sensorValue < thresholdValue){
Serial.println(" - Doesn't need
watering");
digitalWrite(redLED, LOW);
digitalWrite(greenLED, HIGH);
}
else {
Serial.println(" - Time to water your
plant");
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, LOW);
}
5 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

about:reader?url=https://randomnerdtutorials....

delay(500);
}
Open the Arduino IDE serial monitor to see the values.
Then, try your sensor in a wet and in a dry soil and see
what happens.
When the analog value goes above a certain threshold, a
red LED will turn on (indicates that the plant needs
watering), and when the value goes below a certain
threshold, a green LED will turn on (indicates that the plant
is ok).

Wrapping Up
The moisture sensor allows to monitor the water content in
the soil. This is useful if you want to build an automatic
watering system. You can also use it to just monitor your
plants soil moisture.
I hope you’ve found this guide useful. Have you used this
sensor in any of your projects?
Let me know by leaving a comment below. Share this post
with a friend that also likes electronics.
Thanks for reading,
Rui

6 of 7

8/23/17, 10:29 AM

Guide for Soil Moisture Sensor YL-69 or HL-69 ...

7 of 7

about:reader?url=https://randomnerdtutorials....

8/23/17, 10:29 AM



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 7
Creator                         : cairo 1.9.5 (http://cairographics.org)
Producer                        : cairo 1.9.5 (http://cairographics.org)
EXIF Metadata provided by EXIF.tools

Navigation menu