Menu Close
Spread the love

Arduino color recognition

RGB color detector – Color Recognition Sensor – TCS230 TCS3200

 

Arduino color recognition

Parts Required:

–  TCS230 TCS3200 Color Recognition Sensor
–  Breadboard
–  Arduino NANO v3.0
– Wires to connect it all together

TCS230 TCS3200 Color Recognition Sensor

Wiring your Color Sensor

TCS230 TCS3200 Color Recognition Sensor


Wiring your Color Sensor

uper

// Hisham Marzouk
// www.Officialhrm.com

int s0_pin =2;
int s1_pin =3;
int s2_pin =4;
int s3_pin =5;
int out_pin =6;

void setup() {
Serial.begin(9600);
pinMode(s0_pin, OUTPUT);
pinMode(s1_pin, OUTPUT);
pinMode(s2_pin, OUTPUT);
pinMode(s3_pin, OUTPUT);
pinMode(out_pin, INPUT);
digitalWrite(s0_pin,HIGH);
digitalWrite(s1_pin,LOW);
}

void loop() {
digitalWrite(s2_pin,LOW);
digitalWrite(s3_pin,LOW);
int red_color = pulseIn(out_pin, LOW);
red_color = map(red_color, 25,72,255,0);
digitalWrite(s2_pin,HIGH);
digitalWrite(s3_pin,HIGH);
int green_color = pulseIn(out_pin, LOW);
green_color = map(green_color, 30,90,255,0);
delay(5);
digitalWrite(s2_pin,LOW);
digitalWrite(s3_pin,HIGH);
int blue_color = pulseIn(out_pin, LOW);
blue_color = map(blue_color, 25,70,255,0);
delay(30);
if (red_color >=0){
Serial.print(red_color *2);
Serial.print(“,”);
}else{
Serial.print(0);
Serial.print(“,”);
}

if (green_color >=0){
Serial.print(green_color*10);
Serial.print(“,”);
}else{
Serial.print(0);
Serial.print(“,”);
}

if (blue_color >=0){
Serial.print(blue_color*10);
}else{
Serial.print(0);

}
Serial.print(“,”);
Serial.println(0);

}

Down

Download: Color Sensor

Thank you for visiting. If you found this information helpful, please consider subscribing to the Officialhrm YouTube channel and liking their Facebook Page for more updates and helpful content. Don’t forget to share this website with your friends.

Download

File Description Date added File size Downloads
zip Color Sensor August 15, 2018 3:54 pm 70 KB 7929
Posted in Arduino

Related Posts

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *