How to Make Colour Sorting Machine
by Mr innovative in Circuits > Arduino
4594 Views, 10 Favorites, 0 Comments
How to Make Colour Sorting Machine
Hello friends here I have made a candy colour sorting machine
Using arduino nano, Nema 17 stepper motor and a TCS3200 Colour sensor
In this project Color sensor detect the color of candy and generate output in this output sensor data transfer to arduino arduino will process those data according to code uploaded in it and command servo to move and sort color candy on basis of there color.
For this project I have build a Custom PCB and order it from JLCPCB.COM
JLCPCB.COM offer very great price for PCB like only 2$ for 10PCB and no extra cost for colour PCB
How to Get PCB Cash Coupon: https://bit.ly/2GMCH9w
Video
In this video you can watch the complete details of the project
Components Required
Arduino nano :- https://amzn.to/2ETAVlF
Nema 17 stepper motor :- https://amzn.to/2Xrqw87
TCS2300 Colour sensor :- https://amzn.to/2EU0nYp
Micro servo :- https://amzn.to/2EU0nYp
20x20 Alu. profile :- https://amzn.to/2EU0nYp
A4988 Driver module :-https://amzn.to/2Wp84Ah
MDF Board
Plexiglass
Connect the circuit as shown in the drawing,
TCS3200 can be connect to arduino in multiple ways you can change the circuit as per your convenient
Basics of Color Sensor TCS230,3200
The TCS230 programmable color light-to-frequency converter combines configurable silicon photodiodes and
a current-to-frequency converter on single monolithic CMOS integrated circuit.
The output is a square wave (50% duty cycle) with frequency directly proportional to light intensity (irradiance). The full-scale output frequency can be scaled by one of three preset values via two control input pins. Digital inputs and digital output allow direct interface to a microcontroller or other logic circuitry.
Output enable (OE) places the output in the high-impedance state for multiple-unit sharing of a microcontroller input line. The light-to-frequency converter reads an 8 x 8 array of photodiodes. Sixteen photodiodes have blue filters, 16 photodiodes have green filters,
16 photodiodes have red filters, and 16 photodiodes are clear with no filters. The four types (colors) of photodiodes are interdigitated to minimize the effect of non-uniformity of incident irradiance. All 16 photodiodes of the same color are connected in parallel and which type of photodiode the device uses during operation is pin-selectable. Photodiodes are 120 µm x 120 µm in size and are on 144-µm centers.
Final Step (Loading Code & Sensor Data Study)
Before going further we must know what vale will sensor gives when different colors are take in fornt of the sensor
So first wire the sensor and arduino as shown in picture you may skip to attache those servo at this point of time. Load the code attached here to your arduino board open the serial monitor
You are getting some value like R= ** G= ** B= ** ** are any numbers now bring color sheet in front of the sensor you will see the RGB numbers are change and keeps repeating as soon as you keep that color sheet in front of that sensor.
you will get different set of RGB numbers for different, so it is clear that sensor detect different colors and gives different value. now we have to write down the RGB value for the color which are going to use in project for example when i bring YELLOW color in front of sensor i get
R=22 G=29 B=32
so i can say that
if (R>17 & R<27 & G>25 & G<34)
COLOR=YELLOW;
here i kept margin of +-5 for RGB values to compensate the fluctuate sensor values. in this way take the readings of different colors which you need to use and add those values in code at this place
if(R<25 & R>15 & G<33 & G>23) {color = 1; // YELLOW }
if(R<55 & R>45 & G<49 & G>39) {color = 2; // GREEN }
if(R<70 & R>60 & G<10 & G>20){color = 3; // PINK }
if(R<7 & R>11 & G<21 & G>35){color = 4; // Red and upload the code connect the both servos fix all the required components load the color candy in tube and your machine is ready to short the candy of different colors.