Arduino Chameleon Using TCS3200

Arduino Chameleon Using TCS3200 © GPL3+

In this project I will guide you on how to make your own Arduino Chameleon using TCS3200 and Arduino Uno. ​

  • 1,440 views
  • 0 comments
  • 2 respects

Components and supplies

About this project

About The Project

In this project I will guide you on how to make your own Arduino Chameleon using TCS3200 and Arduino Uno. For more info and Arduino and Raspberry Pi related projects go to my website: https://www.neuralnetworks26.com/

You can also visit our official neural networks page at: https://www.facebook.com/Neural.Networks26/\

Parts Needed

  • TCS3200 x 1
  • Arduino Uno x 1
  • RGB LED x 1
  • Breadboard x 1
  • A lot of jumper wires

Softwares Needed

  • Arduino IDE

Steps to be Followed

  • Please refer to the following images for all the wire connections.

  • Now just upload the following code onto your Arduino and it's done.
/* 
* Created By Manan Thareja 
* Color sensor using TCS3200 
*/ 
#define S0 3 
#define S1 4 
#define S2 5 
#define S3 6 
#define sensorOut 2 
int green = 9; 
int blue = 10; 
int red  = 11; 
int redfrequency = 0; 
int greenfrequency = 0; 
int bluefrequency = 0; 
void setup() { 
pinMode(S0, OUTPUT); 
 pinMode(S1, OUTPUT); 
 pinMode(S2, OUTPUT); 
 pinMode(S3, OUTPUT); 
 pinMode(sensorOut, INPUT); 
 pinMode(green, OUTPUT); 
 pinMode(blue, OUTPUT); 
 pinMode(red, OUTPUT); 
 // Setting frequency-scaling to 20% 
 digitalWrite(S0,HIGH); 
 digitalWrite(S1,LOW); 
 Serial.begin(9600); 
} 
void loop() { 
 // Setting red filtered photodiodes to be read 
 digitalWrite(S2,LOW); 
 digitalWrite(S3,LOW); 
 // Reading the output frequency 
 redfrequency = pulseIn(sensorOut, LOW); 
 //Remaping the value of the frequency to the RGB Model of 0 to 255 
 redfrequency = map(redfrequency, 25,72,255,0); 
 if (redfrequency > 255) 
 { 
     redfrequency = 255;   
 }   
  else if (redfrequency < 0) 
 { 
     redfrequency = 0;   
 } 
 // Printing the value on the Serial monitor 
 Serial.print("R ");//printing name 
 Serial.print(redfrequency);//printing RED color frequency 
 analogWrite(red, redfrequency); 
 delay(100); 
 // Setting Green filtered photodiodes to be read 
 digitalWrite(S2,HIGH); 
 digitalWrite(S3,HIGH); 
 // Reading the output frequency 
 greenfrequency = pulseIn(sensorOut, LOW); 
 //Remaping the value of the frequency to the RGB Model of 0 to 255 
 greenfrequency = map(greenfrequency, 30,90,255,0); 
 if (greenfrequency > 255) 
 { 
     greenfrequency = 255;   
 }   
 else if (greenfrequency < 0) 
 { 
     greenfrequency = 0;   
 }   
 // Printing the value on the Serial monitor 
 Serial.print(" G ");//printing name 
 Serial.print(greenfrequency);//printing GREEN color frequency 
 analogWrite(green, greenfrequency); 
 delay(100); 
 // Setting Blue filtered photodiodes to be read 
 digitalWrite(S2,LOW); 
 digitalWrite(S3,HIGH); 
 // Reading the output frequency 
 bluefrequency = pulseIn(sensorOut, LOW); 
 //Remaping the value of the frequency to the RGB Model of 0 to 255 
 bluefrequency = map(bluefrequency, 25,70,255,0); 
 if (bluefrequency > 255) 
 { 
     bluefrequency = 255;   
 }   
  else if (bluefrequency < 0) 
 { 
     bluefrequency = 0;   
 }   
 // Printing the value on the Serial monitor 
 Serial.print(" B ");//printing name 
 Serial.print(bluefrequency);//printing BLUE color frequency 
 analogWrite(blue, bluefrequency); 
 Serial.println("  "); 
 delay(100); 

​If you have any questions or suggestions, feel free to post it in the "Arduino Projects" category on the Forums page of our website.

Code

Arduino Chameleon Using TCS3200C/C++
Just compile and upload it onto the Arduino
/*
 * Created By Manan Thareja
 * Color sensor using TCS3200
 */
#define S0 3
#define S1 4
#define S2 5
#define S3 6
#define sensorOut 2
int green = 9;
int blue = 10;
int red  = 11;
int redfrequency = 0;
int greenfrequency = 0;
int bluefrequency = 0;
void setup() {
pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  pinMode(sensorOut, INPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(red, OUTPUT);
  // Setting frequency-scaling to 20%
  digitalWrite(S0,HIGH);
  digitalWrite(S1,LOW);
  Serial.begin(9600);
}
 
void loop() {
  // Setting red filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,LOW);
  // Reading the output frequency
  redfrequency = pulseIn(sensorOut, LOW);
  //Remaping the value of the frequency to the RGB Model of 0 to 255
  redfrequency = map(redfrequency, 25,72,255,0);
  if (redfrequency > 255)
  {
      redfrequency = 255;  
  }  
   else if (redfrequency < 0)
  {
      redfrequency = 0;  
  }
  // Printing the value on the Serial monitor
  Serial.print("R ");//printing name
  Serial.print(redfrequency);//printing RED color frequency
  analogWrite(red, redfrequency);
  delay(100);
  // Setting Green filtered photodiodes to be read
  digitalWrite(S2,HIGH);
  digitalWrite(S3,HIGH);
  // Reading the output frequency
  greenfrequency = pulseIn(sensorOut, LOW);
  //Remaping the value of the frequency to the RGB Model of 0 to 255
  greenfrequency = map(greenfrequency, 30,90,255,0);
  if (greenfrequency > 255)
  {
      greenfrequency = 255;  
  }  
  else if (greenfrequency < 0)
  {
      greenfrequency = 0;  
  }  
  // Printing the value on the Serial monitor
  Serial.print(" G ");//printing name
  Serial.print(greenfrequency);//printing GREEN color frequency
  analogWrite(green, greenfrequency);
  delay(100);
  // Setting Blue filtered photodiodes to be read
  digitalWrite(S2,LOW);
  digitalWrite(S3,HIGH);
  // Reading the output frequency
  bluefrequency = pulseIn(sensorOut, LOW);
  //Remaping the value of the frequency to the RGB Model of 0 to 255
  bluefrequency = map(bluefrequency, 25,70,255,0);
  if (bluefrequency > 255)
  {
      bluefrequency = 255;  
  }  
   else if (bluefrequency < 0)
  {
      bluefrequency = 0;  
  }  
  // Printing the value on the Serial monitor
  Serial.print(" B ");//printing name
  Serial.print(bluefrequency);//printing BLUE color frequency
  analogWrite(blue, bluefrequency);
  Serial.println("  ");
  delay(100);

Schematics

RGB Led connection
RGB Led Connection
Rgb kv9akgbjoq
Arduino -- TCS3200
Arduino -- TCS3200
Tcs3200 ntfosbcaby

Comments

Similar projects you might like

Wise Chameleon - Turn Anything Into a Smart Device!

Project tutorial by Wise Chameleon

  • 6,892 views
  • 0 comments
  • 18 respects

@Tiny85 Sleep Controller : Power Saving with Arduino

Project tutorial by Shahariar

  • 4,944 views
  • 0 comments
  • 11 respects

NeoPixel LEDs: Arduino Basics

by Alex Glow

  • 43,209 views
  • 1 comment
  • 46 respects

Servo: Arduino Basics

by Alex Glow

  • 17,370 views
  • 2 comments
  • 60 respects

Basic Arduino + JavaScript (Workshop)

by Alex Glow

  • 11,873 views
  • 1 comment
  • 27 respects
Add projectSign up / Login