TAOS TCS230 Programmable Color Light-To-Frequency Converter
- Datasheet for Module with Appmod Adapter
- Color Me Tickled article by Jon Williams
- simple demo of the sensor on youtube
- intelligent opto sensor TAOS
- informative DIY blog :)
The TAOS TCS230 Programmable Color Light-To-Frequency Converter, strangely enough, converts light to frequency. One of the nice things about this, from what I've read, is that it dispenses with the need for expensive, hi-res ADC converters, as its output is a series of pulses that can be easily read by microcontrollers. Some applications for the converters are: color densitometer (an apparatus for measuring the optical density of a material, such as a photographic negative), to detect stamps or labels in manufacturing, color monitor calibration, color-edge finding robots and, potentially, color-tracking turntables.
taken from TCS230 datasheet
|OE||3||I||Output Enable (active low)|
|S2,S3||7,8||I||Photodiode type selection|
|H||L||Clear (No Filter)|
|S0||S1||Output Frequency Scaling|
S0 and S1 terminals determine the output scaling frequency, and S2 and S3 determine which photodiode type are used.
There is also an Output Enable (OE) pin, which comes into play when you want to use two sensors on one microcontroller's input line. Low enables output.
Power supply lines need to be decoupled by a 0.01 microF capacitor "with short leads mounted close to the device package."
The output lines should be less than 12 inches, or a buffer or line driver is recommended---to avoid interference.
It houses an 8x8 array of photodiodes, 16 with red filters, 16 with green filters, 16 with blue filters and 16 with no filters. The four types of photodiodes are interdigitated, which means that they are distributed evenly so that they make up for any uneven irradiance.
Output from the device is in the form of a square wave (50% duty cycle), the frequency of which is directly related to the intensity of the chosen color. The output pin can be connected directly to a microcontroller. The output frequency can be can be scaled by 2%, 20% or left at 100% in order to accomodate the speed of the connected microcontroller.
The internal converter generates a "fixed-pulsewidth pulse train". The pulse train output is internally connected to a series of "frequency dividers", which enables scaling of the output frequency. The connected microcontroller uses a count function to measure the incoming frequency and thereby detect the color sensed by the converter.
Output Frequency scaling can be controlled by 2 logic inputs, SO and S1. The internal light to frequency converter generates a fixed pulse width pulse- train. You can scale by internally connecting the pulse train output of the converter to a series of frequency dividers..... Divided outputs are 50% duty cycle square waves with relative frequency values of 100% , 20%, and 2%. -this is an average since the it is accomplished by counting pulses of the principal internal frequency.
On page 6 the datasheet outlines the different techniques of measuring the frequency with your microcontroller: period-measurement, frequency-measurement and pulse-accumulation or integration:
- Period-measurement is measuring the time between two consecutive pulses and calculating the frequency as the reciprocal of this measured time (recording multiple calculations and averaging them would yield higher accuracy). The datasheet says that period-measurement requires the use of a fast reference clock (available resolution is directly related to the clock rate), and that it is most appropriate when measuring rapidly varying light levels or making very fast measurements of a constant light source.
- Frequency-measurement involves counting the number of pulses per fixed time interval and dividing by the length of the time interval. This method is optimal for slowly varying or constant light levels and reading average light levels over short periods of time.
- Integration or pulse-accumulation is measuring the accumulation of pulses over a very long period of time, and is used to measure exposure, the amount of light in a specific area over a given amount of time.
The "frequency-measurement" method is implemented in the code below.
"Hello Color Sensor!" will spit separate red, green and blue values out of the serial port based on what you point the sensor at. No frequency scaling is taking place, and there is no calibration routine, so numbers are not that useful.
Color Scanner with TAOS TCS230 from the article "Color Me Tickled" by Jon Williams (see link below)
This code for the Basic Stamp contains a calibration routine, scans and stores known color samples, and scans and identifies unknown samples. I altered Jon's code to get it to send RGB values it finds out serial to MAX/MSP.
SPENCER'S EXPERIENCE AND TRIALS WITH THE SENSOR:
The TCS230 ($2.67/each for 1,000) itself is surface mount, so to get started quickly I used the TCS230 Color Sensor module kit ($79/each) from Parallax. It comes with two printed circuit boards connectible by a 6" ribbon cable. The board housing the sensor has two LEDs for illumination and a 5.3mm lens. The sensor should be about an inch away from the source of the colors it needs to detect. Conveniently, the two LEDs converge into one brightly lit spot when the sensor board is approximately one inch from the source. The AppMod adapter board is made to plug right into the Parallax Board of Education, and it has two headers to accomodate two sensors. John Schimmel was kind enough to lend me a Board of Education, but I also hooked up the sensor to the PIC18F452. The sensor consists of an array of 64 photodiodes - some with red, green or blue filters - and a current-to-frequency converter. Light intensity is measured from each type of filtered photodiode set once per pass, and the output is a square wave with a frequency proportional to the light intensity.
I didn't get time to build my color-tracking turntable, but the following is a start on the Max patch I would use. This takes in the values from the sensor and assigns each (R, G and B) to a note, creating a chord. The patch also displays the color in the video box on the right.
MV CARBON'S EXPERIENCE AND EXPERIMENTS WITH THE SENSOR
I built several cellos using electromagnetic and color sensitivity to affect the sound of the cello.