TINKER PiEDESIGN IN INDIA

Plant watering helperTinkerPieCircuit tutorial 24 of 24 · Intermediate · 20 minutes

Use a soil moisture sensor to tell you when a plant is thirsty.

Open this circuit in TinkerPieCircuit (free, runs in your browser)

What you will learn

Parts

TinkerPie V1 board1 soil moisture sensor1 red LED1 green LED1 resistor, 220 Ω

Steps

  1. Wire the sensor

    VCC → 3V3, GND → GND, AOUT → P11.

  2. Wire the lights

    S1 → red LED, S2 → green LED. Join both LED (−) legs to one 220 Ω resistor, then to GND.

  3. Pick a threshold

    Dry soil gives a high number. If the reading is above 2800, the plant is thirsty.

  4. Test

    Press ▶ Start and drag the sensor slider. Low wetness lights red, high wetness lights green.

The code

function setup() {
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
}

function loop() {
  const reading = analogRead(P11);
  Serial.println("soil reading = " + reading);
  if (reading > 2800) {
    digitalWrite(S1, HIGH);
    digitalWrite(S2, LOW);
  } else {
    digitalWrite(S1, LOW);
    digitalWrite(S2, HIGH);
  }
  delay(200);
}

Copy this into the Code tab. It is Arduino-style JavaScript. The real board uses the same pin names (S1, P10…) in TinkerPie Studio.

How it works

Water between the two probes changes how well the soil conducts, which changes the sensor voltage. Choosing a threshold turns a number into a yes or no decision.

Challenge: Add a buzzer that beeps once when the soil first becomes dry.

← Thermometer and fever light · All 24 circuit tutorials