Why moisture sensor get under 25 as a value, while the soil is dry?
This is a very common and frustrating issue for anyone starting with plant monitoring or smart gardening. A moisture sensor reading below 25 when the soil is visibly dry is almost always due to one of three main reasons:
Sensor-Specific Issues (Most Common)
Soil-Specific Issues
Electrical/Code Issues
Here’s a detailed breakdown of each cause and how to fix it.
1. Sensor-Specific Issues (The #1 Culprit)
The most common moisture sensors (like the YL-69 or FC-28) are resistive sensors. This design is the primary source of your problem.
How They Work: They work by passing a small electrical current between the two exposed "prongs" and measuring the electrical resistance of the soil. Water conducts electricity, so:
Wet Soil = Low Resistance = High Reading (e.g., 60-90% on a 10-bit ADC)
Dry Soil = High Resistance = Low Reading (e.g., 10-30% on a 10-bit ADC)
The Fatal Flaw: Electrolysis & Corrosion
Because they run a constant DC current through the probes, they cause electrolysis. This means the metal probes slowly corrode, dissolve, and get coated with oxidation. This coating dramatically changes their conductivity, leading to inaccurate and drifting readings.Why you get a low reading on dry soil: The corrosion creates a non-conductive layer, increasing the resistance even higher than it should be for dry soil. This gives you an artificially low value (like < 25).
Solution:
Don't power them continuously. Only turn them on when you need to take a reading (e.g., power the VCC pin from a digital output pin on your Arduino and set it to
HIGHonly for a second before reading).Consider a different sensor type: For a permanent, reliable solution, upgrade to a capacitive soil moisture sensor.
How they work: They measure the dielectric constant of the soil (how well it holds an electrical charge), which correlates to water content. They do not use exposed metal and are therefore not susceptible to corrosion.
Result: They are far more accurate and stable over time. They are slightly more expensive but worth it.
2. Soil-Specific Issues
Soil isn't uniform. Its electrical properties are affected by more than just water.
Soil Composition: Soil with a high clay content is more conductive than sandy soil, even at the same moisture level, because clay contains more minerals (salts and ions). Your sensor might be calibrated for one type of soil but not another.
Fertilizer and Salts: Fertilizers are essentially salts. Salts dramatically increase the electrical conductivity of soil. A dry, salty soil can sometimes give a deceptively high moisture reading because the salts are conducting current. However, as salts build up and then crust over, they can also interfere with the sensor's electrical contact, potentially causing low readings.
Poor Sensor-Soil Contact: If the soil is very dry and loose (like dry potting mix), it may not be making good physical contact with the sensor probes. Air gaps are great insulators and will cause a very low reading.
Solution:
Calibrate for your specific soil: Don't use generic "dry" and "wet" values you find online.
Take a reading with the sensor in completely dry soil (bake some soil in an oven to be sure).
Take a reading with the sensor in a cup of water (this is your 100% wet value).
Use the
map()function in your code to scale the sensor readings to this range.
Ensure good contact: Pack the soil firmly around the sensor for a consistent reading.
3. Electrical & Code Issues
Analog Reference Voltage: If the voltage powering your microcontroller (e.g., Arduino) is unstable or different from what your code assumes, the analog readings will be wrong. By default, Arduino uses its 5V pin as the reference. If your board is only getting 4.6V from the USB, the readings will be off.
Noise on the Line: Long wires or electrical noise from other equipment can interfere with the analog signal, causing erratic or incorrect values.
Incorrect Code Scaling: You might be misinterpreting the 10-bit analog-to-digital converter (ADC) value (0-1023) and converting it to a percentage incorrectly.
Solution:
Use a stable power supply.
Use the
map()function to scale your sensor values to a more meaningful range based on your calibration (see above).// Example code snippet for mapping a calibrated sensor int sensorValue = analogRead(A0); // Reads a value between 0-1023 int dryValue = 620; // Value read in dry soil int wetValue = 310; // Value read in wet soil (or water) int moisturePercent = map(sensorValue, dryValue, wetValue, 0, 100); // Constrain the value so it doesn't go below 0% or above 100% moisturePercent = constrain(moisturePercent, 0, 100);
Note: Notice that the
dryValueis higher than thewetValuebecause resistance is higher in dry soil. This is normal for resistive sensors.
Summary & Recommended Fixes
| Likely Cause | Why It Happens | How to Fix It |
|---|---|---|
| Sensor Corrosion | DC current on resistive sensors causes electrolysis, coating the probes. | 1. Only power the sensor when reading. 2. Upgrade to a capacitive sensor (highly recommended). |
| Poor Calibration | Using generic "dry/wet" values that don't match your specific soil. | Calibrate the sensor yourself in your own dry soil and a cup of water. Use the map() function. |
| Poor Soil Contact | Loose, dry soil creates air gaps around the probes. | Pack the soil firmly around the sensor to ensure good contact. |
Your immediate next step should be to calibrate your sensor. Take it out of the soil, note the value in a cup of water and in a handful of completely dry soil from the same bag. This will immediately tell you if the sensor is capable of giving a higher reading or if it's permanently damaged by corrosion.
For a long-term project, investing in a capacitive moisture sensor is the best decision you can make.

评论
发表评论