The SparkFun Mini Tristimulus Color Sensor - OPT4048DTSR is a compact and efficient color sensor designed for easy integration into various projects. Utilizing the Qwiic connect system, this sensor simplifies the process of measuring red, green, and blue light intensity. It is ideal for applications requiring accurate color detection, such as color sorting, ambient light sensing, and color matching.
Parameter | Value |
---|---|
Supply Voltage | 3.3V |
Operating Current | 1.5mA |
Interface | I2C (Qwiic) |
Spectral Range | 400nm to 700nm |
Measurement Range | 0 to 65,535 (16-bit) |
Operating Temperature | -40°C to +85°C |
Dimensions | 1.0" x 0.5" (25.4mm x 12.7mm) |
Pin Number | Pin Name | Description |
---|---|---|
1 | GND | Ground |
2 | 3.3V | Power Supply (3.3V) |
3 | SDA | I2C Data Line |
4 | SCL | I2C Clock Line |
5 | INT | Interrupt (optional, not used in all applications) |
Below is an example code to interface the SparkFun Mini Tristimulus Color Sensor with an Arduino UNO using the Qwiic system.
#include <Wire.h>
#include <SparkFun_TCS34725.h> // Include the SparkFun TCS34725 library
// Create an instance of the TCS34725 class
SparkFun_TCS34725 colorSensor;
void setup() {
Serial.begin(9600); // Initialize serial communication
Wire.begin(); // Initialize I2C communication
// Initialize the color sensor
if (colorSensor.begin() == false) {
Serial.println("Color sensor not detected. Check wiring.");
while (1);
}
Serial.println("Color sensor initialized.");
}
void loop() {
// Variables to store color data
uint16_t red, green, blue, clear;
// Read color data from the sensor
colorSensor.getRawData(&red, &green, &blue, &clear);
// Print color data to the serial monitor
Serial.print("Red: ");
Serial.print(red);
Serial.print(" Green: ");
Serial.print(green);
Serial.print(" Blue: ");
Serial.print(blue);
Serial.print(" Clear: ");
Serial.println(clear);
delay(1000); // Wait for 1 second before the next reading
}
By following this documentation, users can effectively integrate and utilize the SparkFun Mini Tristimulus Color Sensor - OPT4048DTSR in their projects, ensuring accurate and reliable color detection.