This project is about the interfacing of YL69 soil hygrometer sensor module with Arduino for measuring humidity of soil. This module can be interfaced with other microcontrollers and processors as well. This sensor module has a wide range of potentiality in the field of Sensor based Smart Agriculture, Vertical farming and Internet of Things (IOT).
Circuit Planning:Arduino UNO R3 YL69 Sensor
Pins--> Vin Vcc
Pins--> GND GND
Pins--> A0 A0
Code:int rainPin = A0;
// you can adjust the threshold value
int thresholdValue = 1000;
void setup(){
pinMode(rainPin, INPUT);
Serial.begin(9600); //Sensor streaming 9600 bits of data per seconds
}
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(rainPin);
Serial.println("Soil-humidity sensor value: ");
Serial.print(sensorValue);
if(sensorValue < thresholdValue){
Serial.println(" - Plant doesn't need watering now...");
}
else {
Serial.println(" - Time to water your plant now...");
}
delay(1500);
}
Results:SerialMonitor:
SerialPlotter:
Comments
Please log in or sign up to comment.