Template: TCS34725 Color Sensor Spec
Overview
This is a color sensor module based on TCS34725, which will output RGB data and light intensity through the I2C interface. Its advantages include high sensitivity, wide dynamic range, accurate measuring, etc.
Features
- Onboard TCS34725FN, embedded ADC, high sensitivity, wide dynamic range.
- I2C communication uses a few pins.
- Integrates IR blocking filter, minimizes the IR spectral component of the incoming light.
- Outputs RGB data without white balance.
- Outputs light intensity, feel the light like human eyes.
- Supports light intensity interrupt output and programmable upper and lower thresholds.
- Supports fill-light by onboard LED, and adjustable brightness by PWM.
- Onboard voltage level translator, compatible with 3.3V/5V operating voltage.
Specifications
- Sensor: TCS34725FN
- Communication interface: I2C
- Operating voltage: 3.3V/5V
- Dimension: 27mm × 20mm
- Resolution: 4-ch RGBC, 16-bit per channel
- Recommended measuring distance: 2mm
Pinouts
Pin | Function |
VCC | 3.3V/5V |
GND | Power ground |
SDA | I2C data input |
SCL | I2C clock pin |
INT | Interrupt output (open drain output) |
LED | Light emitting diode |
Controller
TCS34725 is used for color sensing. TCS34725 is an I2C bus-based color light-to-digital converter with an IR filter, providing a digital return of red, green, blue (RGB), and clear light sensing values. The high sensitivity, wide dynamic range, and IR blocking filter make the TCS34725 an ideal color sensor solution for use under varying lighting conditions and through attenuating materials.
Communication Protocol
I2C bus has two lines, one is a data line (SDA) and another is a lock line (SDL). There are three kinds of signals when communicating, Start signal, Stop signal, and Answer signal.
Start signal: When SCL is High, SDA change from High to Low, and it starts to transmit data.
Stop signal: When SCL is High, SDA change from Low to High, and it stops transmitting.
Answer signal: Every time IC sends back a certain Low plus to the sender after it receives 8 bits of data.
I2C Write
When working, Raspberry Pi (hereafter named Master) will first send a Start signal, then send a byte to TCS34725(hereafter named Slaver), whose first 7 bits are the address of Slaver and 1-bit write bit. The slave responds with an Answer signal every time it receives any data. The master sends the command register address to Slaver, then the data of the command register. Stop signals are sent to slaves to stop communicating.
I2C Read
When working, Master will first send a Start signal, then send a byte to Slaver, whose first 7 bits are the address of Slaver and 1-bit write bit. The slave responds with an Answer signal every time it receives any data. The master sends the command register address to the Slave. After that, Mater will send a Start signal again, and then send a byte (7-bit address and 1-bit read bit) to Slaver. Slaver response and send data of the register to Master, master answer as well. Stop signals will be sent to stop communicating.
I2C Address
The I2C device address of TCS34725 is 0x29.
Note: 0x29 is 7bit in fact, therefore, when you set the I2C address, you should left-shift one bit, and turn it to 0x52.