The TCS3200 (and TCS230) is a programmable light-to-frequency converter. It features a matrix of silicon photodiodes covered by red, green, blue, and clear (no filter) light filters. The output of the sensor is a square wave whose frequency is directly proportional to light intensity on the selected filter channel.
1. Hardware Specifications & Pinout
- Operating Voltage: 2.7V to 5.5V.
- Output Waveform: Square wave (50% duty cycle) with frequency up to 600 kHz.
- S0 / S1 Pins: Controls output frequency scaling:
- OFF: Power down mode.
- 2%: Typical scaling for low-speed/low-power MCUs.
- 20%: Recommended for Arduinos / general ADC frequency reading.
- 100%: Fastest response (best for high-speed ESP32 / Pico).
- S2 / S3 Pins: Filter color selection logic.
- Pin Configuration:
- VCC: Power.
- GND: Ground.
- S0 / S1: Frequency scaling digital outputs.
- S2 / S3: Color filter selection digital outputs.
- OUT: Frequency output digital input pin.
- LED: Active-HIGH pin to control the 4 onboard white illumination LEDs.
2. How it Works (Theory of Operation)
By setting pins S2 and S3, we select which photodiodes are active:
- S2 = LOW, S3 = LOW: Red photodiodes are active.
- S2 = HIGH, S3 = HIGH: Green photodiodes are active.
- S2 = LOW, S3 = HIGH: Blue photodiodes are active.
- S2 = HIGH, S3 = LOW: Clear (no filter) photodiodes are active.
The microcontroller reads the frequency on the OUT pin using pulse counting (
pulseIn()or interrupt counters) over a 100ms sample window. Higher frequency = stronger color detection.
3. Component Properties
The TCS3200 now has a real simulated component (tcs3200_color_sensor) — drag it onto the Circuit
Canvas from the Components palette. It exposes one property:
- Target Color (
targetColor) — hex color picker, default#e74c3c(red). Represents the color of a hypothetical object placed in front of the sensor's lens.
All 8 real pins are wired: S2/S3 are real filter-select inputs — the simulator reads their
voltage and switches which channel of targetColor it reports, using the exact same S2/S3
truth table as Section 2 (confirmed identical in both the Blockly codegen above and the simulated
component's own logic). OUT is a real output pin whose driven resistance responds to the
selected channel's intensity. VCC/GND power the module. S0/S1/OE are accepted
as real digital inputs but have no simulated effect — see the note below.
[!NOTE] OUT is modeled as a static output resistance proportional to the selected channel's brightness, not a literal variable-frequency square wave — this simulator has no mechanism to produce a changing-frequency waveform on a pin. The real Blockly-generated code above uses pulse-counting (
pulseIn()-style busy-polling) against a real frequency signal — genuinely correct for real hardware, but it won't read a meaningful count from the simulated OUT pin, since nothing there is actually toggling. The S0/S1 frequency-scaling pins are likewise accepted as real digital inputs on the component but don't change anything in the simulation either way. Section 5's LED pin is a real, Blockly-controllable pin on real hardware, but it isn't one of the simulated component's 8 pins at all — there's nothing to wire it to on the Circuit Canvas today.
4. Simulator Behavior
With the component placed and the circuit running:
- Click one of the 9 preset color swatches, or use the native color picker, to set
targetColorto any hex color — represents shining the sensor at an object of that color. - A live text readout above the component shows
Filter:<RED/GREEN/BLUE/CLEAR> (<0-255>) f:<estimated kHz>continuously while powered, reflecting whichever channel S2/S3 currently select — always-visible, not a hover-only tooltip.

