YL-38 Moisture Meter (YL-69 Sensor)

YL-38 Moisture Meter (YL-69 Sensor) © GPL3+

Read the soil moisture level (Dry-Perfect-Wet) and display results on a corresponding LED.

  • 271 views
  • 0 comments
  • 1 respect

Components and supplies

Apps and online services

About this project

This is my first project.

I wanted to be able to sense the moisture in my potting soil and display the results on a corresponding LED and in Serial Monitor. I used the YL-38 (with a YL-69 Moisture sensor).

Dry Soil will light the Yellow LED and display the message "SOIL IS TOO DRY!!!!!"

Perfect Soil will light the Blue LED (or Green) and display the message "SOIL IS PERFECT!!!!!"

Wet Soil will light the Red LED and display the message "SOIL IS TOO WET!!!!!"

The moisture values I used should be changed to fit your build. I tested the device with no water (dry), immersed in water (wet) and by touching my moist fingers to the sensor to get a "perfect" value.

Code

YL-38/69 CodeArduino
void setup() {
  // initialize serial communication at 9600 bits per second:
  
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
  // Set LED colour to their Digital Ouputs.  Read the input on analog pin 0:
  int yellow = 2;
  int blue = 3;
  int red = 4;
  int sensorValue = analogRead(A1);

  // Set the initial state of the LEDs to OFF
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  
  // Logic Loop that sets the required LED to ON
  if (sensorValue >= 1000) (digitalWrite(yellow, HIGH));
  else if ((sensorValue <= 999) && (sensorValue >=901)) (digitalWrite(blue, HIGH));
  else if (sensorValue <= 900) (digitalWrite(red, HIGH));
  else ;

  // Prints the condition of soil.  Dry, Wet or Perfect
  if (sensorValue >= 1000) (Serial.print("SOIL IS TOO DRY!!!!!    "));
  else if ((sensorValue <= 999) && (sensorValue >=901)) (Serial.print("SOIL IS PERFECT!!!!!    "));
  else if (sensorValue <= 900) (Serial.print("SOIL IS TOO WET!!!!!    "));
  else;
  
  // print out the value you read:
  Serial.print("Marijuana Soil Humidity is: ");
  Serial.println(sensorValue);
  delay(500);        // delay in between reads for stability



}

Schematics

YL-38/69 Schematic
yl38_moisture_meter_fnlYuc7TwW.fzz

Comments

Similar projects you might like

DIY Plant Moisture Sensor

Project tutorial by millerman4487

  • 4,541 views
  • 4 comments
  • 28 respects

Sound Sensor Activated LEDs with LCD for Sound Level Data!

Project tutorial by Heathen_Hacks-v2

  • 1,702 views
  • 4 comments
  • 10 respects

Using the YL-39 + YL-69 Soil Humidity Sensor with Arduino

Project tutorial by Sorin Trimbitas

  • 28,113 views
  • 6 comments
  • 17 respects

Soil Moisture Sensor With LCD Display

Project tutorial by Patel Darshil

  • 20,771 views
  • 5 comments
  • 39 respects

The Quantified Cactus: An Easy Plant Soil Moisture Sensor

Project tutorial by Jen Looper

  • 7,172 views
  • 2 comments
  • 26 respects

Arduino DIY Light Meter With BH1750 Sensor

Project tutorial by Nick Koumaris

  • 1,388 views
  • 1 comment
  • 2 respects
Add projectSign up / Login