TZT Color recognition sensor TCS230 TCS3200

TZT Color recognition sensor TCS230 TCS3200 Color sensor Color recognition module for arduino DIY Module DC 3-5V Input


37 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2023-02-15


TCS3200 to ESP8266

برمجة المستشعر مع arduino او ESP32 او ESP8266 تكون نفسها بالضبط باستثناء ارقام المنافذ تتغير حسب المتحكم حيث ان التوصيل يكون مختلف.




circuit:



code

code
نسخ
اقتباس
عرض
تنزيل
	
								
/*TCS3200*/ const int s0 = 4; //D2 const int s1 = 14; //D5 const int s2 = 12; //D6 const int s3 = 13; //D7 const int out = 15; //D8 int red = 0; int green = 0; int blue = 0; void setup() { Serial.begin(9600); pinMode(s0, OUTPUT); pinMode(s1, OUTPUT); pinMode(s2, OUTPUT); pinMode(s3, OUTPUT); pinMode(out, INPUT); // The output frequency scaled to 100% and you can set it 20% for most application digitalWrite(s0, HIGH); digitalWrite(s1, LOW); } void loop() { digitalWrite(s2, LOW); digitalWrite(s3, LOW); //count OUT, pRed, RED red = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); digitalWrite(s3, HIGH); //count OUT, pBLUE, BLUE blue = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); digitalWrite(s2, HIGH); //count OUT, pGreen, GREEN green = pulseIn(out, digitalRead(out) == HIGH ? LOW : HIGH); Serial.print("R Intensity:"); Serial.println(red, DEC); Serial.print(" G Intensity: "); Serial.println(green, DEC); Serial.print(" B Intensity : "); Serial.println(blue, DEC); if(red<39 & red>29 & green<93 & green>83 &blue<78 & blue>69){ Serial.println("Red"); } if(green<75 & green>65 & blue<68 &blue>60){ Serial.println("Orange"); } if(red<46 & red>36 & green<46 & green>37){ Serial.println("Green"); } if(red<34 & red>25 & green<37 & green>28 & blue<53 & blue>43){ Serial.println("Yellow"); } delay(1000); }


equation from RGB to CMYK:

code
نسخ
اقتباس
عرض
تنزيل
	
								
############################################ Black = minimum(1-Red,1-Green,1-Blue) Cyan = (1-Red-Black)/(1-Black) Magenta = (1-Green-Black)/(1-Black) Yellow = (1-Blue-Black)/(1-Black) ############################################


other test code

code
نسخ
اقتباس
عرض
تنزيل
	
								
/*TCS3200*/ #define S0 4 //D2 #define S1 14 //D5 #define S2 12 //D6 #define S3 13 //D7 #define sensorOut 15 //D8 int frequency = 0; void setup() { pinMode(S0, OUTPUT); pinMode(S1, OUTPUT); pinMode(S2, OUTPUT); pinMode(S3, OUTPUT); pinMode(sensorOut, INPUT); // 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 frequency = pulseIn(sensorOut, LOW); // Printing the value on the serial monitor Serial.print("R= ");//printing name Serial.print(frequency);//printing RED color frequency Serial.print(" "); delay(100); // Setting Green filtered photodiodes to be read digitalWrite(S2,HIGH); digitalWrite(S3,HIGH); // Reading the output frequency frequency = pulseIn(sensorOut, LOW); // Printing the value on the serial monitor Serial.print("G= ");//printing name Serial.print(frequency);//printing RED color frequency Serial.print(" "); delay(100); // Setting Blue filtered photodiodes to be read digitalWrite(S2,LOW); digitalWrite(S3,HIGH); // Reading the output frequency frequency = pulseIn(sensorOut, LOW); // Printing the value on the serial monitor Serial.print("B= ");//printing name Serial.print(frequency);//printing RED color frequency Serial.println(" "); delay(100); delay(2000); }


سلة المشتريات افراغ السلة