Soil Moisture Sensor

A Soil Moisture Sensor measures the volumetric water content in soil.

Sensors9 blocksMicroPythonC++
Soil Moisture

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the Soil Moisture, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
AOAOAnalog out
DODOSignal out
GNDGNDGround
VCCVCCPower in

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Moisture0 to 100 %50 %
Threshold0 to 100 %50 %

A Soil Moisture Sensor measures the volumetric water content in soil. Common resistive sensors feature two exposed probes that insert into the soil; water content increases the soil's electrical conductivity (lowers resistance). The sensor outputs both a variable analog voltage (AO) and a digital threshold alert (DO).


1. Hardware Specifications & Pinout

  • Operating Voltage: 3.3V to 5.0V.
  • Outputs: Dual output module (Analog + Digital).
  • Pin Configuration:
    • VCC: Power input.
    • GND: Ground.
    • AO (Analog Output): Outputs variable voltage. Note: Higher water content (wet) increases conductivity, resulting in a lower voltage output. Dryer soil gives a higher voltage output.
    • DO (Digital Output): Triggered LOW when moisture rises above the threshold set by the onboard blue potentiometer — modeled in OMS as a real threshold property (Section 3), not just a fixed physical knob.

2. How it Works & Calibration

  • Inverse Relation: Because dry soil has high resistance, the analog output behaves inversely to moisture. Dry soil reads near VCC (e.g. 1023 or 4095), while wet soil reads near GND (e.g. <300).
  • Calibration: You should record the raw values in:
    1. Open air (0% moisture baseline, e.g., 1023).
    2. Submerged in a cup of water (100% moisture baseline, e.g., 200).
    • The OMS Blockly blocks automatically handle this mapping so that the percentage block returns 100% for wet and 0% for dry.

3. Component Properties (Property Inspector)

When you select the Soil Moisture Sensor on the canvas, you can modify the following parameters in the Property Inspector panel:

  • Moisture (moisture): Simulates the moisture percentage of the soil.
    • Default: 50 %
    • Range: 0 % (bone dry) to 100 % (fully saturated)
  • Threshold (threshold): Simulates the onboard comparator trimpot — the DO pin fires once moisture crosses this value.
    • Default: 50 %
    • Range: 0 % to 100 %

There's no separate "VCC Voltage" property — the sensor's actual supply voltage comes from whatever real circuit voltage you wire to its VCC pin, not a configurable prop. Dropping below 3.0V while powered triggers a real LOW VCC fault (see Section 6).


4. Supported Blockly Blocks

Drawing the blocks…

5. Simulator Behavior

  • Moisture & Threshold Adjuster: Drag the Moisture slider in the Property Inspector to watch the analog voltage change and the digital pin flip state once it crosses the Threshold property — both are real, independently adjustable props (Section 3), not just the moisture level alone.
  • Low-Voltage Fault: If the sensor is powered below 3.0V, OMS flags a real fault (LOW VCC label) — modeling the comparator's real minimum operating voltage, calibrated against a real LM393-based soil moisture module's datasheet current draw (~15-35mA).

[!NOTE] Real-world advice, not something OMS simulates: powering resistive soil probes constantly causes real electrochemical corrosion over time (hence using a digital output pin to power the sensor only during readings) — this is genuine hardware best practice, but OMS's simulator does not model probe corrosion/degradation over time; there's no such effect in the component's SPICE model.

Soil Moisture Sensor — OMS Parts