MD_TCS230 Color Sensor Arduino Library
1.2
Library to control TCS230 Color Sensor
|
The output is a square wave (50% duty cycle) with frequency (fo) directly proportional to light intensity:
where
fd is an output frequency resulting from leakage currents. As shown in the equation above, this frequency represents a light-independent term in the total output frequency fo. At very low light levels (dark colors), this dark frequency can be a significant portion of fo. The dark frequency is also temperature dependent.
As fo is directly proportional to frequency, it is possible to map between the frequency and RGB color value (0-255 for each of R, G and B) using linear interpolation.
Two points on the RGB line are well determined – pure Black (RGB 0, 0, 0) and pure White (255, 255, 255). The values returned by the sensor can be read using easily obtainable color swatches:
The proportional relationship is expressed by the standard straight line equation y = mx + b where
The resulting equation is
or, rearranging to give us the desired RGB value
Yurish, Sergey Y 2005, ‘Intelligent Opto Sensors Interfacing Based on Universal Frequency-to-Digital Converter’, Sensors & Transducers Magazine (S&T e-Digest), Vol.56, Issue 6, June 2005, pp.326-334.
TAOS Inc 2003, ‘TCS230 Programmable Color Light-to-Frequency Converter’, Product Datasheet TAOS046 – February 2003.
Poynton, Charles 2005, ‘Sensing Color with the TAOS TCS230’, TAOS Inc., 2005-05-17.