The TSL2591 is a high-performance digital light sensor designed to provide precise and high-resolution light measurements. It features dual-channel sensors (visible and infrared) and can detect a wide range of light levels, from extremely low to very high intensities. This makes it ideal for applications requiring accurate ambient light sensing, such as automatic brightness control in displays, industrial lighting systems, and environmental monitoring.
The TSL2591 is a versatile sensor with the following key technical details:
Parameter | Value |
---|---|
Operating Voltage | 2.7V to 3.6V |
Communication Interface | I²C (up to 400 kHz) |
Spectral Range | 188 nm to 1,000 nm |
Lux Range | 0.0001 lux to 88,000 lux |
Resolution | 16-bit ADC |
Operating Temperature | -30°C to +70°C |
Power Consumption | 0.6 mA (active), 5 µA (standby) |
The TSL2591 is typically available in a 6-pin package. Below is the pinout description:
Pin | Name | Description |
---|---|---|
1 | GND | Ground connection |
2 | VDD | Power supply (2.7V to 3.6V) |
3 | SDA | I²C data line |
4 | SCL | I²C clock line |
5 | INT | Interrupt output (optional, configurable) |
6 | NC | No connection (leave unconnected or grounded) |
0x29
.Below is an example of how to interface the TSL2591 with an Arduino UNO using the Adafruit TSL2591 library:
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2591.h>
// Create an instance of the TSL2591 sensor
Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591);
void configureSensor() {
// Set gain and integration time for the sensor
tsl.setGain(TSL2591_GAIN_MED); // Options: LOW, MED, HIGH, MAX
tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS); // Options: 100MS, 200MS, etc.
// Print configuration details
Serial.println(F("TSL2591 configured with medium gain and 100ms integration time."));
}
void setup() {
Serial.begin(9600);
if (!tsl.begin()) {
Serial.println(F("TSL2591 not found. Check wiring and I²C address."));
while (1); // Halt execution if sensor is not found
}
Serial.println(F("TSL2591 sensor initialized."));
configureSensor();
}
void loop() {
// Get full-spectrum, infrared, and visible light readings
uint16_t fullSpectrum = tsl.getFullLuminosity();
uint16_t infrared = fullSpectrum >> 16;
uint16_t visible = fullSpectrum & 0xFFFF;
// Calculate lux value
float lux = tsl.calculateLux(fullSpectrum & 0xFFFF, fullSpectrum >> 16);
// Print readings to the Serial Monitor
Serial.print(F("Visible Light: "));
Serial.print(visible);
Serial.print(F(" | Infrared: "));
Serial.print(infrared);
Serial.print(F(" | Lux: "));
Serial.println(lux);
delay(1000); // Wait 1 second before the next reading
}
Sensor Not Detected
0x29
.Inaccurate Light Measurements
No Data Output
High Power Consumption
Q: Can the TSL2591 measure UV light?
A: No, the TSL2591 is designed to measure visible and infrared light but does not detect UV light.
Q: What is the maximum I²C clock speed supported?
A: The TSL2591 supports I²C communication at speeds up to 400 kHz.
Q: Can I use the TSL2591 with a 5V microcontroller?
A: Yes, but you must use a level shifter to safely interface the 3.3V sensor with a 5V microcontroller.
Q: How do I calculate lux from raw sensor data?
A: The Adafruit TSL2591 library provides a calculateLux()
function to simplify lux calculation.