The Flora TCS34725 Color Sensor is an advanced electronic component designed for accurate color and light intensity measurement. This sensor is ideal for a wide range of applications, including ambient light sensing, color matching in printing, and dynamic lighting adjustment in consumer electronics. Its compact form factor and compatibility with the Adafruit Flora platform make it a popular choice for wearable electronics and e-textiles.
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (3.3V) |
2 | GND | Ground connection |
3 | SDA | I2C data line |
4 | SCL | I2C clock line |
5 | INT | Interrupt output (active low) |
To use the Flora TCS34725 Color Sensor in a circuit:
#include <Wire.h>
#include <Adafruit_TCS34725.h>
// Create an instance of the sensor
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);
void setup() {
Serial.begin(9600);
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 sensor found ... check your connections");
while (1); // halt the program
}
}
void loop() {
uint16_t r, g, b, c;
tcs.getRawData(&r, &g, &b, &c);
// Calculate color temperature and luminosity
uint16_t colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
uint16_t lux = tcs.calculateLux(r, g, b);
// Output the results
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.println(" ");
delay(1000); // Wait for 1 second before the next reading
}
Q: Can the Flora TCS34725 Color Sensor work with a 5V system? A: The sensor is designed for 3.3V. Using it with a 5V system without proper level shifting could damage the sensor.
Q: How can I extend the range of the sensor? A: Adjust the gain settings to increase the sensitivity of the sensor.
Q: What is the purpose of the INT pin? A: The INT pin can be used to trigger an interrupt on your microcontroller when a certain color threshold is reached, reducing the need for continuous polling.
For further assistance, consult the Adafruit TCS34725 datasheet and the Adafruit support forums.