We know that full sun plants need 6+ hours of direct sunlight per day. We also know that direct sunlight is about 30,000 to 100,000 lux. We should be able to say that full sun plants need at least 30k * 6 lux/hrs (180 kilo-lux/hrs) of light energy per day.
I spent the last week automating the redhouse (the geothermal smart greenhouse). Part of the automation includes giving the grow lights some smarts. As pointed out in my last post, the grow light controller has a visible light sensor. At the moment however, it seems my readings are inaccurate. Full daylight on the sensor reads 1400 while it reads 919 during the night. This is not ideal, but we can add some crude corrections to see if we are meeting the energy requirements that our plants need.
What we want to do is to make sure that our plants reach the 180klux/hrs (a total of 108megalux) per day using natural light if possible, but using the artificial grow lights if not. Since we can control the brightness of our grow lights, we can tune the brightness to compensate for any lack of natural light. If a cloud rolls over, we’ll ramp up our grow lights until we are producing the 30,000lux that we need.
I measured the output of the grow lights using my smart phone’s light sensor. I don’t know how accurate it is, but at about 12″ away from the lights, it reads about 30,000lux at full brightness. That’s perfect.
Doing a little math, we can now figure out the difference in natural light to the light we are seeing on the sensor. We know darkness on the sensor is 919 and full sun is 1400, so we’ll compensate. All code from this point all will be python, but should be easy enough to convert to any language you want:
directSunlight = 1400 – 919 = 481
growLightMax = 481
correctedCurrentSensorReading = currentSensorReading – 919
energyDelta = directSunlight – correctedCurrentSensorReading
growLightRate = (energyDelta / growLightMax)
growLightRate will give us the percentage of brightness we need to achieve “full sun”.
Another thing we want to do is to not use the artificial light once we reach 100% of our daily needs. We will save energy (and cost) by turning off the light when we don’t need it. Here’s how I did it:
totalEnergyNeeds = directSunlight * 3600 * 6
Lux is measured per second, so we will need the equivalent of 108mega-lux per day of energy. The 3600 * 6 converts 6 hours (full day minimum requirement) to seconds. We can adjust the number of hours according to the needs of our plants. We can move it up to 8 for plants that need more light, or down to 4 for part-day plants.
Now that we have computed our daily needs, we need to keep a running total of how much we’ve produced:
totalEnergyProduced = correctedCurrentSensorReading + (growLightMax * growLightRate)
if totalEnergyProduced > totalEnergyNeeds:
growLightRate = 0 #turn off the lights
We should run this code every 1 second.
Using the grow light as a heat source
We will also want to turn off the lights at night time, unless we are below our total energy needs. But there are reasons to keep the light on at night.
Certain plants not only have different light needs, but also have darkness needs. This requirement is called “photoperodism“. Some plants need periods of darkness to “sleep”. During “sleep”, these plants may initiate flowering among other things. Tomatoes, cucumbers, roses and melons do not have any darkness requirements. We could in theory provide light to these plants 24/7 which may help them to grow faster.
I don’t need the plants to grow faster, but the LEDs from the grow light do generate some heat. This additional heat will help regulate the temperature at night and keep the air temperature warmer than it otherwise might be. Because these lights are over our tomatoes, we don’t need to worry about causing harm. I don’t recommend this for plants that require periods of darkness (short-day and long-day plants). In my greenhouse I know the soil as well as the ambient air temperature. I’ll use the temperature to determine if it’s cool enough that we will need the extra heat from the lights. Using a library called “astral” we can also determine if it is night time or not. Astral doesn’t tell us if it’s night, but it does tell us when solar sunset and sunrise are.
from datetime import datetime
from astral import Location
location = Location()
location.latitude = 45.34342
location.longitude = -122.343426
location.timezone = “US/Pacific”
t = datetime.now().time()
isNightTime = (t > location.sunset().time() and t < time(23)) or (t > time(0) and t < location.sunrise().time())
if (isNightTime and totalEnergyProduced < totalEnergyNeeds) or airTemp < airSetpoint or soilTemp < soilSetpoint:
growLightRate = 1.0 #full brightness
elif totalEnergyProduced >=totalEnergyNeeds:
growLightRate = 0.0 #completely off
I’ve been fine tuning this logic for about a week. Everything seems to be working. I’ve only got one light at the moment over 3 of 9 tomato plants. The plants under the light have much more growth than plants of a similar age and look healthier. I’ve also added some variables to track how much natural vs artificial light I’m using and how close I am to my plant’s requirements. This is my light production for today (from about 10:30am to 7:44pm)
Today has been overcast for most of the day. Because of the clouds, 58% of my light has come from the grow lights. Additionally, I’m 148% of my daily total right now. My numbers reset at sunrise and the lights will be at 100% brightness for most of the night (it’s already cold enough to have the lights on). Right before sunrise, I wouldn’t be surprised if I was over 200%.