Light control for indoor plants

Posted by

Winter is approaching, so I needed to bring my kitchen herbs collection inside, and I thought some artificial light might help to keep them thriving during the dark part of the year.

RequirementsHardwareCostFirmwareOpenHAB integrationConclusions & Outlook


  1. A not-too-ugly rack to be placed in our dining room
  2. Bright white lights to extend the duration of daylight experienced by the plants to 12h
  3. No need for artificial lights while the “real” daylight is bright enough, so lights are only on from 7am to 1h after sunrise, and from 1h before sunset to 7pm
  4. No visible wiring


  1. a black metal frame rack with glass shelves, from IKEA, the VITTSJÖ model, 175cm tall x 51cm wide and deep, ca. €70
  2. black aluminum profiles angled at 45°, to hold the LED strips in place. These are cut to the same size as the rack, and then just taped to the frame with double sided sticky tape. Looks like they are part of the rack itself! I found those at Amazon at a cost of ~€30 for 6 strips, each 100cm long.
  3. “natural white” COB LED strips, 24V powered, from Aliexpress (5m for ca. €15)
  4. some wiring hidden behind the vertical beams of the rack.
  5. a 12V wall wart power supply (which I had in my parts bin) and an MT3608 step-up DC-DC converter (also from Aliexpress), to convert 12v to 24V
  6. an ESP8266 (an ESP12-F module) on a piece of prototype board, with an IRLU024N N-channel MOSFET, to switch the 24V supply to the LED strips


The total hardware cost was just below €100. Total power consumption for the five ~46cm LED strips is about 16W. So if I run this 2x 2.5h per day, for 4 months a year, then the annual consumption is <10 kWh, or less than €5 per year.

Tasmota Firmware

On the software side, I flashed the ESP8266 with the fabulous Tasmota firmware (version 13.0), which I have used before in other projects. This time, I selected the tasmota-lite flavor, because I don’t need support for any fancy sensors.

In the Tasmota web interface, I configured the unit as a “Generic” type, with PWM channel 1 on GPIO4.

I wanted the light to fade in and out very slowly, for a simulated sunrise, as it where, so I entered Fade 1 and Speed 40 in the console.

On the MQTT configuration screen, I entered the topic name of greenlight, so the unit will publish its status messages to stat/greenlight/POWER , and subscribe to command messages at cmnd/greenlight/* .

OpenHAB integration

This is integrated in my OpenHAB based home automation system (currently using version 3.3). I still prefer the textual configuration files.

The Wifi module communicates via MQTT messages, and I use an external MQTT broker, with an OpenHAB bridge named mqtt:broker:mq.

First, I created a .things file that defines the Tasmota module

Thing mqtt:topic:mq:GreenLight "Green light" (mqtt:broker:mq)
    Type switch : Cmnd [ commandTopic="cmnd/greenlight/power" ]
    Type switch : Stat [ stateTopic="stat/greenlight/POWER" ]
    Type number : RSSI [ stateTopic="tele/greenlight/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI" ]
    Type dimmer : Dim  [ 
			min=0, max=100

Then, there is an .items file with the following definitions. This uses the proxy design pattern described in my previous blog post on openHAB proxy items and groups .

Switch GreenLight_Proxy    "green light"          <light>   (gSwP)
Switch GreenLight_Cmnd                                      (gSwC)
         { channel="mqtt:topic:mq:GreenLight:Cmnd" }
Switch GreenLight_Stat                                      (gSwS)
         { channel="mqtt:topic:mq:GreenLight:Stat" }
Dimmer GreenLight_Dimmer   "green dim [%d]"       <dimmablelight>
         { channel="mqtt:topic:mq:GreenLight:Dim" }                                                                               
Number GreenLight_RSSI     "green light [%d%%]"   <rssi>    (gRSSI)
         { channel="mqtt:topic:mq:GreenLight:RSSI" }

And finally, a .rules file with some rules that determine when to turn the light on or off:

rule "turn on plant light at 7am"
    Time cron "0 0 7 * * ? *"
    if (isDaytimeShort.state==OFF) {

rule "turn OFF plant light at sunrise"
    Item isDaytimeShort changed to ON 

rule "turn OFF plant light at 7pm"
    Time cron "0 0 19 * * ? *"

rule "turn on plant light at sunset"
    Item isDaytimeShort changed to OFF 
    var Number hours = now.getHour()
    if (hours < 19) {

In order to turn the lights on or off around sunrise and sunset, I installed the Astro binding for openHAB, and define events that get triggered 1h after real sunrise, and 1h before real sunset at my location, in a .things file:

astro:sun:shortday  [ geolocation="52.1234,9.1234,55", interval=300 ] {
        Type rangeEvent : rise#event [ offset=60, earliest="07:01" ]
        Type rangeEvent : set#event [ offset=-60, latest="18:59" ]

Conclusions & Outlook

Does it satisfy my requirements stated above? Yes. Could it be further improved? Yes.

  • on a particularly gray day, it might be good to turn on the light strip during daytime as well. The logic for this could look at brightness sensors I have elsewhere in the house, as part of motion detectors (see my blog post on the MyMotionSensor project).
  • do the LED strips I bought have the ideal spectrum for growing plants? I don’t know, they were described as “natural white”, and they look white to my eyes, but they are not special plant growth lights

Leave a Reply