Professional Documents
Culture Documents
TSL230EVM
Users Guide
An Evaluation System Interfacing the TSL230/TSL235/TSL245 Light-to-
Frequency Converters to a Microcontroller
DESCRIPTION
INTRODUCTION
The hardware portion of the TSL230
The TSL230/235/245 family of Light-to- evaluation module consists of a TSL230,
Frequency Converters has greatly simplified the TSL235, TSL245, a microcontroller (MCU) , an
problem of getting light intensity information into LCD module, RS-232 interface, power supply
a digital system. This evaluation module and support components mounted on a printed
illustrates simple hardware and software circuit board. The system is self-contained with
techniques for interfacing the light-to-frequency two on-board N-cell batteries, or it may be
converters to a microcontroller and processing the powered from an external 3V supply (with on-
information. With the built-in serial PC interface board batteries removed). The module has several
the TSL230EVM provides a hardware and operating modes which are controlled by five
software platform for evaluation of the devices in push-button switches. Software in the MCU
several light measurement applications. performs period, frequency and ratiometric
measurements on the output from the three on-
PURPOSE board sensors. Output is displayed on the LCD
and can be transmitted to a PC via an RS-232
The evaluation module shown in Figure 1 connection provided by an RJ11 modular jack.
illustrates the use of the TSL230, TSL235, and
TSL245 devices in ambient, transmissive, and The TSL230 programming pins (S0, S1, S2
reflective light measurement applications, and S3) are controlled by the microcontroller
respectively. The output of the sensors can be parallel port pins PA0 - PA3 (refer to schematic
monitored on the LCD display, or interfaced to a in Appendix). The logic state of PA2 and PA3
personal computer via the serial port. Windows determine the input sensitivity and the logic state
software is provided for demonstration of several of PA0 and PA1 control the output scaling. The
light sensing applications. This platform provides output of the TSL230 is connected directly to the
the hardware and software necessary to evaluate timer capture (TCAP) pin of the MCU. The
the light-to-frequency converters in a variety of TSL235 and TSL245 outputs are multiplexed
applications and configurations. through the 74HC126 (quad bus buffer) to the
TCAP pin. The MCU parallel port pins PA6 and
PA7 are used to select either the TSL235 or the
TSL245 outputs. A logic high on PA6 selects the
TSL235 output; taking PA7 high selects the
TSL245 output.
LIGHT-TO-FREQUENCY CONVERTER EVM
3V POWER SUPPLY
Tx / Rx
ON
MPU
1 2 3 4 5
OFF
S0 S1 S2 S3 MODE
Figure 1. TSL230EVM
The LCD (DMC16117) is interfaced to the TSL245 reflective configuration. The current
MCU via 8 data lines connected to ports PC0- through each LED, and thus the amount of light
PC7, and three control lines connected to ports emitted by each LED, is controlled via a simple
PB5-PB7. Port PB7 provides the read/write digital-to-analog converter comprised of resistors
signal (R/W) to the display. PB6 provides the and MCU-controlled digital outputs. Resistors
register select signal (RS), and PB5 provides the R2, R9 and R10 along with ports PB0, PB1, and
enable signal (E). output 3 of the HC126 control the current
through D3. Resistors R11 and R6 along with
There are two light sources on the EVM. D3, port PB3 and output 4 of the HC126 control the
a red LED operating at a wavelength of 660nm, is current through D4. MCU ports PB2 and PB4
the source for the TSL235 transmissive enable outputs 3 and 4 of the 126,
configuration. D4, an infrared (IR) LED
operating at 880nm, provides the IR light for the
2
Rev B
OPERATION
Table 1b. TSL230 Output Scaling Options The TSL230 EVM may be powered either by
S3 S2 OUTPUT SCALING two N-cell alkaline batteries on the board, or by
L L 1 an external 3VDC power supply (with the
L H 2 batteries removed from the EVM). Turn on the
H L 10 EVM by moving the slide switch to the up
H H 100 position. The display will read TSL230EVM
Ver1.0. The TSL230EVM may be operated
Table 1a. TSL230 Sensitivity Options stand-alone or in a slave configuration under
S1 S0 SENSITIVITY control of a PC running the TSL230EVM
L L Power Down software. Both types of operation are described.
L H 1x
H L 10x
H H 100x
Stand-alone Operation
The TSL230EVM has three modes of stand-
alone operation. Each mode is associated with
respectively . The quad bus buffer is used in one of the three on-board sensors. Mode 1 utilizes
conjunction with the lower-valued resistors the TSL230, Mode 2 utilizes the TSL235, and
because of its higher current sinking capability. Mode 3 utilizes the TSL245. The three modes are
accessed by pressing the MODE button. When
The MAX218 (dual RS-232 transceiver) the EVM is first turned on, it is in an idle state; no
provides the RS-232 interface to a PC via the mode is selected. Pressing the MODE button
RJ11 jack (JP1). In addition to generating the once puts the EVM in Mode 1 (TSL230).
nominal 6V for the RS-232 lines, the MAX218 Pressing the MODE button again puts the EVM
is used to power the LCD module, which requires in Mode 2 (TSL235), and pressing it a third time
a 5V supply. The MCUs on-board serial puts the EVM in Mode 3 (TSL245). Pressing the
communications interface (SCI) provides the MODE button from Mode 3 puts the EVM back
serial communication function via receive input in Mode 1. Buttons 1 through 4, also labeled S0,
PD0 and transmit output PD1. Port PA4 is used S1, S2, and S3, perform different functions
to shut down the MAX218s switch-mode power depending on the current mode (see Table 2).
supply (disabling the transmitter and the LCD
module) to save power when the EVM is idle. Fluorescent Lights
Fluorescent lights are the most common source of
The TPS7248 is a low-dropout regulator AC light noise (flicker) in transmissive (Mode 2)
used to regulate the nominal 6V provided by the and reflective (Mode 3) measurements, and can
MAX218 down to 4.8 volts for the LCD module. cause erratic readings when making ambient light
measurements in Mode 1. Since this type of
lighting is common in office and lab
environments, it is difficult to avoid these
problems when using the TSL230EVM. A
common technique to minimize these effects is to
sample the sensor at an interval which is an exact
multiple of the period of the fluorescent light
flicker (120Hz or 8.33ms), so that the readings
are taken at the same point of the AC waveform
each time. This reduces the problem to that of a
DC offset. The problem is that even a small
deviation in this sampling interval results in a
beating effect with the flicker, showing up as a
Table 2. TSL230EVM Push-button functions
Mode 1 Mode 2 Mode 3
Button 1 Toggle S0 Ambient reject Ambient reject
Button 2 Toggle S1 Set reference Set reference
Button 3 Toggle S2 - -
Button 4 Toggle S3 LED boost (1-7) LED boost (on/off)
Button 5 Next mode Next mode Next mode
slowly changing ambient light reading. The first TSL230 Filter Cap
precaution is to shield any transmissive or The TSL230EVM is shipped with a filter
reflective experiments from ambient light as much cap fitted over the top of the TSL230. The filter
as possible. The alternative is to synchronize the is Hoya CM500 infrared-blocking glass used to
sampling interval with flicker frequency. This approximate the photopic human eye response.
technique is incorporated into the PC software This filter is used in conjunction with the
(see Ambient Light Synchronize in the Software Photometer demonstration in the included PC
section for more information). software package. It can be removed or replaced
as desired for TSL230 evaluation.
Sleep Mode
The TSL230EVM will automatically enter Mode 2 - TSL235 Evaluation
power-saving sleep mode if the buttons are not Mode 2 allows evaluation of the TSL235 in a
pressed for 3 minutes. Press any button to wake transmissive light measurement mode. The
up the EVM. Note that although power TSL235 is mounted directly across from a 660
consumption is lower in sleep mode, the power nm red LED. The TSL235 senses the amount of
switch should be turned off to conserve batteries light directly emitted by the LED, or passed
when the EVM not being used. through some transparent or translucent medium.
In application, the TSL235 measures the
Mode 1 - TSL230 Evaluation transmittance of a translucent medium by
Mode 1 allows evaluation of the on-board measuring the amount of light that passed through
TSL230 device in general light measurement the medium.
situations. Buttons 1 through 4 toggle the state of From Mode 1, press the MODE button to
the programming lines S0 through S3 put the EVM in Mode 2. The display will read
respectively. The display indicates the current TSL235 nnnnn b, where nnnnn is the period
programmed state of the TSL230. On power-up, measurement of the output of the TSL235 in
the EVM defaults to 1x sensitivity and divide-by- counts (each count equals 4us), and b is the
100 output scaling. This corresponds to the states current LED boost setting (1-7). The count
H, L, H, and H for pins S0, S1, S2, and S3, ranges from about 8-10 counts to over 65000.
where H represents a logic high and L
represents a logic low. Refer to Table 1 for
information on the TSL230 programming options. Ambient Light Rejection
Pressing each of the buttons 1 through 4 (S0 - S3) Since the TSL235 is not optically shielded,
will toggle the state of the associated line. The the output signal represents a combination of
resulting change in the TSL230 configuration is direct light from the LED and interference from
displayed using the leftmost nine characters of the ambient light. The TSL230EVM can eliminate or
display. The rightmost five digits indicate the at least reduce this effect using ambient light
TSL230 output frequency in hertz. subtraction. This is accomplished by first
sampling the sensor with the LED off. This gives
a reading of the ambient light level. Then the
4
Rev B
LED is turned on and the sensor output is emission from the LED is shielded by a black
sampled again. The reading taken with the LED plastic sleeve over the LED, so during operation
off is subtracted, leaving just the component of the bulk of the signal would come from light
light from the LED. Note that if the ambient light reflected off of a surface in front of the sensor and
is brighter than the light from the LED, then the emitter. This configuration would be used for
reading will be erratic or zero. measuring the reflectance of a surface, or to
Pressing button 1 toggles the ambient light measure proximity of an object.
subtraction function on and off. An A appears
in the next-to-right-most position on the display Ambient Light Rejection
when the EVM is in ambient subtract mode. As in the transmissive configuration, ambient
light can have a significant effect on the sensor
output signal. Note that if the ambient light is
LED Boost brighter than the light from the LED, then the
Button 4 sets the LED boost level, or LED reading will be erratic or zero.
intensity. Pressing button 4 increases the LED To automatically subtract background light
intensity by one level. The highest boost level is from the reading, press button 1. Press button 1
7. The boost level setting is denoted by the again to disable the ambient light subtraction. An
number in the far right of the display. The boost A appears in the next-to-right-most position on
function is accomplished by using the boost level the display when the EVM is in ambient subtract
value to drive a simple DAC which controls the mode
LED current.
LED Boost
Transmittance Measurement Pressing button 4 turns the infrared LED
To measure transmittance of a medium, the boost on and off. When boost is turned on the
measurement system must first be referenced to a EVM puts more current through the LED by
standard for comparison. Reference calibration is placing a smaller value resistor in parallel with the
accomplished by measuring the light directly from existing one. The boost level setting is denoted by
the LED either with no media present, or with a the B in the far right of the display.
transparent or translucent reference medium in
place between the sensor and LED. To calibrate Reflectance Measurement
the EVM to a reference, first set up the reference As in transmittance measurements, reference
condition by placing the reference medium calibration must first be performed before a
between the TSL235 and the LED, as close to the reflectance measurement can be made. To
TSL235 as possible. If the period reading is high calibrate the EVM in Mode 3, first position the
(more than a few thousand counts) press button 4 EVM and reflectance standard as shown in Figure
to increase the boost setting until a lower reading 2 below. Press button 2 to calibrate to the
is obtained. Press button 2 to calibrate to the reference standard. After calibration the display
reference. After calibration the display will read will read REFLECT. nnn % where nnn is a
TRANSMIT. nnn% where nnn is a percent percent value between 0 and 100 representing the
value between 0 and 100 representing the ratio of ratio of the latest reading divided by the
latest reading divided by the reference reading. calibration reading.
6
Rev B
Table 3. TSL230EVM Commands The number of data points transmitted and the
sample period of the data can be set only through
COMMAND DESCRIPTION commands (A - G, see Table 3) transmitted to
0 Toggle S0 state in Mode 1
1 Toggle S1 state in Mode 1 the EVM via the serial port, and are not
2 Toggle S2 state in Mode 1 adjustable directly on the EVM. Commands E,
3 Toggle S3 state in Mode 1 F, G, and I set the time between data
4 Set EVM to Mode 1, TSL230
5 Set EVM to Mode 2, TSL235
points, or sample interval, to 0.015, 0.03, 0.06, or
6 Set EVM to Mode 3, TSL245 0.1s, respectively. Commands A - D set the
7 Set EVM to Mode 4, TSL230 Data dump number of datapoints sent before pausing to 128,
8 Set EVM to Mode 5, TSL235 Data dump
9 Set EVM to Mode 6, TSL245 Data dump
256, 512, or 1024. Note that the number of
A Data dump samples = 128 datapoints is always a multiple of two to simplify
B Data dump samples = 256 processing with algorithyms such as the FFT.
C Data dump samples = 512
D Data dump samples = 1024
There are data dump modes for each of the
E Dump sample interval = 0.015s three sensors: Mode 4 for the TSL230, Mode 5
F Dump sample interval = 0.03s for the TSL235, and Mode 6 for the TSL245. A
G Dump sample interval = 0.06s data dump can be started from the EVM by
H Starts and stops data dump
I Dump sample interval = 0.1s pushing button 1, or by sending an H command
J Update interval = 0.1s (Modes 1 -3 ) to the EVM. Once the predetermined number of
K Update interval = 0.5s (Modes 1 -3 ) data points is transmitted, the data dump is
L Update interval = 1s (Modes 1 -3 )
M Update interval = 10s (Modes 1 -3 ) automatically repeated after a short delay.
O Enable LED Boost Bit 0 Pressing button 1 again (or sending the EVM an
P Check EVM (Returns verxx; xx = revision ), H) will halt the transmission of data after the
NR
Q Mode inquiry (Returns a - g for Modes 0 - 6)*, currently active dump is complete. The data
NR dump can be stopped (interrupted) by sending the
R Set Mode 1 state to 1x, Divide-by-100 EVM the ! command. Note that Modes 4-6 are
S Enable LED Boost Bit 1
T Enable LED Boost Bit 2 not available when operating standalone.
U Enable IRED Boost
V Enable ambient subtract EVM Responses
W Disable ambient subtract
X Disable LED Boost1 and 2 In addition to sending data, the EVM sends
Y Disable IRED Boost certain characters to the host PC in response to
Z Shutdown EVM (sleep mode), NR events occuring on the EVM. The responses are
+ Increase update interval by approx. 4s
- Decrease update interval by approx. 4s preceded by an asterisk, *, to distinguish them
[ Decrease update interval by approx. 40s from data. The EVM acknowledges receipt of
] Increase update interval by approx. 40s most commands (see Table 3) by sending the
_ Reset update interval to default value
! Abort data dump (interrupts current dump),
ampersand @. The EVM sends a z just
NR before it powers down after about 3 minutes of
| (Pipe character) Pod reset to power-up state inactivity. A p is sent at approximate 5 second
(Mode 0), NR
* Mode 0 is the mode the EVM enters on power-up.
intervals as a handshaking signal to let the PC
NR - EVM does not acknowledge these commands with @ know that the EVM is connected. Responses are
also sent as a result of pushing the buttons on the
EVM so that the PC is aware of changes in the
when the PC responds to the handshake request,
settings made by the user (see Table 4).
*p, by sending a P or any other command.
DESIGN CONSIDERATIONS Table 4. TSL230EVM Responses
Description Format
Data Acquisition with the TSL230EVM Command acknowledge @
Primary considerations of a digital data Start of data dump #
End of data dump $
acquisition system, of which the main component Precedes EVM response *
is typically an A/D converter, include sampling EVM checking for PC *p
rate, sample resolution, and dynamic range Switch S0 pressed *0
Switch S1 pressed *1
(usually defined by the available resolution). In
Switch S2 pressed *2
the specific case of a system using the TSL-series Switch S3 pressed *3
light-to-frequency converters, the analog-to-digital EVM in Mode 0 *a
conversion function is performed by a current-to- EVM in Mode 1 *b
EVM in Mode 2 *c
frequency converter (on the chip) and the EVM in Mode 3 *d
conversion to digital data is completed by a EVM in Mode 4 *e
counter (usually on-board the microcontroller). In EVM in Mode 5 *f
EVM in Mode 6 *g
this situation the sampling rate depends on two LED Boost level 1 *q
things: the counting method and the signal LED Boost level 2 *r
amplitude (light intensity). Faster sampling rates LED Boost level 3 *s
LED Boost level 4 *t
are achieved by using period measurement LED Boost level 5 *u
techniques (measuring time between pulses); LED Boost level 6 *v
slower but typically higher resolution sampling LED Boost level 7 *w
Ambient subtract on *V
can be achieved by frequency counting (counting Ambient subtract off *W
number of pulses over a fixed time period). In IR Boost on *U
both cases, the sampling rate is limited by the IR Boost off *Y
light intensity, which determines the frequency Entering sleep mode z
Data format, normal <m>12345<cr><lf>
output of the converter. In the case of period where:
measurement, the maximum sampling rate is the <m> = mode ID (a,b,c,d,e,f,g)
12345 = 5 digit timer count or
inverse of the period of the output of the light-to- >>>>> if overrange
frequency converter, since at least one period <cr> = carriage return (ASCII 13)
must be measured to get a data point. <lf> = line feed (ASCII 10)
Data format, ambient <m>12345|67890<cr><lf>
Resolution in the case of the frequency subtract on where:
output converters is determined by the speed of <m> = mode ID (a,b,c,d,e,f,g)
12345 = 5 digit timer count (LED on)
the measurement clock (for period measurement) 67890 = 5 digit timer count (LED off)
or the frequency counting period (for frequency or >>>>> if overrange
measurement). Dynamic range is determined by <cr> = carriage return (ASCII 13)
<lf> = line feed (ASCII 10)
the output frequency range of the light-to- Notes: 1) Each timer count represents 4s
frequency converter and the counting range of the
counter. the frequency measurement technique in order to
In the design of the TSL230EVM, two utilize the timer capture function. Dynamic range
system-level constraints governed the hardware of this system is determined by the hardware timer
design and dictated the ultimate performance and is 65535 (maximum number of counts)
limitations of the system: the board must operate divided by 10 (approximate minimum number of
on two 1.5V batteries, and component count must counts due to software overhead latency in the
be minimized. timing loop) or 6553:1, approximately 72dB, or
These constraints placed several limits on the equivalent of a 12-bit A/D converter.
hardware choices. An eight-bit microcontroller The 3-volt operation constraint places an
with a 16-bit on-board timer with an input-capture upper limit of 2MHz on the microcontroller clock.
function was chosen for frequency measurement This translates to a 4s resolution (due to internal
and system control. Period timing was chosen as divide-by-8) for period measurement, with an
8
Rev B
0.9
instrument using the TSL230 and the supplied
Normalized Response
0.8
filter cap. 0.7
0.6
0.5
Datalogger 0.4
Logs data collected from the EVM to a disk file 0.3
10
Rev B
12
Rev B
changed, the power spectrum is recalculated and multiple of the flicker frequency can reduce the
the new time-domain waveform is displayed. effect on the data by sampling the same place on
the flicker waveform each time, thus reducing the
interference to a DC level. Although the EVM
Proximity Detector Application uses this technique, slight variations in timing
from unit-to-unit make complete cancellation of
Description the flicker impossible. The Ambient Light Sync
The proximity detector application function allows the user to adjust the EVM
demonstrates the use of the TSL245 in a reflective sample frequency to provide almost complete
sensing mode. The TSL245 measures the light cancellation of flicker effects.
from the LED that is reflected off of an object in
front of the EVM. The relative amount of
reflected light is used as an indication of distance Operation
between the EVM and the object. A reference To activate the Ambient Light Sync form,
position can be set so that the proximity detector double-click on a blank area on any of the
gives and indication of how near or far the object application forms, but the Datalog application is
is from the reference position. This type of most effective for making this adjustment since it
function is useful in applications such as allows you to view the flicker effect (the beat
automatic faucets, safety shields, and process frequency between the flicker rate and the
controls. sampling rate) graphically.
Call up the Datalog application and use the
default settings (TSL230 source, 100 datapoints,
Operation 0.1Hz data rate). Expose the EVM to the ambient
To run the Proximity Detector application, light, start a datalog and observe the graph.
click the Proximity Detector button on the main Ambient light flicker will show up as a sinusoidal
screen. pattern, or just a slight undulation in the signal (a
When the application form appears, click flat line would indicate no interference). Double-
start to begin operation. The proximity indicator click a blank area on the form to invoke the Sync
will behave erratically until calibrated. To form. The Sync form allows you to adjust the
calibrate, place a reflective object within 3 to 12 EVM sample rate to synchronize with the ambient
in front of the EVM and click the calibrate button. light flicker. The double-arrow buttons increment
The proximity indicator should center itself. As (and decrement) by 10 and the single-arrow
the object is brought closer, the indictor will move buttons by 1. Click the double-arrow button to
up; as the object is moved away, the indicator will adjust the time by 10, then start a datalog.
go down. To exit the application and return to the Observe the graph for any change (reduced
main screen, click the Close button. pattern). Stop the datalog and repeat the process
until a change is observed. Note that the ideal
Ambient Light Sync adjustment could be positive or negative. Once
the graph becomes flatter, use the single-arrow
Description buttons to make fine adjustments until a
satisfactorily smooth graph is obtained. This will
As mentioned earlier, fluorescent lights with
be an interative process and may require a bit of
their flicker rate of 120Hz can be a significant
experimentation. Once a good result is obtained,
source of interference when using the
click the middle button (||) to close the Sync form
TSL230EVM. Since the light level is varying, the
and save the adjustment. The adjustment value
EVM sees a different ambient light level each time
will be saved to disk and will be used each time
it samples one of the sensors, causing erratic
the program is run, or until it is changed. The
output and making ambient light rejection
difficult. Sampling the sensor outputs at an exact
sync value may have to be readjusted over time or
if the EVM is moved to a different location.
14
LIGHT TO FREQUENCY CONVERTER EVM
VDD
U1
U2
44
4
R6 2 31 7 2
1 IRQ PC0 30 8 DB0 VDD
R7
1
1
RESET PC1 29 9 DB1 R3
VPP
+ C10
VDD
43 PC2 28 10 DB2 8.2K 4.7
1
+ OSC1 PC3 27 11 DB3
C1 Y1
1
2
4.7 2 R1 PC4 26 12 DB4 3
S0
2
1 2 2MHz 1M PC5 25 13 DB5 VO
2
1
PC6 24 14 DB6
R4
2
1 42 PC7 21 5 DB7 300 U7
3
VDD OSC2 PB7 20 4 R/W 1
S1
1
1 2 PB6 19 6 RS 1 7 SE
PB5 E GND 8 OUT 5
2 U3
2
5 1 10 4 OUT IN 6
R2 H2570
VCC SO 2 9 PA2 13 1 2 3 EN IN
S1 7 12 PA3 PB0 GND
S2 1.8K
1 2 3 S2 8 11 PA0 D3 TPS7248Q
4 OE S3 6 41 PA1 14 1 R9 2 2 1
GND FO TCAP PB1 VDD
3 820 SL
TSL230
1 R10 2
S3
1 2 R1 34 160
35 PD2
4 R2 D4
36 PD3 16 1 R11 2 2 1
R3 VDD
37 PD4 PB3
MODE R4 110
1 2 39 PD5 VDD IR
R5 R6
2 1 PD7 1 2 15uH
5
R12 L1 DS1 MMBD5060LT1
56
VDD 10K U8 1 21 3
C3
2 3
1
1
1A 1Y 6 4.7
U5 + + C2
2 5 2Y 1 6 8 1.0
19
1
2
2
LX
V+
VSS
12 3A 3Y 11 3 EN .47
2
7 4A 4Y 68HC705C8 9 SHDN 16
U6
GND R1OUT C1-
22
2 8 JP1
2
1 VDD 3 5 T2IN
74HC126 Tx/Rx
GND OUT 17 GND 12
1
C5
1.0
2
MAX218
BT1 PS1 +
2 1 1 2 VDD
1
VDD
R5
3V POWER 1 MIXED SIGNAL PRODUCTS
R1 2
VDD R2 3 13532 N. Central Expressway
R3 4 S/C Bldg. M/S 93
R4 5 Dallas, Tx. 75265
C8 C9 R5 6 Draftsman Tim Flanigan
1
1
1
1
1
1
1
C6 C7
.1 .1 .1 .1 + C11 + C12 + C13 R6 7
6.8 6.8 6.8 R7 8 Size Document Number Rev
A LIGHT TO FREQUENCY CONVERTER EVM A
2
2
2
2
10Kx7
2
2
2
Date: Thursday, August 03, 1995
Rev B