

The TCS34725 is a high-performance color sensor manufactured by Sensor. It is capable of detecting and measuring the intensity of red, green, blue, and clear (non-filtered) light. The sensor features an integrated infrared (IR) filter to minimize IR interference, ensuring accurate color measurements. It communicates via the I2C protocol, making it easy to integrate into microcontroller-based systems.








The TCS34725 is designed for precision and ease of use. Below are its key technical details:
| Parameter | Value |
|---|---|
| Supply Voltage (VDD) | 2.7V to 3.6V |
| I/O Voltage Range | 1.8V to VDD |
| Communication Interface | I2C (7-bit address: 0x29) |
| Operating Current | 235 µA (typical) |
| Standby Current | 2.5 µA (typical) |
| Light Sensing Range | 0 to 65,535 counts per channel |
| IR Filter | Integrated |
| Integration Time | Programmable (2.4 ms to 700 ms) |
| Operating Temperature Range | -30°C to +85°C |
The TCS34725 is typically available in a 6-pin package. Below is the pinout description:
| Pin | Name | Description |
|---|---|---|
| 1 | VDD | Power supply input (2.7V to 3.6V) |
| 2 | GND | Ground connection |
| 3 | SDA | I2C data line |
| 4 | SCL | I2C clock line |
| 5 | INT | Interrupt output (active low, optional use) |
| 6 | LED | LED control pin (optional, for external illumination) |
The TCS34725 is straightforward to use in a circuit, especially with microcontrollers like the Arduino UNO. Below are the steps to get started:
Below is an example Arduino sketch to read RGB and clear light values from the TCS34725 using the Adafruit_TCS34725 library:
#include <Wire.h>
#include "Adafruit_TCS34725.h"
// Create an instance of the TCS34725 sensor with default integration time
// and gain settings.
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS,
TCS34725_GAIN_1X);
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging.
if (tcs.begin()) {
Serial.println("TCS34725 found and initialized.");
} else {
Serial.println("No TCS34725 found. Check your connections.");
while (1); // Halt execution if the sensor is not detected.
}
}
void loop() {
uint16_t r, g, b, c; // Variables to store color data.
// Read raw color data from the sensor.
tcs.getRawData(&r, &g, &b, &c);
// Print the RGB and clear light values to the Serial Monitor.
Serial.print("Red: "); Serial.print(r);
Serial.print(" Green: "); Serial.print(g);
Serial.print(" Blue: "); Serial.print(b);
Serial.print(" Clear: "); Serial.println(c);
delay(500); // Wait 500ms before the next reading.
}
Sensor Not Detected:
Incorrect or Inconsistent Readings:
No Output in Serial Monitor:
Serial.begin() setting in your code.Q: Can the TCS34725 measure light intensity in lux?
A: The TCS34725 provides raw RGB and clear light data. To calculate lux, you need to apply a conversion formula based on the sensor's spectral response and your specific application.
Q: Is the TCS34725 compatible with 5V systems?
A: The sensor operates at 3.3V, but many breakout boards include level shifters to make it compatible with 5V systems. Verify your specific board's documentation.
Q: How can I improve measurement accuracy?
A: Use a diffuser to evenly distribute light over the sensor and minimize reflections. Additionally, calibrate the sensor for your specific lighting conditions.
This concludes the documentation for the TCS34725 color sensor.