Skip to content
BeginnerUnoarduino-unosoil-moisturerelay

Automatic Plant Watering System with Arduino & Soil Sensor

Build a self-watering plant system using Arduino Uno, a capacitive soil moisture sensor, a 5V relay, and a mini submersible pump. Includes calibration routine and a moisture-level OLED display.

SolderHub10/17/2026 20 min read 3 views

Why Capacitive Over Resistive?

Older resistive soil sensors corrode within weeks because they pass current through the soil. Capacitive sensors measure the dielectric constant of the soil instead — no exposed metal contacts in the soil, so they last years. The module outputs an analog voltage between 0 V (submerged) and ~3 V (bone dry) which maps neatly to Arduino's 10-bit ADC.

The relay acts as a high-current switch to run the 5V pump from a separate power rail, so the Arduino never sources pump current directly.

⚠️ Warning

Power the submersible pump from a dedicated 5V 1A power supply — NOT from the Arduino's 5V pin, which is limited to 500 mA from USB. Sharing power rails will brown-out the board and cause erratic ADC readings.

Components

8 items
NameQtyLink
Arduino Uno R3×1Buy ↗
Capacitive Soil Moisture Sensor v1.2×1Buy ↗
5V Single-Channel Relay Module×1Buy ↗
Mini Submersible Water Pump (3–6V)×1Buy ↗
Silicone Tube (4 mm ID, 30 cm)×1—
0.96" I2C OLED Display (SSD1306)×1Buy ↗
5V 1A USB Power Supply (for pump)×1—
Breadboard + Jumper Wires×1—

Need these parts? Get this build sheet by email

Parts list with buy links, plus new builds as they're published. By subscribing you agree to our Privacy Policy. Unsubscribe anytime.

Wiring

Soil sensor: VCC → 3.3V, GND → GND, AOUT → A0.
(Using 3.3V prevents the ADC from saturating near 0 when submerged)

Relay module: VCC → 5V (Arduino), GND → GND, IN → D7.
NO terminal of relay → pump positive; COM terminal → external 5V supply positive.
Pump negative → external 5V GND (share GND with Arduino).

OLED (I2C): VCC → 3.3V, GND → GND, SDA → A4, SCL → A5.

C++

Live simulation

Steps

  1. 1Install libraries: Adafruit GFX and Adafruit SSD1306 via Library Manager
  2. 2Wire the sensor to 3.3V (not 5V) to prevent ADC saturation
  3. 3Power the pump from a separate 5V 1A supply through the relay
  4. 4Run the sketch and open Serial Monitor — note the raw ADC value in open air (AIR_VALUE) and when submerged (WATER_VALUE)
  5. 5Update both calibration constants in the sketch and re-upload
  6. 6Insert sensor into dry soil — pump should trigger below 40% moisture and stop at 70%
  7. 7Adjust DRY_THRESHOLD and WET_THRESHOLD to suit your plant species

Q&A is currently disabled site-wide.

Related projects