Projects / Three pot moisture lights

Three pot moisture lights

Three capacitive soil probes show which of three plant pots is dry using a green and red LED for each.

Beginner1.3 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANO

    Wire the probes

    5V, GND and one output each to A0, A1, A2.

  2. NANO14.9 mA

    Wire the LEDs

    Green and red per pot on D2 to D7 through 330 ohm.

  3. NANO

    Upload the sketch

    Three raw numbers print every second.

  4. NANO

    Calibrate dry

    Hold each probe in the air and note the number.

  5. NANO

    Calibrate wet

    Dip each probe to the line in water and note it.

  6. NANO

    Update the sketch

    Put the numbers in DRY and WET.

  7. NANOCAPACITIsoil 49%

    Place the probes

    In the soil up to the line only.

  8. NANO14.9 mA

    Water one pot

    Its LEDs change from red towards green.

In short

How do you build a three pot moisture lights?

Three capacitive soil probes show which of three plant pots is dry using a green and red LED for each. You need Arduino Nano, Capacitive Soil Moisture Module × 3, LED 5 mm red × 3, LED 5 mm green × 3, Resistor 330 Ω × 6 and Breadboard 830 Tie Points. It takes 8 steps and about 75 minutes.

Level
Beginner
Time
About 75 min
Parts
6

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Each probe VCCNano 5VCheck your module accepts 5 V
Each probe GNDNano GNDCommon ground
Probe 1 outputNano A0Pot 1
Probe 2 outputNano A1Pot 2
Probe 3 outputNano A2Pot 3
Pot 1 green LED through 330 ohmNano D2 to GNDMoist enough
Pot 1 red LED through 330 ohmNano D3 to GNDDry
Pot 2 green and red LEDsNano D4 and D5Same, each through 330 ohm
Pot 3 green and red LEDsNano D6 and D7Same, each through 330 ohm

Code

A capacitive soil probe measures the moisture around it by a change in capacitance, so there is no bare metal in the soil to corrode, unlike the cheap resistive type. On most modules the reading goes down as the soil gets wetter. Every probe is a little different, so each needs its own calibration: read the raw number in dry air and in a glass of water, put those values in the sketch and the code turns every reading into a percentage. Each pot has two LEDs. A green LED alone means the soil is moist, both together mean it is getting dry and needs water soon, and a red LED alone means it is dry. The three probes share one sketch and read in turn. Push the probe into the soil only up to the line marked on the board, because the electronics above it are not waterproof. A coat of clear nail varnish on the exposed edge slows the water creeping in. Different plants like different moisture levels, so treat the thresholds as a starting point and adjust them.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

const int PROBE[3] = {A0, A1, A2};
const int GREEN[3] = {2, 4, 6};
const int RED[3]   = {3, 5, 7};

// Raw readings in dry air and in a glass of water, one pair per probe.
// Read them from the serial monitor and replace these numbers.
int DRY[3] = {560, 560, 560};
int WET[3] = {270, 270, 270};

int percent(int i) {
  long sum = 0;
  for (int k = 0; k < 16; k++) { sum += analogRead(PROBE[i]); delay(2); }
  int raw = sum / 16;
  int p = map(raw, DRY[i], WET[i], 0, 100);        // wet gives a lower reading on these modules
  Serial.print(raw); Serial.print(i < 2 ? "," : "\n");
  return constrain(p, 0, 100);
}

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 3; i++) { pinMode(GREEN[i], OUTPUT); pinMode(RED[i], OUTPUT); }
}

void loop() {
  for (int i = 0; i < 3; i++) {
    int p = percent(i);
    // Above 60 percent: green. 30 to 60: both, meaning water soon. Below 30: red.
    digitalWrite(GREEN[i], p >= 30);
    digitalWrite(RED[i], p < 60);
  }
  delay(1000);
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

511,511,512
512,511,511
511,511,512
511,512,512
511,512,511
511,511,512

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Probe in the airRed on
Probe in waterGreen on
Damp soilBoth LEDs on
Water a dry potMoves from red through both to green
Probe unpluggedReads a steady odd value

If it does not work

All the same reading

Check the output wires on A0, A1, A2.

Reading never changes

Check the power and ground wires.

LEDs the wrong way round

Swap DRY and WET or check the module type.

Numbers jump

Keep the wires short and away from the LEDs.

Probe stops working

Water got into the electronics, keep it above the line.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the three pot moisture lights?

Arduino Nano, Capacitive Soil Moisture Module × 3, LED 5 mm red × 3, LED 5 mm green × 3, Resistor 330 Ω × 6 and Breadboard 830 Tie Points.

How long does the three pot moisture lights take to build?

About 75 minutes for a beginner maker, in 8 steps.

How do I know the three pot moisture lights works?

Probe in the air: Red on. Probe in water: Green on. Damp soil: Both LEDs on.

All the same reading: what should I check?

Check the output wires on A0, A1, A2.

Reading never changes: what should I check?

Check the power and ground wires.

LEDs the wrong way round: what should I check?

Swap DRY and WET or check the module type.

Numbers jump: what should I check?

Keep the wires short and away from the LEDs.