TCS3200 Colour Sensor
Point a chip at a coloured surface and read its red, green, and blue components as pulse frequencies.
Difficulty: Breadboard. Estimated build time: about 30 minutes. Estimated parts cost: about US$6.00. 4-line bill of materials. Compare supplier offers when available. A digital colour identifier built from the TAOS TCS3200D, a single-chip light-to-frequency converter with a grid of photodiodes covered by red, green, blue, and clear filters.
Wire the breakout
Connect V_CC to 5 V, GND to GND. The module has six logic pins: S0, S1 (output scaling), S2, S3 (filter select), OUT (frequency output), OE (enable). Wire S0=HIGH, S1=HIGH for the full 100 % output scaling, OE to GND (always enabled), and OUT to digital pin D2 on the Arduino so we can use pulseIn() to time the pulses.
Read one channel at a time
To read red: write S2=LOW, S3=LOW. Wait 50 ms for the chip to settle. Call pulseIn(2, LOW); to time one low half-pulse. The smaller the value, the higher the frequency, the more red light hitting the chip. Cycle through green (S2=HIGH, S3=HIGH), blue (S2=LOW, S3=HIGH), and clear (S2=HIGH, S3=LOW).
Calibrate against a white and a black reference
Show the sensor a piece of white paper under good illumination and record the four pulseIn values — those are your minima (highest flux). Repeat with black electrical tape — those are your maxima (lowest flux). Now scale every reading to 0–255 between those two extremes and you have something resembling RGB.
Identify a colour
Pre-record the (R, G, B) triplets for a few known surfaces (red Sharpie, blue Sharpie, green LEGO). At runtime, read the live triplet and compare against the database using nearest-neighbour distance. The robot now knows it’s looking at “red line” versus “blue line” — the basis of every grid-based mini-sumo.