TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N − MARCH 2009
22
r
r
Copyright E 2009, TAOS Inc.
The LUMENOLOGY r Company
www.taosinc.com
APPLICATION INFORMATION: SOFTWARE
The following example pseudo code illustrates the configuration of an SMB Alert style interrupt when the light
intensity changes 20% from the current value, and persists for 3 conversion cycles:
// Read current light level
Address = 0x39 //Slave addr also 0x29 or 0x49
Command = 0xAC //Set Command bit and Word bit
ReadWord (Address, Command, DataLow, DataHigh)
Channel0 = (256 * DataHigh) + DataLow
//Calculate upper and lower thresholds
T_Upper = Channel0 + (0.2 * Channel0)
T_Lower = Channel0 – (0.2 * Channel0)
//Write the lower threshold register
Command = 0xA2 //Addr lower threshold reg, set Word Bit
WriteWord (Address, Command, T_Lower.LoByte, T_Lower.HiByte)
//Write the upper threshold register
Command = 0xA4 //Addr upper threshold reg, set Word bit
WriteWord (Address, Command, T_Upper.LoByte, T_Upper.HiByte)
//Enable interrupt
Command = 0x86 //Address interrupt register
Data = 0x23 //SMBAlert style, PERSIST = 3
WriteByte(Address, Command, Data)
In order to generate an interrupt on demand during system test or debug, a test mode (INTR = 11) can be used.
The following example illustrates how to generate an interrupt on demand:
// Generate an interrupt
Address = 0x39 //Slave addr also 0x29 or 0x49
Command = 0x86 //Address Interrupt register
Data = 0x30 //Test interrupt
WriteByte(Address, Command, Data)
//Interrupt line should now be low
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N − MARCH 2009
23
The LUMENOLOGY r Company
r
r
Copyright E 2009, TAOS Inc.
www.taosinc.com
APPLICATION INFORMATION: SOFTWARE
Calculating Lux
The TSL256x is intended for use in ambient light detection applications such as display backlight control, where
adjustments are made to display brightness or contrast based on the brightness of the ambient light, as
perceived by the human eye. Conventional silicon detectors respond strongly to infrared light, which the human
eye does not see. This can lead to significant error when the infrared content of the ambient light is high, such
as with incandescent lighting, due to the difference between the silicon detector response and the brightness
perceived by the human eye.
This problem is overcome in the TSL256x through the use of two photodiodes. One of the photodiodes
(channel 0) is sensitive to both visible and infrared light, while the second photodiode (channel 1) is sensitive
primarily to infrared light. An integrating ADC converts the photodiode currents to digital outputs. Channel 1
digital output is used to compensate for the effect of the infrared component of light on the channel 0 digital
output. The ADC digital outputs from the two channels are used in a formula to obtain a value that approximates
the human eye response in the commonly used Illuminance unit of Lux:
CS Package
For 0 < CH1/CH0 0.52 Lux = 0.0315 CH0 − 0.0593 CH0 ((CH1/CH0)
1.4
)
For 0.52 < CH1/CH0 0.65 Lux = 0.0229 CH0 − 0.0291 CH1
For 0.65 < CH1/CH0 0.80 Lux = 0.0157 CH0 − 0.0180 CH1
For 0.80 < CH1/CH0 1.30 Lux = 0.00338 CH0 − 0.00260 CH1
For CH1/CH0 > 1.30 Lux = 0
T, FN, and CL Package
For 0 < CH1/CH0 0.50 Lux = 0.0304 CH0 − 0.062 CH0 ((CH1/CH0)
1.4
)
For 0.50 < CH1/CH0 0.61 Lux = 0.0224 CH0 − 0.031 CH1
For 0.61 < CH1/CH0 0.80 Lux = 0.0128 CH0 − 0.0153 CH1
For 0.80 < CH1/CH0 1.30 Lux = 0.00146 CH0 − 0.00112 CH1
For CH1/CH0 > 1.30 Lux = 0
The formulas shown above were obtained by optical testing with fluorescent and incandescent light sources,
and apply only to open-air applications. Optical apertures (e.g. light pipes) will affect the incident light on the
device.
Simplified Lux Calculation
Below is the argument and return value including source code (shown on following page) for calculating lux.
The source code is intended for embedded and/or microcontroller applications. Two individual code sets are
provided, one for the T, FN, and CL packages, and one for the CS package. All floating point arithmetic
operations have been eliminated since embedded controllers and microcontrollers generally do not support
these types of operations. Since floating point has been removed, scaling must be performed prior to calculating
illuminance if the integration time is not 402 ms and/or if the gain is not 16 as denoted in the source code on
the following pages. This sequence scales first to mitigate rounding errors induced by decimal math.
extern unsigned int CalculateLux(unsigned int iGain, unsigned int tInt, unsigned int
ch0, unsigned int ch1, int iType)
TSL2560, TSL2561
LIGHT-TO-DIGITAL CONVERTER
TAOS059N − MARCH 2009
24
r
r
Copyright E 2009, TAOS Inc.
The LUMENOLOGY r Company
www.taosinc.com
//****************************************************************************
//
// Copyright E 2004−2005 TAOS, Inc.
//
// THIS CODE AND INFORMATION IS PROVIDED ”AS IS” WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Module Name:
// lux.cpp
//
//****************************************************************************
#define LUX_SCALE 14 // scale by 2^14
#define RATIO_SCALE 9 // scale ratio by 2^9
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
// Integration time scaling factors
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
#define CH_SCALE 10 // scale channel values by 2^10
#define CHSCALE_TINT0 0x7517 // 322/11 * 2^CH_SCALE
#define CHSCALE_TINT1 0x0fe7 // 322/81 * 2^CH_SCALE
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
// T, FN, and CL Package coefficients
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
// For Ch1/Ch0=0.00 to 0.50
// Lux/Ch0=0.0304−0.062*((Ch1/Ch0)^1.4)
// piecewise approximation
// For Ch1/Ch0=0.00 to 0.125:
// Lux/Ch0=0.0304−0.0272*(Ch1/Ch0)
//
// For Ch1/Ch0=0.125 to 0.250:
// Lux/Ch0=0.0325−0.0440*(Ch1/Ch0)
//
// For Ch1/Ch0=0.250 to 0.375:
// Lux/Ch0=0.0351−0.0544*(Ch1/Ch0)
//
// For Ch1/Ch0=0.375 to 0.50:
// Lux/Ch0=0.0381−0.0624*(Ch1/Ch0)
//
// For Ch1/Ch0=0.50 to 0.61:
// Lux/Ch0=0.0224−0.031*(Ch1/Ch0)
//
// For Ch1/Ch0=0.61 to 0.80:
// Lux/Ch0=0.0128−0.0153*(Ch1/Ch0)
//
// For Ch1/Ch0=0.80 to 1.30:
// Lux/Ch0=0.00146−0.00112*(Ch1/Ch0)
//
// For Ch1/Ch0>1.3:
// Lux/Ch0=0
//−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
#define K1T 0x0040 // 0.125 * 2^RATIO_SCALE
#define B1T 0x01f2 // 0.0304 * 2^LUX_SCALE
#define M1T 0x01be // 0.0272 * 2^LUX_SCALE
#define K2T 0x0080 // 0.250 * 2^RATIO_SCALE

TSL2561T

Mfr. #:
Manufacturer:
ams
Description:
Light to Digital Converters Light to Digital with I2C
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union