Calculating illuminance of different RGB LED colors using TSL 2591

Hello everyone,

I’m working on a reusable material that undergo change with light exposure. I want to investigate the effect of different light colors on the rate of distortion. I would like to identify which color has the slowest distortion rate and recommend using this color of light in the environment where the material is used.

In order to test this, I setup a system consisting of 4 RGB LEDs at a distance of 15 cm to the material and TSL 2591 ambient light sensor alongside the material. I made some measurements by fixing the illumination to 20 lux in a dark room. In my preliminary data, the optimal PWM values ​​required for the three colors are as following (255 PWM is dark, 0 PWM is the brightest light):

Red: 19.92 lux - 230 PWM
Green: 20.08 lux - 224 PWM
Blue: 20.11 lux - 211 PWM

I want to fix the illumination of environments where different colors are used, and just change the colors. The most powerful PWM was required for the blue color. At the end of the 10-minute test, we found that the highest distortion rate was in blue (a rate way beyond the difference of 0.19 lux). However, it was also “blue” that required the most PWM for the same illumination.

As someone who isn’t in the engineering field, is there anything I might be missing? If the sensor is less sensitive to blue light (?), may I have unwittingly used more power for blue to achieve the same lux? Is this situation compatible with real world? For human eye, can the illumination obtained by a blue lamp of the same power be less than the other colors?

I would like to summarize my question, can the TSL 2591 sensor be successful in measuring the full visible spectrum (daylight), but not for measuring a specific color obtained by LED? Can TSL 2591 be a wrong choice of sensor to achieve standardized results when measuring illumination of different colors like Blue, Red and Green from LED light source?

Since the light sources are close to the material, it is also possible that the material is affected by the temperature. I intend to continue this experiment by adding a temperature sensor near ambient light sensor. However, there are question marks in my mind about the working of the TSL 2591. I hope I have expressed myself correctly, thank you very much in advance for your answers!

This is the code I used to find the optimal PWM for the blue, I don’t think it’s necessary but just wanted to share with you =)

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_TSL2591.h"

Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591); 

int r=44;
int g=45;
int b=46;

byte val;

void setup(void) 
{

analogWrite(r,255);
analogWrite(g,255);
analogWrite(b,255);

  Serial.begin(9600);
  
  Serial.println(F("Starting Adafruit TSL2591 Test!"));
  
  if (tsl.begin()) 
  {
    Serial.println(F("Found a TSL2591 sensor"));
  } 
  else 
  {
    Serial.println(F("No sensor found ... check your wiring?"));
    while (1);
  }
  
  tsl.setGain(TSL2591_GAIN_MED);
  tsl.setTiming(TSL2591_INTEGRATIONTIME_500MS);
Serial.println("m;i;f;v;l;v;");
}

void loop(void) 
{ 

  uint32_t lum = tsl.getFullLuminosity();
  uint16_t ir, full;
  ir = lum >> 16;
  full = lum & 0xFFFF;
  
  Serial.print(millis());Serial.print(F(";"));Serial.print(ir); Serial.print(F(";"));Serial.print(full);Serial.print(F(";"));Serial.print(full - ir);Serial.print(F(";"));Serial.print(tsl.calculateLux(full, ir));Serial.print(F(";"));

analogWrite(r,255);
analogWrite(g,255);
analogWrite(b,val);
//Type 'val' next to the color you want to use

while((tsl.calculateLux(full, ir))<19)
{
  if((tsl.calculateLux(full, ir))<10)
  {
    val=val-5;
  }
  else
  {
    val=val-1;
  }
  break;
}

while(19<=(tsl.calculateLux(full, ir))<=21)
{
val=val+0;
  break;
}

while((tsl.calculateLux(full, ir))>21)
{
  if((tsl.calculateLux(full, ir))>30)
  {
   val=val+5;
  }
  else
  {
   val=val+1;  
  }
  break;
}


Serial.print(val);Serial.println(F(";"));
}

As a glance at the TSL2591 data sheet reveals, the sensor is insensitive to blue light, and does not respond to wavelengths much shorter than about 450 nm. See "CH0" curve below. It is most sensitive in the yellow-green (550 nm) to near IR (850 nm) region.

TSL2591.png

In the blue to green region, the sensor response is similar to the human eye, as shown below (dark curve for normal illumination levels).

So, the TSL2591 is useful for judging illumination levels, as perceived by the human eye, but not for measuring absolute light intensity at different wavelengths.

To fully understand your LED lighting, you need to obtain data on the emission spectra.

TSL2591.png

The intensity of the light pulses themselves may also affect the degradation of the material.

Damage done to material may not be linear with the intensity of the light. That's important when you're using PWM. If you set the PWM duty cycle to say 50%, it means 50% of the time you have 100% intensity, and 50% of the time you have darkness. You will have to verify that your materials react the same to that, as to 50% intensity 100% of the time.

The same accounts for the light sensor: they are almost certainly designed to measure constant light sources (such as sunlight), and may react differently to pulsed light.

Thank you for your enlightening answers! =)

From what I understand, it might be good to perform my test in two different conditions.

1- I should find a RGB led with same 'lumen' values (I hope I can find one) for different colors and fix the distance. This way, I can standardize the amount of light exposure and evaluate the difference between colors (relatively objective). Also, calculating the lux near material can give an idea about 'how bright the ambient would be to the human eye' using the same source.

2- I should fix the 'lux' near the material and compare the results (relatively subjective). This way, difference found between various colors can be implemented to the 'real world' situation, where adequate light conditions are provided and light levels are same for the human eye. Lux can be fixed in two ways (?), one with optimizing the PWM, other is optimizing the distance with %100 PWM.

jremington:
As a glance at the TSL2591 data sheet reveals, the sensor is insensitive to blue light, and does not respond to wavelengths much shorter than about 450 nm. See "CH0" curve below. It is most sensitive in the yellow-green (550 nm) to near IR (850 nm) region.

TSL2591.png

In the blue to green region, the sensor response is similar to the human eye, as shown below (dark curve for normal illumination levels).

So, the TSL2591 is useful for judging illumination levels, as perceived by the human eye, but not for measuring absolute light intensity at different wavelengths.

To fully understand your LED lighting, you need to obtain data on the emission spectra.

Previously, when I looked at the datasheet, I thought that I should determine an average wavelength according to the color of the light and establish ratios between lux values. As I understand it now, the lux value is a measurement based on the response of the human eye. If I want to see the pure difference between colors, it may make sense to perform the calibration according to the amount of light, not how the human eye perceives it.

wvmarle:
The intensity of the light pulses themselves may also affect the degradation of the material.

Damage done to material may not be linear with the intensity of the light. That's important when you're using PWM. If you set the PWM duty cycle to say 50%, it means 50% of the time you have 100% intensity, and 50% of the time you have darkness. You will have to verify that your materials react the same to that, as to 50% intensity 100% of the time.

The same accounts for the light sensor: they are almost certainly designed to measure constant light sources (such as sunlight), and may react differently to pulsed light.

I completely forgot how LED brightness changed, thank you very much for reminding me! This explains the rate of degradation of blue, I think different PWM values ​​can be considered as different 'waiting time'. Maybe I should try both, full and partial PWM to see the difference =) Meanwhile, the sensor reacts sensibly to changes in PWM with high precision.

Then AS7265x sensors (as sold by Sparkfun on a convenient breakout) are probably more useful to you. Those ARE meant to give absolute illumination values, and give so for very narrow bandwidths. I have one of these Sparkfun boards - for the price it's not "you need one so you buy 10", using it for PAR spectrum for plant growth. I even added a UV sensor for two more channels :slight_smile: Impressive stuff. Not as cheap as the TSL2591 of course.

Lots of research and experimenting to do for you :slight_smile: Mind that the human eye is also anything but linear in response... to both colour and intensity, the latter as the brain is doing lots of correction there.