The Humidity YL-69 sensor, also known as the Soil Humidity Sensor, is an electronic device designed to measure the relative humidity in soil or similar environments. It is commonly used in gardening projects, irrigation systems, and environmental monitoring to ensure optimal moisture levels for plant growth or to conserve water by automating watering schedules.
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | AOUT | Analog output voltage |
4 | DOUT | Digital output (threshold set by onboard potentiometer) |
// Define the sensor analog pin
const int sensorPin = A0;
void setup() {
// Begin serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Read the value from the sensor
int sensorValue = analogRead(sensorPin);
// Convert the analog reading to a voltage
float voltage = sensorValue * (5.0 / 1023.0);
// Print the voltage to the Serial Monitor
Serial.print("Voltage: ");
Serial.println(voltage);
// Wait for a second before taking another reading
delay(1000);
}
Q: Can the YL-69 sensor be used to measure water content in substances other than soil? A: Yes, but the sensor is calibrated for soil moisture and may require recalibration for other materials.
Q: How do I prevent the sensor from corroding? A: Minimize the time the sensor is powered on, and avoid leaving it in wet soil for extended periods. Clean and dry the sensor after use.
Q: Is it possible to use the sensor with a 3.3V system? A: Yes, the sensor can operate at 3.3V, but the output voltage range will be lower, affecting the sensor's resolution.
Q: How do I interpret the analog voltage reading? A: The voltage reading is proportional to the moisture level. A higher voltage indicates more moisture. Calibration is required to correlate voltage to specific moisture levels.