KS0494 Keyestudio micro bit honeycomb TCS34725 Color Sensor
Description
The TCS34725 color sensor is a RGB full-color recognizer with low cost but high performance, which identifies surface colors of objects via optical sensing.
It responses to bright light and then correspondingly outputs the specific value to restore real colors.
Besides, the color sensitive photodiode integrated sheet and localization infrared shading filter minimize the infrared spectrum components in incident lights and largely accuralize the color management.
Under the conditions of changing light and attenuating materials, TCS34725 is an ideal color sensitive component for its high sensitivity, wide dynamic range and the built-in filter.
As a matter of fact, the application of this sensor is broad, including RGB LED backlight control, solid state lighting, health product, industrial process control and medical diagnostic equipment.
Parameters
Working voltage: 5V
Current: 100mA
Maximum power: 0.5W
Detection distance: 3-10mm
Clock frequency: 0-400KHZ
Interface: IIC interface and 2.54 pitch interface
I2C address: 0x29
Temperature range: -10℃ ~ +50℃
Working Principle Diagram
Wiring Diagram
Test Code
(Test software: Arduino-1.8.12)
#include <Wire.h> #include "Adafruit_TCS34725.h" /* Example code for the Adafruit TCS34725 breakout library */ /* Connect SCL to analog 5 Connect SDA to analog 4 Connect VDD to 5V DC Connect GROUND to common ground */ /* Initialise with default values (int time = 2.4ms, gain = 1x) */ // Adafruit_TCS34725 tcs = Adafruit_TCS34725(); /* Initialise with specific int time and gain values */ Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); void setup(void) { Serial.begin(9600); if (tcs.begin()) { Serial.println("Found sensor"); } else { Serial.println("No TCS34725 found ... check your connections"); while (1); } // Now we're ready to get readings! } void loop(void) { uint16_t r, g, b, c, colorTemp, lux; tcs.getRawData(&r, &g, &b, &c); colorTemp = tcs.calculateColorTemperature(r, g, b); lux = tcs.calculateLux(r, g, b); Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - "); Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - "); Serial.print("R: "); Serial.print(r, DEC); Serial.print(" "); Serial.print("G: "); Serial.print(g, DEC); Serial.print(" "); Serial.print("B: "); Serial.print(b, DEC); Serial.print(" "); Serial.print("C: "); Serial.print(c, DEC); Serial.print(" "); Serial.println(" "); }
Test Result
Wire up as the diagram, upload code and power on.
Open the serial monitor to set baud rate to 9600, and the color data(white) of the detected object will be displayed as shown below.
Resources
For more details, please refer to:
https://fs.keyestudio.com/KS0494