Datasheet

Gain and Timing
You can adjust the gain settings and integration time of the sensor to make it more or less
sensitive to light, depending on the environment where the sensor is being used.
The gain can be set to one of the following values (though the last value, MAX, has limited
use in the real world given the extreme amount of gain applied):
TSL2591_GAIN_LOW: Sets the gain to 1x (bright light)
TSL2591_GAIN_MEDIUM: Sets the gain to 25x (general purpose)
TSL2591_GAIN_HIGH: Sets the gain to 428x (low light)
TSL2591_GAIN_MAX: Sets the gain to 9876x (extremely low light)
Gain can be read or set via the following functions:
void setGain(tsl2591Gain_t gain);
tsl2591Gain_t getGain();
The integration time can be set between 100 and 600ms, and the longer the integration
time the more light the sensor is able to integrate, making it more sensitive in low light the
longer the integration time. The following values can be used:
TSL2591_INTEGRATIONTIME_100MS
TSL2591_INTEGRATIONTIME_200MS
TSL2591_INTEGRATIONTIME_300MS
TSL2591_INTEGRATIONTIME_400MS
TSL2591_INTEGRATIONTIME_500MS
TSL2591_INTEGRATIONTIME_600MS
The integration time can be read or set via the following functions:
void setTiming (tsl2591IntegrationTime_t integration);
tsl2591IntegrationTime_t getTiming();
An example showing how these functions are used can be seen in the code below:
/**************************************************************************/
/*
Configures the gain and integration time for the TSL2561
*/
/**************************************************************************/
void configureSensor(void)
{
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
//tsl.setGain(TSL2591_GAIN_LOW); // 1x gain (bright light)
tsl.setGain(TSL2591_GAIN_MED); // 25x gain
//tsl.setGain(TSL2591_GAIN_HIGH); // 428x gain
© Adafruit Industries https://learn.adafruit.com/adafruit-tsl2591 Page 16 of 22