TCS3200 Color Sensor

Description:

This product uses imported chips TCS3200

TCS3200 Color Sensor is a complete color detectorincluding a TAOS TCS3200 RGB sensor chip and 4 white LEDs.  The TCS3200 can detect and measure a nearly limitless range of visible colors. Applications include test strip readingsorting by colorambient light sensing and calibrationand color matchingto name just a few.

The TCS3200 has an array of photodetectorseach with either a redgreenor blue filteror no filter (clear). The filters of each color are distributed evenly throughout the array to eliminate location bias among the colors. Internal to the device is an oscillator which produces a square-wave output whose frequency is proportional to the intensity of the chosen color.

TCS230 TCS3200 is upgraded versionthe better

Features:

  • Power: (2.7V to 5.5V)
  • Interface:Digital TTL
  • High-Resolution Conversion of Light Intensity to Frequency
  • Programmable Color and Full-Scale Output Frequency
  • Power Down Feature
  • Communicates Directly to Microcontroller
  • Size: 28.4x28.4mm
  • Best detection distance 1cm

Documents:

Mikroelectron Code:

#include <TimerOne.h>


#define S0    6   // Please notice the Pin's define

#define S1     5

#define S2     4

#define S3     3

#define OUT    2


int   g_count = 0;    // count the frequecy

int   g_array[3];     // store the RGB value

int   g_flag = 0;     // filter of RGB queue

float g_SF[3];        // save the RGB Scale factor


// Init TSC230 and setting Frequency.

void TSC_Init()

{

  pinMode(S0OUTPUT);

  pinMode(S1OUTPUT);

  pinMode(S2OUTPUT);

  pinMode(S3OUTPUT);

  pinMode(OUTINPUT);


  digitalWrite(S0LOW);  // OUTPUT FREQUENCY SCALING 2%

  digitalWrite(S1HIGH);

}


// Select the filter color

void TSC_FilterColor(int Level01int Level02)

{

  if (Level01 != 0)

    Level01 = HIGH;


  if (Level02 != 0)

    Level02 = HIGH;


  digitalWrite(S2Level01);

  digitalWrite(S3Level02);

}


void TSC_Count()

{

  g_count ++ ;

}


void TSC_Callback()

{

  switch (g_flag)

  {

    case 0:

      Serial.println("->WB Start");

      TSC_WB(LOWLOW);              //Filter without Red

      break;

    case 1:

      Serial.print("->Frequency R=");

      Serial.println(g_count);

      g_array[0] = g_count;

      TSC_WB(HIGHHIGH);            //Filter without Green

      break;

    case 2:

      Serial.print("->Frequency G=");

      Serial.println(g_count);

      g_array[1] = g_count;

      TSC_WB(LOWHIGH);             //Filter without Blue

      break;


    case 3:

      Serial.print("->Frequency B=");

      Serial.println(g_count);

      Serial.println("->WB End");

      g_array[2] = g_count;

      TSC_WB(HIGHLOW);             //Clear(no filter)

      break;

    default:

      g_count = 0;

      break;

  }

}


void TSC_WB(int Level0int Level1)      //White Balance

{

  g_count = 0;

  g_flag ++;

  TSC_FilterColor(Level0Level1);

  Timer1.setPeriod(1000000);             // set 1s period

}


void setup()

{

  TSC_Init();

  Serial.begin(9600);

  Timer1.initialize();             // defaulte is 1s

  Timer1.attachInterrupt(TSC_Callback);

  attachInterrupt(0TSC_CountRISING);


  delay(4000);


  for (int i = 0; i < 3; i++)

    Serial.println(g_array);


  g_SF[0] = 255.0 / g_array[0];    //R Scale factor

  g_SF[1] = 255.0 / g_array[1] ;   //G Scale factor

  g_SF[2] = 255.0 / g_array[2] ;   //B Scale factor


  Serial.println(g_SF[0]);

  Serial.println(g_SF[1]);

  Serial.println(g_SF[2]);


}


void loop()

{

  g_flag = 0;

  for (int i = 0; i < 3; i++)

    Serial.println(int(g_array * g_SF));

  delay(4000);

}


8 JD
Quantity
9 in stock
8 JD 1+ units
7.6 JD 10+ units
7.2 JD 25+ units
6.8 JD 100+ units



Related Products

subscribe to our weekly newsletter

loading