MD_TCS230 Color Sensor Arduino Library  1.2
Library to control TCS230 Color Sensor
Supported Hardware

This library supports the TCS230/TCS3200 color sensor and the more commonly available breakout modules available from many sources. The circuits for these modules are essentially identical except that the OE line may need to be modified (see below).

TCS230 IC

The TCS230 IC mounted in the breakout has the following pinout.

TCS230_Hardware_Pinout.png
TCS230 IC Pinout
Name Pin I/O Description
GND 4 Power Supply Ground. All Voltages are referenced to this ground.
Vdd 5 Supply Voltage (2.7-5.5V).
/OE 3 I Enable fo. OE high -> OUT becomes high. Multiple sensors can share the same OUT line.
OUT 6 O Output frequency fo.
S0,S1 1,2 I Output frequency scale selection inputs.
S2,S3 7,8 I Photodiode (color filter) selection inputs.

The operation of the hardware falls into two major functions, shown in the figure below. These different modules are controlled by setting the S0, S1, S2 and S3 pins. These settings are also shown in the tables below.

TCS230_Hardware_Functions.png
TCS230 Hardware Functions
S0 S1 Output Freq Scaling S2 S3 Photodiode Selection
L L Power Down L L Red
L H 2% L H Blue
H L 20% H L Clear (no filter)
H H 100% H H Green

TCS230 Breakout Boards

TCS230_Sensor_Breakout.png
TCS230 Sensor Breakout

The sensor can be purchased mounted on any number of inexpensive breakout boards, similar in design to that shown above. These boards extend the package connections to header pins, and integrate LEDs for illumination of the target object.

Many of these boards include a design ‘feature’ connecting OE directly to GND. Test with a multimeter by measuring the resistance between OE and GND – zero ohms reading indicates a direct connection.

This configuration will create problems if

  • The OE line is driven HIGH by external circuitry – this creates a short circuit between GND and the output of the driving circuit!
  • Multiple sensors need to be connected to the same OUT, as the OUT lines cannot be switched into high impedance mode.

Restoring normal function to the OE input is possible by cutting a track on the PCB. This is found between resistors R5 and R8, highlighted by the circle in the figure below. This may be different for other boards, so it is wise to follow the connections to make sure the correct track is cut.

TCS230_OE_Pin_MOdification.png
TCS230 OE Modification

Another modification to make the device readings consistent and repeatable is to shroud the sensor. This can be made from black card, wrapped and taped to the breakout board. The shroud eliminates stray light and ensures all the reflected light goes back to the sensor - use black so that the light reflected back into the sensor does not include color components originating from the shroud. My setup is shown below.

TCS230_Shrouded.jpg
TCS230 Sensor Shroud