The DFRobot Capacitive Soil Moisture Sensor (V1.0) is an electronic device that measures the moisture content in soil. Unlike resistive soil moisture sensors, which determine moisture by passing current through the soil, the capacitive sensor measures the changes in capacitance caused by the dielectric constant of the soil, which changes with moisture content. This method offers the advantage of not corroding over time, as there is no direct electrical contact with the soil.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3 - 5.5 VDC) |
2 | GND | Ground connection |
3 | AOUT | Analog output signal |
// Define the sensor pin
const int sensorPin = A0;
void setup() {
// Initialize 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 value
float voltage = sensorValue * (5.0 / 1023.0);
// Print the voltage
Serial.print("Voltage: ");
Serial.println(voltage);
// Wait for a second before reading again
delay(1000);
}
Q: Can the sensor be used with a 5V microcontroller like the Arduino UNO? A: Yes, the sensor can operate on 3.3V to 5.5V, making it compatible with both 3.3V and 5V microcontrollers.
Q: How do I calibrate the sensor for accurate moisture readings? A: Take readings in known conditions (completely dry and fully wet soil) and map these to the sensor's output range to create a calibration curve.
Q: Is the sensor waterproof? A: The sensor probe is water-resistant, but the onboard circuitry is not waterproof. Avoid getting the electronic components wet.
Q: How long can I leave the sensor in the soil? A: While the capacitive design reduces corrosion risk, it is still recommended to remove the sensor from the soil when not actively taking measurements to extend its lifespan.