-
MenuBack
-
Menu
-
Arduino & Raspberry & Micro:bit
-
-
-
-
-
Controller Boards
-
-
-
Batteries
-
Components & TOOLS
-
-
e-Textil
-
-
-
Interruptores & Botões
-
-
-
Sound and Audio
-
-
-
Comunication & Smart Home
-
-
LCD + Matrix + Keypad
-
-
Power Sources and Renewable Energy
-
-
-
RENEWABLE ENERGY
-
-
-
3D Printing & DRONES
-
-
Informática
-
-
Informática
-
-
-
Motors and Relays
-
-
Oficina & Equipamentos
-
-
Oficina & Equipamentos
- Cable ties
- Pliers and Wrenches
- Breadboards
- Drills and Milling Cutters
- Storage Boxes
- Electronics boxes
- Bench Equipment
- Tool Cases & Kits
- Heat shrink sleeve
- Multimeters
- Oscilloscope
- Screws and Spacers
- PCB Copper
- End-Sleeves
- IC Programmers
- Personal Protection
- Protoboards
- Soldering
- Spray and Conductive Paint
- DIN Rail Supports
- Others
-
-
-
ROBOTICS
-
-
Sensors
-
-
- Catalog
- New Products
- On Sale
- Tutorials
- Contact
TCS34725 RGB Color Sensor For Arduino
The TCS34725 has a high sensitivity, wide dynamic range, and includes an IR blocking filter making it an ideal color sensing solution for use under varied lighting conditions. The sensor also includes four ultra-bright LEDs to allow the sensor to work without external light resources.
If you have any questions on this product please feel free to contact us.
*Disclaimer: The images are merely illustrative.
After tens of millions of years of evolution, chameleons have formed a biological instinct where they can change the color of their skin to match their environment. This technique has enabled them to avoid detection from predators.
We have taken inspiration from nature to develop the TCS34725 I2C Color Sensor. Using optical techniques, this sensor detects colors in its surrounding environment and provides a digital return of red, green, blue (RGB) values. This enables you to then recreate the detected colors using these values.
The TCS34725 has a high sensitivity, wide dynamic range, and includes an IR blocking filter making it an ideal color sensing solution for use under varied lighting conditions. The sensor also includes four ultra-bright LEDs to allow the sensor to work without external light resources.
The module works via your Arduino’s I2C bus and includes PH2.0-4P and XH2.54 (breadboard) interfaces to meet a range of user scenarios.
SPECIFICATION
- Operating Voltage: 3.3-5V
- Operating Current: 65 uA
- Detection Range: 3 - 10 mm
- The Clock Frequency: 0 - 400 KHZ
- Interface: I2C
- Temperature Range: -30℃ - + 70 ℃
- Dimensions: 18.5 x 23 mm/ 0.73 x 0.9”
- Weight: 12g
DOCUMENTS
Example code:
/*! * @file colorview.ino * @brief DFRobot's Color Sensor * @n [Get the module here] * @n This example read current R,G,B,C value by the IIC bus * @n [Connection and Diagram](http://wiki.dfrobot.com.cn/index.php?title=(SKU:SEN0212)Color_Sensor-TCS34725_%E9%A2%9C%E8%89%B2%E4%BC%A0%E6%84%9F%E5%99%A8) * * @copyright [DFRobot](http://www.dfrobot.com), 2016 * @copyright GNU Lesser General Public License * * @author [carl](carl.xu@dfrobot.com) * @version V1.0 * @date 2016-07-12 */ #include <Wire.h> #include "DFRobot_TCS34725.h" // Pick analog outputs, for the UNO these three work well // use ~560 ohm resistor between Red & Blue, ~1K for green (its brighter) #define redpin 3 #define greenpin 5 #define bluepin 6 // for a common anode LED, connect the common pin to +5V // for common cathode, connect the common to ground // set to false if using a common cathode LED #define commonAnode true // our RGB -> eye-recognized gamma color byte gammatable[256]; DFRobot_TCS34725 tcs = DFRobot_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X); void setup() { Serial.begin(115200); Serial.println("Color View Test!"); if (tcs.begin()) { Serial.println("Found sensor"); } else { Serial.println("No TCS34725 found ... check your connections"); while (1); // halt! } // use these three pins to drive an LED pinMode(redpin, OUTPUT); pinMode(greenpin, OUTPUT); pinMode(bluepin, OUTPUT); // thanks PhilB for this gamma table! // it helps convert RGB colors to what humans see for (int i=0; i<256; i++) { float x = i; x /= 255; x = pow(x, 2.5); x *= 255; if (commonAnode) gammatable[i] = 255 - x; else gammatable[i] = x; //Serial.println(gammatable[i]); } } void loop() { uint16_t clear, red, green, blue; tcs.getRGBC(&red, &green, &blue, &clear); tcs.lock(); // turn off LED Serial.print("C:\t"); Serial.print(clear); Serial.print("\tR:\t"); Serial.print(red); Serial.print("\tG:\t"); Serial.print(green); Serial.print("\tB:\t"); Serial.print(blue); Serial.println("\t"); // Figure out some basic hex code for visualization uint32_t sum = clear; float r, g, b; r = red; r /= sum; g = green; g /= sum; b = blue; b /= sum; r *= 256; g *= 256; b *= 256; Serial.print("\t"); Serial.print((int)r, HEX); Serial.print((int)g, HEX); Serial.print((int)b, HEX); Serial.println(); //Serial.print((int)r ); Serial.print(" "); Serial.print((int)g);Serial.print(" "); Serial.println((int)b ); //Set the color lamp analogWrite(redpin, gammatable[(int)r]); analogWrite(greenpin, gammatable[(int)g]); analogWrite(bluepin, gammatable[(int)b]); }
Related products