in

Colour Sorting Machine Project

Arduino with Colour sensor

Welcome to the quanta project, In this project, we are going to make a color sorting machine with the help of Arduino and color sensor tcs3200. In this video, we will learn about the TCS3200 sensor and its interfacing with the Arduino. nowadays we are using the color sorting machine in the industry to differentiate the product in the production and it can sense many colors. but we will detect only the three colors. to learn the basics of the machine and sensor read the full article carefully and follow the given instructions. 

In the color sorting machine we use the tcs3200 sensor which is capable to detect the green, red and blue color because of its photodiode use in the sensor. By specifically picking the photodiode channel’s readings, you’re ready to recognize the force of the various hues. The sensor has a current-to-recurrence converter that changes over the photodiodes’ readings into a square wave with a recurrence that is relative to the light force of the picked shading. This recurrence is at that point, read by the Arduino

To choose the filter read by the photodiode, you utilize the control pins S2 and S3. As the photodiodes are associated in parallel, setting the S2 and S3 LOW and HIGH in various mixes enables you to choose distinctive photodiodes. Investigate the table beneath:

Photodiode typeS2S3RedLOWLOWBlueLOWHIGHNo filter (clear)HIGHLOWGreenHIGHHIGH

Frequency scaling

Pins S0 and S1 are used for scaling the output frequency. It can be scaled to the following preset values: 100%, 20% or 2%. Scaling the output frequency is useful to optimize the sensor.

Output frequency scalingS0S1Power downLL2%LH20%HL100%HH

For the Arduino, it is common to use a frequency scaling of 20%. So, you set the S0 pin to HIGH and the S1 pin to LOW.

Components Required to Make color sorting machine:- 

1.Arduino Uno

2.Colour sensor tcs3200

3.Servo motor

4.Jumper Wires

Code for color sorting machine:- 

#define S0 4

#define S1 5

#define S2 6

#define S3 7

#define sensorOut 8// Stores frequency read by the photodiodes

int redFrequency = 0;

int greenFrequency = 0;

int yellowFrequency = 0;

int transparentFrequency = 0;

void setup() {

  // Setting the outputs

  pinMode(S0, OUTPUT);

  pinMode(S1, OUTPUT);

  pinMode(S2, OUTPUT);

  pinMode(S3, OUTPUT);

 

  // Setting the sensorOut as an input

  pinMode(sensorOut, INPUT);

 

  // Setting frequency scaling to 20%

  digitalWrite(S0,HIGH);

  digitalWrite(S1,LOW);

 

   // Begins serial communication

  Serial.begin(9600);

}

void loop() {

  // Setting RED (R) filtered photodiodes to be read

  digitalWrite(S2,LOW);

  digitalWrite(S3,LOW);

 

  // Reading the output frequency

  redFrequency = pulseIn(sensorOut, LOW);

 

   // Printing the RED (R) value

 

 

  // Setting GREEN (G) filtered photodiodes to be read

  digitalWrite(S2,HIGH);

  digitalWrite(S3,HIGH);

 

  // Reading the output frequency

  greenFrequency = pulseIn(sensorOut, LOW);

 

  // Printing the GREEN (G) value  

 

 

  // Setting BLUE (B) filtered photodiodes to be read

  digitalWrite(S2,LOW);

  digitalWrite(S3,HIGH);

 

  // Reading the output frequency

  yellowFrequency = pulseIn(sensorOut, LOW);

 

  // Printing the BLUE (B) value

 

 

 

if(yellowFrequency<=130)

{

  Serial.println(”   Yellow Colour”);

  delay(500);

 

  }

else if(greenFrequency<=700)

{

  Serial.println(”   Green Colour”);

  delay(500);

 

  }

  else if(  redFrequency>=370 &&  redFrequency<=430)

{

  Serial.println(”   Red Colour”);

  delay(500);

 

  }

  else

 

 

  {Serial.println(”   No Colour”);

  delay(500);

   

    }

}

You can learn here the whole process of making the machine 

What do you think?

0 points
Upvote Downvote

Written by shahid

Automatic door open project using PIR

Single Axis Solar Tracker using Arduino