PyRaspBeta

Soil sensor + ADC board

The soil sensor + ADC board pairs a capacitive soil moisture sensor with an MCP3008 ADC, the probe's analog output on channel 0. It costs $10 and is for plant projects: watering alarms, a pump controller, or logging how fast a pot dries out. Wire the SPI pins plus power and ground, then read channel 0 — the voltage falls as the soil gets wetter.

What's inside

PartQtyPrice each
Soil moisture sensor1$4
MCP3008 ADC (SPI)1$4
Total2$8
  • The soil probe outputs an analog voltage that slides from its dry value (around 2.4–2.8 V) to its wet value (around 1.1–1.4 V).
  • The MCP3008 digitises that voltage to 10 bits over SPI; the Pi has no analog input to read it directly.
Exposed pinInside the kit
vddadc:VDD
gndadc:DGND
clkadc:CLK
doutadc:DOUT
dinadc:DIN
csadc:CS

vdd powers the probe and the ADC and must be 3.3 V so the output stays in the Pi's range; gnd is the shared ground. The kit has no chain ends; the SPI pins are clk, dout, din and cs.

Wiring it in circuit.py

circuit.py
from wiring import *

pi = Pi()
soil = kits.SoilADC()

pi.V3_3 >> soil.vdd
soil.gnd >> pi.GND
pi.SCLK >> soil.clk
pi.MISO >> soil.dout
pi.MOSI >> soil.din
pi.CE0 >> soil.cs

Driving it in main.py

main.py
from gpiozero import MCP3008
from time import sleep

soil = MCP3008(channel=0)

while True:
    print(f"probe {soil.voltage:.2f} V")
    sleep(1)

Calibrate before deciding anything: note soil.voltage in dry air and in a glass of water, then scale between the two. Higher voltage means drier soil.

Why buy the kit

Loose parts cost $4 + $4 = $8.00, against $10 — $2.00 for a short three-wire run and an ADC connection made properly. The probe is the part most likely to be wired to 5 V by mistake; the kit fixes it at 3.3 V, where its output and the Pi are both happy.

Simulator vs real hardware

  • The probe's output follows its zone's soil moisture, moving over a couple of seconds rather than instantly; run the pump in the same zone and the reading responds.
  • Each probe picks its own dry and wet voltages within the datasheet bands, so absolute readings differ between parts — the calibration advice is not just for real hardware.
  • The MCP3008 is simulated at the transaction level with 10-bit quantisation and noise, so gpiozero.MCP3008 works unmodified; keep the probe's electronics out of the water on a bench.

Further reading

  • gpiozero: MCP3008 — channel, value and voltage, and the SPI wiring the board already has.