Source: https://mokxi.com/parts/tcs34725
Updated: 2026-11-10

Part

# Color sensor, TCS34725

Red, green, blue and clear counts over I2C at 0x29, with a white LED to light the card. The eye of a color sorter.

See every part

- 6 pins
- 1 setting
- In 1 project

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Color sensor, TCS34725 in brief

What it is, and every setting the properties panel gives it.

The TCS34725 is the color sensor in candy and bead sorters, on the Adafruit-style board with a white LED beside the chip. Its pins are VIN, GND, SCL, SDA, INT and LED; the board regulates VIN, so 3.3 or 5 V, and SDA and SCL go to A4 and A5 on an Uno or GPIO 21 and 22 on an ESP32. The address is 0x29, fixed. Mokxi models the TCS3472 datasheet: the command byte with bit 7 set, sleep at power-on, the 2.4 ms oscillator start, integration in 2.4 ms cycles, gain of 1, 4, 16 or 60x, the ID 0x44, AVALID, saturation at 1024 counts a cycle up to 65535, and the clear-channel interrupt on the open-drain INT pin. The LED pin is pulled high, so the LED is lit, and pulled low the card reads a tenth as much. The row of cards on the part sets what sits in front of it. The classic mistake is comparing raw counts: a dark red reads smaller than a light one, so compare each channel’s share of the total. How many counts a lit card gives is an assumption, and noise, infrared and room light are not modeled.

Family

Sensors

Pins

6

color

#d8262e

Pins

## 6 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

What it does

VIN

Supply, 3.3 V or 5 V. The board regulates it down for the chip.

GND

Ground.

SCL

I2C clock. The board carries the pull-ups.

SDA

I2C data.

INT

The chip's interrupt, open drain, low when it fires. Leave it free if unused.

LED

The white LED. The board pulls it high, so it is lit; pull it low to turn it off.

How to use it

## How to use the TCS34725 color sensor with an Arduino

VIN to 5 V, GND to GND, SDA to A4 and SCL to A5; INT and LED can stay open, and the board keeps the white LED lit. Construct Adafruit_TCS34725 with an integration time and a gain, 50 ms and 4x in the Holi color catcher, call begin(), and read the four counts with getRawData(&r, &g, &b, &c).

Do not compare raw counts. A dark red gives smaller numbers than a light one, so the example turns red, green and blue into shares of their total and picks the nearest name from a table. It also ignores readings whose clear count is low, which is nothing close to the sensor. Pick a card on the part and the strip of eight WS2812B LEDs on pin 6 catches the color.

Part pin

Board pin

VIN

5 V

GND

GND

SDA

A4

SCL

A5

On an ESP32, power it from 3.3 V with SDA on GPIO 21 and SCL on 22. Its address, 0x29, is the VL53L0X’s too, so the two cannot share a bus as they ship.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

The four counts

How it is modeled

## What is true about the Color sensor, TCS34725, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

The command byte and its three types, sleep at power on, the 2.4 ms oscillator start,
the integration time and gain, AVALID, saturation at 1024 counts a cycle, the clear
channel interrupt with its thresholds and persistence, the special function that clears
it, and the INT and LED pins, all from the TCS3472 datasheet.

### Not modeled

How many counts a card gives is an assumption, since the datasheet gives the filters'
curves and not a lit card at a few millimeters: a white card reads 30 counts a cycle
at 1x on each color, each channel picks up a little of its neighbors, and with the LED
off the card reads a tenth as much. Noise, infrared and the room's own light are not
modeled.

From TCS34725 color sensor, in full.

Projects

## See the Color sensor, TCS34725 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

## The boards it is shown on

This board has a built-in project with the Color sensor, TCS34725 in it.

- Arduino Uno R3

Libraries

## Arduino libraries for the Color sensor, TCS34725

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

- Adafruit TCS34725

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Color sensor, TCS34725

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
