Skip to Content

Color Recognition RGB Sensor TCS34725

The TCS34725 is a powerful color recognition sensor that can detect red, green, blue (RGB), and pure light (clear channel). It features an integrated infrared (IR) blocking filter, enhancing color accuracy by minimizing IR light interference—which the human eye cannot detect. This makes it ideal for precise color-sensing applications across varied lighting conditions.

Package Includes:

  • 1 x TCS34725 RGB Color Sensor Module (Purple PCB)

35.00 AED 35.00 AED Tax Included
35.00 AED Tax Included

Not Available For Sale

This combination does not exist.

Terms and Conditions
30-day money-back guarantee
Shipping: 2-3 Business Days

 

Features

  • Built-in IR-blocking filter for accurate color readings
  • High dynamic range of 3,800,000:1
  • Programmable gain and integration time for custom calibration
  • I2C communication interface with optional interrupt output
  • Low power consumption, including a 2.5 µA sleep state

 

Principle of Operation

The sensor contains RGB color filters and photodiodes that measure light intensity. Each filter only allows its corresponding wavelength (red, green, or blue) to pass through. The photodiode generates a current based on the light intensity, which is then converted to a voltage signal readable via an ADC. The IR-blocking filter further improves visible light accuracy.

TCS34725 RGB Working Principle TCS34725 Block Diagram

Pinout and Connections

Pin Description Connection
VCC Module Power Supply (5V) Connect to 5V
3.3 Module Power Supply (3.3V) Optional – Connect to 3.3V
GND Ground Connect to GND
SCL I2C Clock Connect to SCL on microcontroller
SDA I2C Data Connect to SDA on microcontroller
INT Interrupt Output Optional – used to trigger events
LED LED Enable (Active Low) Control built-in LED

TCS34725 Module Pins

Specifications

  • Operating Voltage: 3.3 – 5V DC
  • Dynamic Range: 3,800,000:1
  • Sleep Mode Current: 2.5 µA
  • Interface: I2C (400 kbps)

Applications

  • Ambient Light Detection
  • RGB LED Backlight Adjustment
  • Color-based Sorting Systems (e.g., fruits or products)
  • Color Temperature Measurement
  • Display Brightness Auto-Control
  • Fluid and Gas Color Analysis

Sample Project: Arduino Color Detection

Required Components

  • 1 x Arduino Uno
  • 1 x TCS34725 RGB Sensor Module
  • 3 x Jumper Wires
  • 1 x Breadboard (optional)

Wiring Example

Library

Use the Adafruit_TCS34725 library. Install it via the Arduino Library Manager or download it from: https://www.makerguides.com/tcs34725-rgb-color-sensor-with-arduino/

Arduino Sample Code

#include "Adafruit_TCS34725.h"

#define redpin 3
#define greenpin 5
#define bluepin 6
#define commonAnode true

byte gammatable[256];
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

void setup() {
  Serial.begin(9600);
  if (!tcs.begin()) {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);
  }

  pinMode(redpin, OUTPUT);
  pinMode(greenpin, OUTPUT);
  pinMode(bluepin, OUTPUT);

  for (int i = 0; i < 256; i++) {
    float x = i / 255.0;
    x = pow(x, 2.5) * 255;
    gammatable[i] = commonAnode ? 255 - x : x;
  }
}

void loop() {
  float red, green, blue;
  tcs.setInterrupt(false);
  delay(60);
  tcs.getRGB(&red, &green, &blue);
  tcs.setInterrupt(true);

  Serial.print("R:\t"); Serial.print((int)red);
  Serial.print("\tG:\t"); Serial.print((int)green);
  Serial.print("\tB:\t"); Serial.println((int)blue);

  analogWrite(redpin, gammatable[(int)red]);
  analogWrite(greenpin, gammatable[(int)green]);
  analogWrite(bluepin, gammatable[(int)blue]);
}

How It Works

  • The TCS34725 reads ambient color levels in RGB format.
  • Readings are printed to the serial monitor.
  • An RGB LED connected to PWM pins visualizes the sensed color.

Resources