Introduction
The Teyleten Robot GY-31 TCS3200/TCS230 Color Sensor Module is designed for color recognition applications, providing a digital output that can be directly interfaced with microcontrollers such as Arduino. This module is capable of detecting a wide range of colors by converting light intensity to a frequency output. It features integrated white LEDs for illumination and anti-light interference capabilities, making it suitable for various projects requiring accurate color sensing.
Key Features
- Power supply: 3-5V DC
- Anti-light interference design
- Integrated white LEDs for illumination, with control options
- Capable of detecting non-luminous object colors
- Optimal detection distance: approximately 1 cm
Safety Information
Please read and understand the following safety precautions before using the module to prevent damage to the device or injury to yourself.
- Ensure the power supply voltage is within the specified range of 3V to 5V. Exceeding this range can damage the module.
- Avoid touching the sensor's optical lens directly to prevent smudges or scratches that could affect performance.
- Handle the module with care to prevent electrostatic discharge (ESD) damage. Use appropriate ESD precautions.
- Do not expose the module to extreme temperatures, humidity, or corrosive environments.
- Keep the module away from water or other liquids.
Product Overview
The GY-31 TCS3200/TCS230 module consists of a TCS3200 or TCS230 color sensor chip, four white LEDs for illumination, and necessary passive components. It features a standard pin header for easy connection to breadboards or PCBs.

Figure 1: Top view of the GY-31 Color Sensor Module, highlighting the sensor and LEDs.

Figure 2: Side view of the GY-31 Color Sensor Module.

Figure 3: Bottom view of the GY-31 Color Sensor Module.
Pinout Description
| Pin | Description |
|---|---|
| VCC | Power supply (3V-5V) |
| GND | Ground |
| S0 | Output frequency scaling selection input (S0, S1) |
| S1 | Output frequency scaling selection input (S0, S1) |
| S2 | Photodiode type selection input (S2, S3) |
| S3 | Photodiode type selection input (S2, S3) |
| OUT | Output frequency (digital signal) |
| LED | Control pin for onboard white LEDs (High to turn on, Low to turn off) |
Setup
Connecting the Module to a Microcontroller (e.g., Arduino)
Follow these steps to correctly wire the color sensor module to your microcontroller:
- Power Connection: Connect the VCC pin of the module to the 5V or 3.3V output of your microcontroller (ensure it matches the module's operating voltage). Connect the GND pin of the module to the Ground (GND) pin of your microcontroller.
- Output Frequency Scaling: Connect S0 and S1 pins to digital output pins on your microcontroller. These pins control the output frequency scaling.
- Photodiode Type Selection: Connect S2 and S3 pins to digital output pins on your microcontroller. These pins select the color filter (Red, Green, Blue, or Clear).
- Frequency Output: Connect the OUT pin of the module to a digital input pin on your microcontroller that supports external interrupts or pulse counting.
- LED Control: Connect the LED pin to a digital output pin on your microcontroller if you wish to control the onboard white LEDs. If not used, it can be left unconnected or tied to VCC to keep LEDs on.
Initial Power-Up
After connecting all pins, apply power to your microcontroller. The module's white LEDs should illuminate if the LED control pin is high or left floating. Verify that the power indicator (if present) on your microcontroller or breadboard is on.
Operating
Basic Operation Principle
The TCS3200/TCS230 sensor uses an 8x8 array of photodiodes. Half of the photodiodes are covered with red filters, a quarter with green filters, a quarter with blue filters, and the remaining quarter are clear with no filter. The sensor converts the intensity of light passing through these filters into a square wave with a frequency proportional to the light intensity.
Color Detection Modes (S2, S3)
The S2 and S3 pins are used to select which color filter (photodiode type) is active. By setting these pins, you can measure the intensity of red, green, blue, or clear light.
| S2 | S3 | Photodiode Type |
|---|---|---|
| LOW | LOW | Red filter |
| LOW | HIGH | Blue filter |
| HIGH | LOW | Clear (no filter) |
| HIGH | HIGH | Green filter |
Frequency Output Scaling (S0, S1)
The S0 and S1 pins control the output frequency scaling, allowing you to adjust the range of the output frequency. This is useful for optimizing the sensor's performance with different microcontrollers or for specific application requirements.
| S0 | S1 | Output Frequency Scaling |
|---|---|---|
| LOW | LOW | Power Down |
| LOW | HIGH | 2% |
| HIGH | LOW | 20% |
| HIGH | HIGH | 100% |
Example Usage (Conceptual)
To read color data, you would typically perform the following steps in your microcontroller code:
- Set S0 and S1 to select the desired output frequency scaling (e.g., 20% or 100% for most applications).
- Turn on the onboard white LEDs by setting the LED pin HIGH (if using external illumination, ensure it's consistent).
- Select the red filter by setting S2 and S3 accordingly.
- Measure the frequency output from the OUT pin for a short duration (e.g., using `pulseIn()` function on Arduino). This frequency represents the red component.
- Repeat steps 3 and 4 for the green and blue filters.
- Compare the measured red, green, and blue frequency values to determine the detected color. Calibration may be required for accurate results.
Maintenance
Cleaning
To maintain optimal performance, keep the sensor's optical lens clean. Use a soft, lint-free cloth or a camera lens cleaning brush to gently remove dust or smudges. Avoid using abrasive materials or harsh chemicals that could scratch the lens or damage the module.
Storage
When not in use, store the module in an anti-static bag in a dry, cool environment, away from direct sunlight and excessive dust. This helps prevent damage from static electricity and environmental factors.
Troubleshooting
- No output or incorrect readings:
- Verify all wiring connections (VCC, GND, S0, S1, S2, S3, OUT, LED) are secure and correct.
- Ensure the power supply voltage is stable and within the 3V-5V range.
- Check your microcontroller code for correct pin assignments and logic for setting S0-S3 and reading the OUT pin.
- Confirm the sensor lens is clean and unobstructed.
- Sensor not detecting color accurately:
- Ensure the object being sensed is within the optimal detection distance of approximately 1 cm.
- Minimize ambient light interference. The module has anti-light interference, but strong external light can still affect readings. Use the onboard LEDs or a controlled lighting environment.
- Perform a calibration step in your code by reading known colors (e.g., white, black, red, green, blue) and adjusting thresholds or reference values.
- Check the output frequency scaling (S0, S1 settings). A higher scaling (100%) provides a wider frequency range but might be more susceptible to noise.
- Module appears physically damaged:
- If the module arrived with bent pins or other visible damage, contact the seller or manufacturer for assistance.
Specifications
| Parameter | Value |
|---|---|
| Model | GY-31 (TCS3200/TCS230) |
| Power Supply Voltage | 3V - 5V DC |
| Connector Type | Plug-In (Pin Headers) |
| Number of Contacts | 8 |
| Mounting Type | PCB Mount |
| Material | Copper (PCB traces) |
| Upper Temperature Rating | 100 °C |
| Number of Items | 1 |
| Optimal Detection Distance | 1 cm |
Warranty Information
This Teyleten Robot product is typically covered by a standard manufacturer's warranty against defects in materials and workmanship. Please refer to the retailer's return policy or contact Teyleten Robot directly for specific warranty terms and conditions. Keep your proof of purchase for any warranty claims.
Support
For technical assistance, additional resources, or inquiries regarding the Teyleten Robot GY-31 TCS3200/TCS230 Color Sensor Module, please visit the official Teyleten Robot website or consult relevant online communities and forums dedicated to Arduino and sensor modules. These platforms often provide valuable examples, tutorials, and troubleshooting tips from other users and experts.