The YL-83 Sonda is a soil moisture sensor designed to measure the moisture content in soil, providing valuable data for agricultural applications, gardening, and automated irrigation systems. By detecting the resistance between two probes, the sensor can infer the level of moisture present, which is crucial for maintaining optimal soil conditions for plant growth.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | AOUT | Analog output signal |
4 | DOUT | Digital output signal (threshold set by potentiometer) |
// Define the analog input pin where the sensor is connected
int sensorPin = A0;
void setup() {
// Initialize serial communication at 9600 baud rate
Serial.begin(9600);
}
void loop() {
// Read the value from the soil moisture sensor
int sensorValue = analogRead(sensorPin);
// Convert the analog reading to a more familiar percentage
int moisturePercent = map(sensorValue, 0, 1023, 100, 0);
// Print the moisture level to the Serial Monitor
Serial.print("Soil Moisture Level: ");
Serial.print(moisturePercent);
Serial.println("%");
// Wait for a second before taking another reading
delay(1000);
}
Q: Can the YL-83 Sonda be used with a 3.3V system?
Q: How do I clean the sensor probes?
Q: Is it possible to use the sensor in a permanent installation?