Projects / Vertical farm LED light scheduler

Vertical farm LED light scheduler

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO9.2 mA

    Cut the strips

    Cut three pieces of about 0.5 m at the cut marks and fix one to each shelf.

  2. NANOIRLZ44

    Wire the MOSFETs

    One per shelf as in the table, with a 10 kΩ gate pull-down.

  3. NANO

    Wire the clock and display

    On A4 and A5.

  4. NANO12DC9.2 mA

    Power it

    12 V to the strips and the Nano's VIN pin through the screw-terminal adapter.

  5. NANO

    Test the ramp

    Temporarily set a shelf's on time a few minutes ahead and set RAMP_MIN to 1 to watch it fade up.

  6. NANO

    Set the schedule

    Return RAMP_MIN to 20 and set each shelf's hours.

  7. NANOIRLZ449.2 mA

    Check heat

    Feel the MOSFETs and the strips after an hour. They should be barely warm.

In short

How do you build a vertical farm LED light scheduler?

An RTC runs grow LEDs on each shelf of a home vertical farm with sunrise and sunset dimming. You need Arduino Nano, DS3231 RTC module, MOSFET IRLZ44N × 3, Resistor 10 kΩ × 3, 12 V LED strip warm white (5 m, 2835) × 3, 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), DC barrel to screw terminal adapter (female) and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 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 + (through the screw-terminal adapter)All strip + wires and Nano VINSupply (12 V is the Nano's maximum, so keep the wire short)
12 V adapter -Nano GND and all MOSFET sourcesCommon ground
Shelf 1 strip -MOSFET 1 drainLow-side switch
Shelf 2 strip -MOSFET 2 drainLow-side switch
Shelf 3 strip -MOSFET 3 drainLow-side switch
MOSFET gatesNano D9, D10, D11PWM drive
10 kΩ resistorsEach gate to GNDKeep the LEDs off at power up
RTC and LCD SDA, SCLNano A4 and A5Clock and display

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "RTClib" and "LiquidCrystal I2C". Use only about 0.5 m of LED strip on each shelf: a full 5 m roll draws about 5 A, so three half-metre pieces total about 1.2 A, which suits a 2 A adapter. Warm white strips are fine for foliage but are not a true full-spectrum grow light, so check how plants respond.

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 <RTClib.h>
#include <LiquidCrystal_I2C.h>

RTC_DS3231 rtc;
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte GATE[3] = {9, 10, 11};
const int ON_MIN[3]  = {6 * 60, 6 * 60, 7 * 60};         // each shelf's own start, in minutes after midnight
const int OFF_MIN[3] = {22 * 60, 22 * 60, 23 * 60};      // 16 hours of light
const int RAMP_MIN = 20;                                   // ramp length in minutes

byte level(int shelf, int now) {                           // brightness 0 to 255 from the time of day
  int on = ON_MIN[shelf], off = OFF_MIN[shelf];
  if (now < on || now >= off) return 0;
  if (now < on + RAMP_MIN)  return (long)(now - on) * 255 / RAMP_MIN;     // sunrise
  if (now >= off - RAMP_MIN) return (long)(off - now) * 255 / RAMP_MIN;   // sunset
  return 255;
}

void setup() {
  for (byte i = 0; i < 3; i++) pinMode(GATE[i], OUTPUT);
  rtc.begin();
  if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  lcd.init(); lcd.backlight();
}

void loop() {
  DateTime t = rtc.now();
  int now = t.hour() * 60 + t.minute();
  lcd.setCursor(0, 0);
  char buf[17]; snprintf(buf, sizeof(buf), "%02d:%02d  S1 S2 S3  ", t.hour(), t.minute()); lcd.print(buf);
  lcd.setCursor(0, 1);
  for (byte i = 0; i < 3; i++) {
    byte l = level(i, now);
    analogWrite(GATE[i], l);
    snprintf(buf, sizeof(buf), "%3d%% ", l * 100 / 255); lcd.print(buf);
  }
  delay(1000);
}

Test checklist

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

CheckExpected
Before the on timeShelf dark
During the rampSmooth fade up over 20 minutes
MiddayFull brightness at 100 percent
After the off timeDark

If it does not work

LEDs flicker

Wiring is loose or the supply sags. Check connections and use thicker wires.

Shelf always on

A MOSFET is shorted or wired backwards.

Clock wrong after a power cut

The RTC battery is flat.

Nano gets hot

Running from 12 V on VIN is the limit. Use a small buck module to 5 V if it does.

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

Ask Lark AI

Common questions

What parts do I need for the vertical farm LED light scheduler?

Arduino Nano, DS3231 RTC module, MOSFET IRLZ44N × 3, Resistor 10 kΩ × 3, 12 V LED strip warm white (5 m, 2835) × 3, 12 V 2 A DC adapter, 16x2 LCD with I2C backpack (PCF8574), DC barrel to screw terminal adapter (female) and Jumper wires male to male (40 pcs, 20 cm). 12 V LED strip warm white (5 m, 2835) × 3: Cut to about 0.5 m per shelf.

How long does the vertical farm LED light scheduler take to build?

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

How do I know the vertical farm LED light scheduler works?

Before the on time: Shelf dark. During the ramp: Smooth fade up over 20 minutes. Midday: Full brightness at 100 percent.

LEDs flicker: what should I check?

Wiring is loose or the supply sags. Check connections and use thicker wires.

Shelf always on: what should I check?

A MOSFET is shorted or wired backwards.

Clock wrong after a power cut: what should I check?

The RTC battery is flat.

Nano gets hot: what should I check?

Running from 12 V on VIN is the limit. Use a small buck module to 5 V if it does.