A capacitive moisture [sensor](https://www.ampheo.com/c/sensors) measures how much the material under test (soil, wood, air, etc.) changes an electric field, and from that infers moisture content. ![Soil-Sensor-with-Oscope](https://hackmd.io/_uploads/ByHQrEyxbx.jpg) **Core idea (the physics in one breath)** * The sensor is a small [capacitor](https://www.onzuu.com/category/capacitors): two electrodes separated by a dielectric. * Capacitance 𝐢=πœ€π‘Ÿπœ€0𝐴/𝑑 depends on the relative permittivity πœ€π‘Ÿ of what surrounds/fills the field. * Water has a very high πœ€π‘Ÿ (~80 at room temp) compared to dry soil/wood/air (~2–10). * When moisture increases, the fringing field β€œsees” more water β†’ capacitance rises. You don’t measure water directly; you measure the capacitance change. **Typical sensor structures** * Soil probe (FR4 PCB): interdigitated β€œcomb” electrodes. Most field is fringing into the soil around the board. * Non-contact / through-housing: electrodes on one side of a plastic wall to sense moisture on the other side. * Parallel plate (lab/industrial): sample inserted between plates for a more controlled geometry. **How the electronics read it** **1. RC time / charge–discharge** Drive the sensor through a resistor and measure the time to a logic threshold:π‘‘β‰ˆβˆ’π‘…πΆln⁣(1βˆ’π‘‰π‘‡/𝑉𝐷𝐷). Capacitance ↑ β†’ time ↑. Cheap, easy on [MCUs](https://www.ampheo.com/c/microcontrollers) (timer capture or analog comparator). **2. Relaxation oscillator / frequency shift** Put C in an RC (or LC) [oscillator](https://www.onzuu.com/category/oscillators) and measure frequency π‘“βˆ1/𝑅𝐢. Capacitance ↑ β†’ frequency ↓. **3. Capacitance-to-digital converter (CDC)** Dedicated IC (e.g., FDC/AD series) gives high resolution, built-in excitation, shielding, and drift handling. **4. Bridge / impedance at fixed** 𝑓 AC-excite at e.g. 100 kHz–10 MHz, measure amplitude/phase to separate capacitive component from losses (salinity effects). AC excitation is used (kHz–MHz). Unlike resistive (two-probe) sensors, capacitive types avoid DC electrolysis and last longer in soil. **What the reading really tells you** * The sensor responds to dielectric constant, which correlates with volumetric water content (VWC). * You typically build a calibration curve: measure raw C (or frequency) at several known moistures and fit a line/curve (often quadratic). **Real-world effects you must handle** * Temperature: πœ€π‘Ÿ of water drops with temperature; provide temp compensation or co-locate a sensor. * Salinity / ionic conductivity: raises dielectric loss and can skew low-frequency readings. Using higher excitation frequency reduces resistive artifacts. * Soil type/packing: particle size and porosity shift the baselineβ€”calibrate per soil type. * Parasitics: cable and PCB stray capacitance add offset; keep leads short or use guard/shield driven at sensor potential (guard ring around electrodes). * Drift & fouling: soil adhesion and aging change coupling; periodic re-zero or reference channel helps. **Practical design tips (embedded)** * Geometry: wider/longer interdigitated fingers increase sensitivity; solder mask or conformal coat protects copper without killing sensitivity. * Shielding: add a ground plane behind the electrodes and a driven guard around them to push field outward into the medium. * Excitation: 100 kHz–1 MHz is a good start for soil; too low β†’ conductive losses; too high β†’ cable/EMI issues. * Averaging: filter readings (moving average) and rate-limit updates; moisture changes are slow. * Power: duty-cycle the oscillator to save energy in battery-powered nodes. **Example: simple RC-timing read (Arduino-style)** ``` const int SENSE_PIN = A0; // analog comparator threshold via ARef, or use digital with Schmitt const int DRIVE_PIN = 8; const int R_SER = 10000; // 10 kΞ© in series with the sensor unsigned long measure_us(){ pinMode(DRIVE_PIN, OUTPUT); digitalWrite(DRIVE_PIN, LOW); delayMicroseconds(50); // discharge sensor digitalWrite(DRIVE_PIN, HIGH); // step input unsigned long t0 = micros(); while (analogRead(SENSE_PIN) < 512); // wait until ~VDD/2 (rough) return micros() - t0; } void loop(){ unsigned long t = measure_us(); // proportional to C // Convert t -> moisture via your calibration curve } ``` (For precision: use an analog comparator/timer capture, keep wiring short, and average many samples.) **Calibration sketch** 1. Pack soil samples to consistent density. 2. Measure raw output at oven-dry (0% VWC). 3. Increment moisture by adding a known mass of water to a known soil mass (gravimetric method) to get target VWC values (e.g., 5%, 10%, …). 4. Fit a model (linear or 2nd-order) mapping raw 𝐢 or 𝑑 to VWC. Store coefficients in MCU (EEPROM/flash). **Capacitive vs. resistive soil sensors** * Capacitive: durable, no DC corrosion, less sensitive to soil chemistry for the same frequency band; needs AC readout and calibration. * Resistive: very cheap, but drifts quickly and electrodes corrode; strongly affected by salinity. **TL;DR:** A capacitive moisture [sensor](https://www.ampheoelec.de/c/sensors) is just a capacitor whose electric field fringes into your material; more water β†’ higher permittivity β†’ higher measured capacitance. You excite it with AC and read the capacitance (time/frequency/CDC), then convert via a calibration curve, with care for temperature, salinity, and geometry.