TCS34725 RGB colour sensor
TCS34725 RGB colour sensor module pinout (LED, INT, SDA, SCL, 3V3, GND, VIN), I2C address 0x29, gain and integration time, and turning off the LED.
Community draft — report a mistake
3.3 V or 5 V? Modules with a VIN pin have a 3.3 V regulator and level shifting on SDA/SCL, so ESP32, Pico and Uno all work. The 3V3 pin is the regulator output — use VIN or 3V3, not both.
The TCS34725 has a 3×4 grid of photodiodes with red, green, blue and clear filters plus an IR-blocking filter, each feeding a 16-bit counter. The module adds a neutral white LED so it can see the colour of an object held just in front of it. It’s the usual choice for colour-sorting machines, line-following by colour and ripe/unripe fruit checks.
Two settings control everything: gain (1×, 4×, 16×, 60×) and integration time (2.4–614 ms). Longer and higher means more sensitive but slower and easier to saturate. Normalise R, G and B by the clear channel to get colour that doesn’t change with brightness.
Light is the gotcha. Under tube lights and LED bulbs the readings flicker at 100 Hz and shift colour. For repeatable results, put the sensor and object in a small dark shroud and rely on the on-board LED alone.
Prices are indicative (Nov 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
LED | White illumination LED control — leave open for always on, pull LOW (or drive from a GPIO) to switch it off |
INT | Interrupt output, open-drain (optional) |
SDA | I2C data |
SCL | I2C clock |
3V3 | 3.3 V regulator output (or 3.3 V input if you leave VIN unconnected) |
GND | Ground |
VIN | 3.3–5 V supply |
I2C address:0x29
Library
Adafruit TCS34725 by Adafruit
Arduino IDE → Library Manager → search the name above. Each guide lists the exact version we compile against.
Use it with
Common errors
“No TCS34725 found”
Check wiring and run the I2C scanner — it must show 0x29. Some clones have a TCS34727 that reports a different ID; the library may need the ID check relaxed.
Every colour reads almost the same
The sensor is too far away or ambient light swamps it. Hold the object 3–10 mm from the sensor, shade it from room light, and raise gain (TCS34725_GAIN_16X) or integration time.
Readings saturate at 65535 or a fixed maximum
Too much light for the gain and integration time. Lower the gain or shorten the integration time until the clear channel sits below about 80 % of full scale.