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(";"));
}