KS0407 Keyestudio TCS34725 Color Sensor

From Keyestudio Wiki
Revision as of 12:25, 7 January 2021 by Keyestudio (talk | contribs) (→‎Resource)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


keyestudio TCS34725 Color Sensor


Overview

The RGB color model is an additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors.
The name of the model comes from the initials of the three additive primary colors, red, green, and blue.

RGB-2.png

The keyestudio TCS34725 sensor mainly uses TCS34725 color sensor chip.
It can communicate with other controllers via I2C communication interface.
Keyestudio TCS34725 color sensor is a low cost, cost effective RGB full-color color recognition sensor.
The sensor can recognize the surface color of an object through optical sensing. The sensor is illuminated by bright light and outputs corresponding RGB values to help to restore the color.

Moreover, to avoid the surroundings interference and increase the accuracy, we particularly add an infrared light shielding plate on the sensor’s bottom, so that infrared spectrum element of incident light is minimized to make color management more accurate.
On the sensor bottom you can see 4 yellow highlight LEDs, which can ensure that the sensor can use normally under low ambient light, actually realizing the fill light function.

The sensor has high sensitivity, wide dynamic range, and infrared shading filter. It is an ideal color-sensitive component solution. It is widely used for RGB LED backlight control, solid-state lighting, health products, etc.
thumb


Specifications

  • Operating voltage: 3.3-5V
  • Operating current: 65uA
  • Measured distance: 3-10mm
  • Clock frequency: 0-400KHZ
  • Interface: I2C and 2.54mm pin pitch
  • Temperature range: -30℃ ~ +70℃
  • Dimensions: 36mm*20mm*9mm
  • Weight: 3.5g


thumb


Hookup Guide


thumb


Source Code

Before compiling the code, don’t forget to place the necessary library into libraries directory of Arduino IDE. Or else, code upload will fail!
You can click the link on how to use Arduino IDE:
https://wiki.keyestudio.com/How_to_Download_Arduino_IDE

#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 3.3V 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


thumb
Hook up the sensor to main board and upload the source code. Power on, open the serial monitor and set the baud rate to 9600; you are able to see the color data of measured object.
thumb

thumb



Resource

  • Click the link to download all the info.:

https://fs.keyestudio.com/KS0407


Buy from