Description
COLOR is a Color Light-to-Digital Converter with IR Filter. TCS3472 device provides a digital return of red, green, blue(RGB), and clear light sensing values. An IR blocking filter,integrated on-chip and localized to the color sensing photodiodes, minimizes the IR spectral component of the incoming light and allows color measurements to be made accurately.
In order to get better result, you can try to blacking the sunken area on the side with marker pen.
This Unit communicates with the M5Core via the GROVE PORTA (I2C). Address is 0x29.
Product Features
- Red, Green, Blue (RGB), and Clear Light
- Sensing with IR blocking filter
- Programmable analog gain and integration time
- 3,800,000:1 dynamic range
- Very high sensitivity - ideally suited for operation behind dark glass
- Program Platform: Arduino, UIFlow(Blockly, Pyhton)
- Two Lego-compatible holes
Kit includes
- 1x COLOR Unit
- 1x Grove Cable
Application
- RGB LED backlight control
- Light color temperature measurement
- Ambient light sensing for display backlight control
- Fluid and gas analysis
- Product color verification and sorting
Documents
- Datasheet - TCS3472
Learn
Example
Arduino IDE
The code below is incomplete. To get the complete code, please click here.
/*
Color test
hardware: M5Stack
please install the Adfruit TCS34725 library first ...
*/
#include <Wire.h>
#include <M5Stack.h>
#include "Adafruit_TCS34725.h"
// declaration
uint16_t clear, red, green, blue;
#define commonAnode true // set to false if using a common cathode LED
// new a object
Adafruit_TCS34725 tcs;
tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS,TCS34725_GAIN_4X);
// initialization
M5.begin(true, false, false);
tcs.begin();
tcs.setIntegrationTime(TCS34725_INTEGRATIONTIME_154MS);
tcs.setGain(TCS34725_GAIN_4X);
// read data
tcs.getRawData(&red, &green, &blue, &clear);
After burnt this example, PC serial terminal will print original value RGBC(red, green, blue, clear).
More informaiton
Schematic
PinMap
M5Core(GROVE A) | GPIO22 | GPIO21 | 5V | GND |
COLOR Unit | SCL | SDA | 5V | GND |