TCS34725 Color Sensor SKU: CQRSENYS001

From CQRobot-Wiki
Revision as of 03:14, 19 January 2022 by Chenqi (talk | contribs) (Raspberry Pi Application)
Jump to: navigation, search
TCS34725 Color Sensor

Description

This module is the core color sensor of the TCS34725FN color light digitizer of ams AG. The sensor provides digital output of red, green, blue (RGB) and clear light sensing values. The integrated infrared blocking filter can minimize the infrared spectral components of the incident light, and can accurately perform color measurement. It has high sensitivity, wide dynamic range and infrared blocking filter. Minimize the effects of IR and UV spectral components to produce accurate color measurements. And with ambient light intensity detection and shieldable interrupt. Communication via I2C interface.


Specifications

Sensor Specifications

  • Product Category: Light to Digital Converters/TCS34725FN
  • Peak Wavelength: 525 nm
  • Maximum Operating Frequency: 400 kHz
  • Operating Supply Voltage: 3.3V to 5V
  • Operating Current: 235 uA
  • Maximum Operating Temperature: +70 Degree Celsius
  • Minimum Operating Temperature: -30 Degree Celsius
  • Interface Type: I2C
  • Maximum Fall Time: 300 ns
  • Maximum Rise Time: 300 ns
  • Resolution: 4-ch RGBC, 16-bit per ch
  • Recommended Measuring Distance: 20mm
  • Dimension: 30.5mm * 23mm
  • Mounting hole size: 3.0mm

Ocean interface Cable Specifications

  • Cable Specifications: 22AWG
  • Material: Silicone
  • Length: 21cm
  • Withstand Voltage: Less Than 50V
  • Withstand Current: Less Than 1000MA
  • Line Sequence: Red-Positive Power Supply; Black-Negative Power Supply; Green-I2C Data Input; Blue-I2C Clock Input; Yellow-Interrupt Output; Orange-Light Emitting Diode.
TCS34725FN Color Sensor-B.jpg

Hardware Description

Chip

Media: TCS3472_DataSheet.pdf

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.

CQRSENYS001-1.jpg
  • Start Signal: When SCL is High, SDA change from High to Low, it start to transmit data
  • Stop Signal: When SCL is High, SDA change from Low to High, 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

CQRSENYS001-2.png

When working, Raspberry Pi (hereafter named as Master) will first send a Start signal, then send a byte to TCS34725(hereafter named as Slaver), whose first 7bits are the address of Slaver and 1 bit write bit. Slave response with Answer signal every time it receives any data. Master sends command register address to Slaver, then data of command register. Stop signals are sent to slaves to stop communicating.

I2C Read

CQRSENYS001-3.png

When working, Master will first send a Start signal, then send a byte to Slaver, whose first 7bits are the address of Slaver and 1 bit write bit. Slave response with Answer signal every time it receives any data. Master sends command register address to Slave. After that, Mater will send a Start signal again, and then send a byte (7bits address and 1bit 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

CQRSENYS001-4.png

Note: 0x29 is 7bit in fact, therefore, when you set the I2C address, you should left-shift one bit, turn it to 0x52


Connection Diagram

TCS34725FN Color Sensor-C.jpg

Raspberry Pi Application

Enable I2C Interface

Open a terminal and run the following commands:

sudo raspi-config 
Choose Interfacing Options -> I2C ->yes 

CQRSENYS001-5.png

Install libraries

BCM2835 libraries

Install wiringPi

Python3

Download examples

Open a terminal of the Raspberry Pi


Hardware Connection

CQRSENYS001-6.png