Projects / NFT hydroponics pump and water level guard

NFT hydroponics pump and water level guard

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOLM2596

    Set the buck module

    Adjust the LM2596 output to 5.0 V with a multimeter.

  2. NANOON

    Wire the pump through the relay

    NO terminal to the pump with a flyback diode across it.

  3. NANO

    Fit the float

    Inside the reservoir, so it opens before the pump inlet is exposed.

  4. NANOHelloPCF8574

    Wire the Nano and display

    Float on D2, LCD on A4 and A5.

  5. NANOON

    Test with short times

    Set ON_MS and OFF_MS to 30 seconds and watch the relay cycle.

  6. NANO

    Test the guard

    Lift the float out of the water. The pump stops and the display says LOW WATER.

  7. NANO

    Set the real cycle

    Restore 15 minutes each and plumb it into the channel.

In short

How do you build an NFT hydroponics pump and water level guard?

A timer runs the pump of a nutrient film channel 15 minutes on and 15 off, and stops it if the reservoir runs low. You need Arduino Nano, Relay Module 5V, 12 V DC water pump (diaphragm), Rectifier Diode 1N4007, Float switch (vertical), 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), LM2596 Buck Module and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
9

Parts list

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

Wiring

FromToWhy
12 V adapter +LM2596 IN+ and relay COMSupply
LM2596 OUT+ (set to 5.0 V first)Nano 5V and relay VCC5 V logic
12 V adapter - and LM2596 -Nano GND, relay GND, pump -Common ground
Relay NOPump +Switched 12 V
1N4007 across the pumpCathode on pump +, anode on pump -Flyback diode
Relay INNano D6Pump control
Float switchNano D2 and GNDClosed (LOW) when the reservoir has water
LCD SDA and SCLNano A4 and A5Display

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "LiquidCrystal I2C". Mount the float so it drops when the reservoir is nearly empty, and test the switch with a multimeter. Everything is 12 V DC. Set the LM2596 to exactly 5.0 V on a multimeter before connecting the Nano. The timer restarts from the first phase after a power cut.

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).

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte FLOAT = 2, RELAY = 6;
const unsigned long ON_MS = 15UL * 60UL * 1000UL, OFF_MS = 15UL * 60UL * 1000UL;
bool pumpOn = false;
unsigned long phaseStart = 0;

void setup() {
  pinMode(FLOAT, INPUT_PULLUP);
  pinMode(RELAY, OUTPUT); digitalWrite(RELAY, HIGH);       // off
  pinMode(LED_BUILTIN, OUTPUT);
  lcd.init(); lcd.backlight();
  phaseStart = millis();
}

void loop() {
  bool hasWater = digitalRead(FLOAT) == LOW;
  unsigned long now = millis();
  unsigned long span = pumpOn ? ON_MS : OFF_MS;
  if (now - phaseStart >= span) { pumpOn = !pumpOn; phaseStart = now; }

  bool run = pumpOn && hasWater;                           // never run the pump dry
  digitalWrite(RELAY, run ? LOW : HIGH);
  digitalWrite(LED_BUILTIN, hasWater ? LOW : (now / 300) % 2);   // blink while the reservoir is low

  long left = (span - (now - phaseStart)) / 60000UL;
  lcd.setCursor(0, 0);
  lcd.print(hasWater ? (pumpOn ? "Pump ON         " : "Pump OFF        ") : "LOW WATER!      ");
  lcd.setCursor(0, 1); lcd.print(left); lcd.print(" min left      ");
  delay(500);
}

Test checklist

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

CheckExpected
Pump phasePump runs, display shows minutes left
Off phasePump off
Float loweredPump stops, LED blinks, display warns
Float restoredCycle continues

If it does not work

Pump runs when the reservoir is low

The float logic is the wrong way. Flip it.

Timer shows odd values

Use unsigned long for all times.

No display

Check the LCD address and wiring.

Relay never clicks

Active-low versus active-high mismatch. Swap the HIGH and LOW writes.

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

Ask Lark AI

Common questions

What parts do I need for the NFT hydroponics pump and water level guard?

Arduino Nano, Relay Module 5V, 12 V DC water pump (diaphragm), Rectifier Diode 1N4007, Float switch (vertical), 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), LM2596 Buck Module and Jumper wires male to male (40 pcs, 20 cm).

How long does the NFT hydroponics pump and water level guard take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the NFT hydroponics pump and water level guard works?

Pump phase: Pump runs, display shows minutes left. Off phase: Pump off. Float lowered: Pump stops, LED blinks, display warns.

Pump runs when the reservoir is low: what should I check?

The float logic is the wrong way. Flip it.

Timer shows odd values: what should I check?

Use unsigned long for all times.

No display: what should I check?

Check the LCD address and wiring.

Relay never clicks: what should I check?

Active-low versus active-high mismatch. Swap the HIGH and LOW writes.