KS0473 EASY Plug TCS34725 Color Sensor(Black and Eco-friendly)

From Keyestudio Wiki
Jump to navigation Jump to search


W.png


Description:

The RGB color mode is a color standard in the industry, which is obtained by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents three channels of red, green and blue. This standard includes almost all colors that human vision can perceive. It is one of the most widely used color systems.


The Keyestudio TCS34725 color sensor is a low-cost, cost-effective RGB full-color color recognition sensor. It can recognize the surface color of an object through optical sensing, and output corresponding RGB values to restore the original color via bright light sensing.

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.
Coming with 4 highlight LEDs, the sensor can work normally at low ambient light to achieve the function of filling light. The communication method of the sensor is I2C communication.
This module needs to be used with the EASY plug Control board V2.0 and control board (KS0240). When in use, you can use a special telephone line (RJ11 crystal head) to connect with the control board.

Specifications:

Working voltage: DC 3.3-5V
Working current: 65uA
Detection distance: 3-10mm
Clock frequency: 0-400KHZ
Interface: I2C interface and EASY plug interface
Temperature range: -30 ° C ~ +70 ° C
Size: 40*20*19mm
Weight: 5.6g


Wiring Diagram


W1.png


Test Code

#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

Connect the line, upload the code, after power-on, open the serial monitor, set the baud rate to 9600, you can see the color (white) data of the object you are testing, as shown below.

W2.png

Resources

https://fs.keyestudio.com/KS0473


Get One Now