COLOR SENSOR -TCS3200

Photo of author

By Jackson Taylor

Home » Hardware » COLOR SENSOR -TCS3200

As an Amazon Associate we earn from qualifying purchases.

The TCS3200 is a low-cost color recognition sensor that hobbyists use to tell red, green, blue and white surfaces apart. It is sold on small breakout boards, usually under the names TCS3200 or TCS230. This page explains how the sensor works, what the pins do, how to connect it to a microcontroller, and why one version of the module comes with a black cover.

What the TCS3200 color sensor does

The TCS3200 is a programmable color-to-frequency converter. Inside the chip is a grid of photodiodes. Some are covered with a red filter, some with green, some with blue, and some have no filter at all. The chip turns the light that reaches the selected group of photodiodes into a square wave. The brighter that color of light is, the higher the frequency of the wave.

The sensor does not output a color name or an RGB number directly. Your microcontroller measures the frequency (or the pulse length) for each filter and compares the three values. A red object, for example, reflects more red light, so the red reading is stronger than the green and blue readings.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

Modules available

Two versions of the module were listed in the original post. The prices and stock below come from that listing and may have changed, so check with the seller before you order.

TCS230 TCS3200 color recognition sensor detector module

This is the standard breakout board. It carries the sensor chip and a ring of white LEDs that light the surface you are measuring.

TCS230 TCS3200 color recognition sensor module

Listed price: 240

Quantity remaining in the original listing: 10

TCS3200 color sensor TCS230 module with light noise removal black covering

This version has a black cover around the sensor and LEDs. The cover blocks stray room light, so the sensor mostly sees light reflected from the object in front of it. That makes readings more stable, especially in a bright room or near a window.

See also
AD620
TCS3200 color sensor module with black light-noise covering TCS3200 color sensor module with covering, second view

Listed price: 260

Quantity remaining in the original listing: 2

TCS3200 or TCS230: is there a difference?

Both names appear on the same kind of breakout board, and for hobby projects they are used the same way. The same pin names, filter settings and frequency output apply. If a seller lists the module under either name, the wiring and code in this guide should work.

Pinout and control pins

Most breakout boards expose the same pins:

  • VCC and GND: power. The chip generally runs from about 2.7 V to 5.5 V, so it works with both 3.3 V and 5 V boards.
  • S0 and S1: set the output frequency scaling (commonly 100%, 20% or 2%, or power down).
  • S2 and S3: choose which filter is read: red, green, blue or clear.
  • OUT: the square-wave output that you measure.
  • OE: output enable, active low. Many boards tie it to ground already.
  • LED pin: on some boards, a way to switch the onboard white LEDs on or off.

For the filter selection, S2 and S3 both low selects red, both high selects green, S2 low with S3 high selects blue, and S2 high with S3 low selects the clear (unfiltered) reading. The 20% scaling setting (S0 high, S1 low) is a common choice for Arduino boards, because the frequency stays easy to measure.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works

Connecting it to an Arduino

A basic setup needs only a handful of wires:

  1. Connect VCC to 5 V and GND to ground.
  2. Connect S0, S1, S2 and S3 to four digital pins and set them as outputs.
  3. Connect OUT to another digital pin and set it as an input.
  4. Set S0 and S1 to choose the frequency scaling.
  5. Set S2 and S3 for one filter, read the pulse with pulseIn(), then repeat for the other two filters.

Note that pulseIn() returns the length of a pulse, so a smaller number means a higher frequency and more light of that color. If you want a full tutorial, see our guide with the wiring and code for an Arduino color sensor.

See also
COUNTERS

Getting reliable readings

Raw readings from the TCS3200 are not true RGB values. They depend on distance, lighting and the surface, so a little calibration goes a long way.

  • Calibrate with references. Record the readings for a white sheet and a black surface, then map each channel between those two values to a 0 to 255 range.
  • Keep the distance fixed. Hold the object a short, constant distance from the sensor. A few millimeters to a couple of centimeters is typical for these modules.
  • Control ambient light. Use the black-covered version, or add a small shroud, so room light does not change your results.
  • Average several readings. Taking a few samples per channel smooths out noise.
  • Test your own colors. Glossy and translucent materials reflect light differently from matte paper, so check the thresholds on the real objects you plan to sort.

Common uses

The TCS3200 suits projects where the colors are few and clearly different from each other:

  • Sorting candies, beads or blocks by color, as in a color sorter using Arduino.
  • Following colored lines on a floor, as in a line follower robot using color sensors.
  • Checking whether a surface or indicator is a certain color, such as a test strip or status marker.
  • Teaching projects that demonstrate how light and color are measured.

It is not a laboratory colorimeter. For precise color matching, such as paint or print work, you need a calibrated instrument.

Which module should you choose?

If you work in a controlled space, such as inside a box or a sorting rig, the standard module is enough. If you work in an open area with changing light, the version with the black covering is the better pick, since it reduces the effect of ambient light on your readings.

FAQ

Does the TCS3200 work with a 3.3 V board?

The chip supports a supply range that includes 3.3 V, so it can be used with 3.3 V boards. Check your specific breakout board, since some have extra parts that may affect this.

See also
3 LEVEL FULL BRIDGE INVERTER SIMULATION IN MATLAB

Is the TCS3200 the same as the TCS230?

For typical hobby modules, yes. Both names are used for the same kind of board, with the same control pins and frequency output.

Why do my color readings change during the day?

Ambient light adds to what the sensor sees. Block outside light with a cover or enclosure, keep the object distance constant, and recalibrate against white and black references if conditions change.

Can it detect colors other than red, green and blue?

Yes. You compare the three channel readings and decide which combination counts as yellow, orange or another color. This works best when you test it with the actual objects you want to detect.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works