Zeven Development

Hydroponics Light Monitoring

Build a monitoring system that will measure your Light levels

Plants require light mainly in the red and blue spectrum, but very little in the green. Green light is mainly reflected, and that's why plants look green. As your LED's or bulbs age, they output less light. This monitoring system will help you measure and identify light issues.


Spectrum

TCS34725 RGB Sensor PhotoDiode Spectral Responsivity

Responsivity

Wiring Diagram

Wiring

Hydroponics Light Monitoring Parts


Qty Part Description Cost
1 IO Expander Z-Wire Bundle. $45.00
1 TCS34725 RGB Light Color Sensor. $5.49
1 3/4" x 24" PVC Schedule 40 Pipe. $1.60
2 3/4" Schedule 40 PVC Cap. $0.82

Build your Light Sensor

To build a 1-Wire to I2C enclosure, it has been designed to fit exactly into a 3/4" PVC pipe. Cut a 2" length of 3/4" PVC pipe, and drill a 3/16" hole through the center of the 3/4" end caps. Feed the wires through the holes and assemble the parts as shown.

Enclosure

Now compress all the PVC parts together. This will create what I refer to as a 'pill' enclosure because it looks like a giant pill. It's cheap but effective. If you need to make it waterproof you can use silicon to seal the ends where the wires come out.

Pill

Light Code

The Hydroponics Monitoring System calculates the light color temperature in degrees Kelvin and luminescence level in Lux by using the raw Red, Green, Blue components.


const char ONEWIRE_TO_I2C_LIGHT[] = "i2s58"; // I2C BUS - Light Sensor
const char LIGHT_SENSOR[] =     "st15;sp2";  // TCS34725 RGB Sensor; Turn LED off
 
...
 
  int color_temp, lux;
 
...
 
        // Check for RGB light sensor
        color_temp = -1; lux = -1;
        if (SerialCmdNoError(ONEWIRE_TO_I2C_LIGHT) &&
            SerialCmdDone(LIGHT_SENSOR)) {
          SerialCmd("sr");
          if (SerialReadInt(&r))
          {
            SerialReadInt(&g);
            SerialReadInt(&b);
            SerialReadInt(&c);
            SerialReadInt(&atime);
            SerialReadInt(&gain);
            if (r == 0 && g == 0 && b == 0) {
              color_temp = lux = 0;
            }
            else {
              /* AMS RGB sensors have no IR channel, so the IR content must be */
              /* calculated indirectly. */
              ir = (r g b > c) ? (r g b - c) / 2 : 0;
 
              /* Remove the IR component from the raw RGB values */
              r2 = r - ir;
              g2 = g - ir;
              b2 = b - ir;
 
              /* Calculate the counts per lux (CPL), taking into account the optional
                    arguments for Glass Attenuation (GA) and Device Factor (DF).
 
                    GA = 1/T where T is glass transmissivity, meaning if glass is 50%
                    transmissive, the GA is 2 (1/0.5=2), and if the glass attenuates light
                    95% the GA is 20 (1/0.05). A GA of 1.0 assumes perfect transmission.
 
                    NOTE: It is recommended to have a CPL > 5 to have a lux accuracy
                          < +/- 0.5 lux, where the digitization error can be calculated via:
                          'DER = (+/-2) / CPL'.
              */
              float cpl = (((256 - atime) * 2.4f) * gain) / (1.0f * 310.0f);
 
              /* Determine lux accuracy (+/- lux) */
              float der = 2.0f / cpl;
 
              /* Determine the maximum lux value */
              float max_lux = 65535.0 / (cpl * 3);
 
              /* Lux is a function of the IR-compensated RGB channels and the associated
                 color coefficients, with G having a particularly heavy influence to
                 match the nature of the human eye.
 
                 NOTE: The green value should be > 10 to ensure the accuracy of the lux
                       conversions. If it is below 10, the gain should be increased, but
                       the clear<100 check earlier should cover this edge case.
              */
              gl =  0.136f * (float)r2                   /** Red coefficient. */
                    1.000f * (float)g2                   /** Green coefficient. */
                    -0.444f * (float)b2;                    /** Blue coefficient. */
 
              lux = gl / cpl;
 
              /* A simple method of measuring color temp is to use the ratio of blue */
              /* to red light, taking IR cancellation into account. */
              color_temp = (3810 * (uint32_t)b2) /        /** Color temp coefficient. */
                           (uint32_t)r2 1391;           /** Color temp offset. */
            }
          }
          else {
            // Check for over saturation
            SerialReadUntil(NULL, NULL, 0, '\n');
            SerialReadString(error, sizeof(error));
            SerialDebug.println(error);
            if (!strcmp(error, "E13")) color_temp = ERROR_OVER_SATURATED;
          }
          SerialReadUntilDone();
        }
        else color_temp = ERROR_NO_ROM;
 
...
 
            if (color_temp != ERROR_NO_ROM) {
              if (co2 == ERROR_NO_ROM || clk.tm_min & 1 == 0) {
                Serial.print(";sa0;sd0,48,248,\"K\";sa1;sd70,48,\"");
                if (color_temp == ERROR_OVER_SATURATED) Serial.print("SAT\"");
                else {
                  Serial.print(color_temp);
                  Serial.print("\";sd127,48,\"");
                  Serial.print(lux);
                  Serial.print("\"");
                }
              }
            }
 


OLED Display

When the CO2 sensor is not plugged in, the Hydroponics Control System will detect the light sensor and display the results at the same location.

OLED

Note: If you have the light sensor and the CO2 sensor connected at the same time, they will alternate on the same line every other minute.


DLED8048W Spectrum

Looking at the HPS2000 Spectrometer Test Report for the DLED8048W that is used in the Garage Hydroponics System we see a CCT (Correlated Color Temperature) of 5946K and Flux of 24,030 lumens. Since the TCS34725 RGB light sensor is not considered a high end professional light sensor (A professional light sensor is normally > $1000), it is good enough to be used as a point of reference. Measure your lights when they are new, and monitor the change in light loss over time. The raw readings are accurate enough to roughly verify the lights manufacturers claims.


DLED8048W

Future Development

Using the light sensor and enabling the onboard LED, you can connect it to a leaf and you should be able to measure the color and determine the nutrient deficiency. Every plant will have different results, but your plant is the ultimate sensor of it's health.


For the Complete Garage Hydroponics Solution please see our other projects

Garage Hydroponics
Hydroponics Deep Water Culture Bucket System
Hydroponics Growbed Sensors/Display Module
Hydroponics Chiller
Hydroponics Water/Nutrient Control
Hydroponics Database Management
Hydroponics Germination Control
Hydroponics CO2 Monitoring
Hydroponics Light Monitoring
Hydroponics pH and DO Monitoring



« Previous  Hydroponics CO2 Monitoring
Hydroponics pH and DO Monitoring   Next »