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 5402
Posted in Arduino

Related Posts

10 Comments

  1. Video

    I have fun with, result in I found just what I was having a look for. You have ended my 4 day long hunt! God Bless you man. Have a nice day. Bye

  2. CBD Lube

    I believe this is one of the so much vital info for me. And i’m happy studying your article. However want to statement on some basic things, The web site taste is perfect, the articles is in reality excellent : D. Just right task, cheers|

  3. criminal lawyers toronto

    Hi there would you mind letting me know which hosting company you’re working with? I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot faster then most. Can you suggest a good hosting provider at a fair price? Thanks, I appreciate it!

  4. fender bender

    I don’t even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you’re going to a famous blogger if you aren’t already 😉 Cheers!

Leave a Reply

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