You are on page 1of 10

Sorting of Objects Based on Color by Pick-and-Place

Robotic Arm with Conveyor Belt

Submitted to the Faculty of the


Department of Computer and Electronics Engineering
College of Engineering and Information Technology
Cavite State University
Indang, Cavite

In partial fulfillment
of the requirements for
ECEN 90
(Industrial Electronics)

Submitted to:
Engr. Cenon Lumabad III

Submitted by:
Barcas, Maevielyn
Febrer, Shairelle Anne
Murillo, Stella Jane
Poniente, John Raphael
Tia, Leahlyne Mae
Vallido, Jamey
BS ECE 4-1
May 22, 2019
Sorting of Objects Based on Color by Pick and Place Robotic
Arm with Conveyor Belt
Hello, readers! We are a group of Electronics and Communications Engineering students and we
are here to show you how to build a color-sorting conveyor belt with pick-and-place robotic
arm. Familiar? Yes! A robotic arm that is capable of sorting objects is not a news in the world of
innovative industry, but it still amazes us how electronics world is capable of doing such things!
Ready to learn how to build it? Keep reading!

Step 1: Theory
In many situations, autonomous robots can provide effective solutions to grueling tasks. In this
case, it is desirable to create an autonomous robot that can identify objects from the conveyor
belt and relocate them if the object meets certain criteria. Dealing with a large number of
objects is a very menial task, this is an excellent application for a robot of this type. In this case,
to keep costs and design complexity low, the robot is designed around the platform and uses
several different sensors to collect information about the robot’s environment to allow the
robot to react accordingly. This project aims at the problem given and we are attempting to
solve this by creating an autonomous robot that can identify objects when placed on the
conveyor belt based on color sensing and then sort by relocating them to a specific location. It
will be using a picking arm which uses a servo motor to pick the particular object from the
conveyor belt and place it according to the color sensing.

Step 2: Materials You’ll Need


Below is the list of materials that we will be using to build this project:

 IR Sensor (1)  Connecting Wires


 RGB Sensor (1)  9V and 3.8V Batteries
 Old Tarp  Arduino uno (2)
 Scrap Wood  DC Motor (1)
 Popsicle Sticks  L298N (1)
 Glue Gun with Glue Sticks  Servo Motor (3)
Step 3: Assembling the Conveyor Belt
Here’s the procedure on how to make your DIY Conveyor Belt:
1. Prepare your scrap woods, old tarpaulin, glue gun and glue stick.
2. Cut the scrap woods into circular forms to make a pulley.
3. Cut the scrap woods in a rectangular shape to make a frame for the conveyor belt. Connect
them using the glue gun.
4. Cut the old tarpaulin to form a conveyor belt.
5. Attach the DC Motor to one of the wheels. It will serve as the main pulley of the conveyor
belt.
Step 4: Assembling the Robotic Arm
Below is the procedure on making the DIY Robotic Arm:
1. Prepare the popsicle sticks, servo motors, glue gun and glue stick.
2. Cut the popsicle sticks according to the design of your choice for the robotic arm. Make sure
it has 3 joints from the base for the robotic arm’s degrees of freedom. Connect them all using
glue gun.
3. Attach the servo motors to the joints or the degrees of freedom.
Step 5: Installing the Sensors
For the RGB sensor:
1. Make a tunnel-like house for RGB sensor using popsicle sticks and secure them using glue
gun.
2. Place the RGB sensor tunnel-like house in the middle part of the conveyor. This will
determine what color is placed on the conveyor to be sorted.

For the IR sensor:


1. Make a mini table-like structure using popsicle sticks. This is where the IR sensor will be put.
2. Place the mini table at the end of the conveyor belt. This will sense if there is an object
coming, notify the microcontroller to make the conveyor stop, and wait for the object to be
picked up by the robotic arm.
3. Secure everything with glue gun.
Step 6: Source Code
Since we used two Arduinos, two different codes are also used for each. The first one is for the
RGB sensor and the servo motors which are installed in the robotic arm. The other code is for
the conveyor belt where the motor and the IR sensor are programmed.
For RGB sensor with servo motors:

//ARDUINO A pinMode(s0, OUTPUT);

//CODE FOR SERVOS AND RGB SENSOR pinMode(s1, OUTPUT);

#include <VarSpeedServo.h> pinMode(s2, OUTPUT);

const int s0 = 8; pinMode(s3, OUTPUT);

const int s1 = 9; pinMode(out, INPUT);

const int s2 =12; pinMode(redLed, OUTPUT);

const int s3 = 11; pinMode(greenLed, OUTPUT);

const int out = 10; pinMode(blueLed, OUTPUT);

// LED pins connected to Arduino digitalWrite(s0, HIGH);

int redLed = 2; digitalWrite(s1, HIGH);

int greenLed = 3; servoBase.attach(3); //Up to 180 deg

int blueLed = 4; servoJoint.attach(4); //Up and down

// Variables servoGrip.attach(5); // Close open

int red = 0; servoBase.write(90, 10, true);

int green = 0; servoJoint.write(50, 10, true);

int blue = 0; servoGrip.write(60, 10, true);

//SERVOS //VOID FUNCTIONS FOR SERVO (BINS)

VarSpeedServo servoBase; void yellowBin(){

VarSpeedServo servoJoint; servoGrip.write(90, 20, true); //open

VarSpeedServo servoGrip; servoJoint.write(100, 20, true); //UP

servoBase.write(16, 20, true);

void setup() servoJoint.write(78, 20, true); //down

{ servoGrip.write(0, 20, true); //close

Serial.begin(9600); servoJoint.write(110, 20, true); //UP


servoBase.write(65, 20, true); //YELLOW BIN servoGrip.write(0, 20, true); //close

servoJoint.write(29, 20, true); //UP servoJoint.write(130, 20, true); //UP

servoGrip.write(90, 20, true); //close servoBase.write(180, 20, true); //RED BIN

} servoJoint.write(100, 20, true); //UP

void redBin(){ servoGrip.write(90, 20, true); //close

servoGrip.write(90, 20, true); //open }

servoJoint.write(100, 20, true); //UP void pinkBin(){

servoBase.write(16, 20, true); servoGrip.write(90, 20, true); //open

servoJoint.write(78, 20, true); //down servoJoint.write(100, 20, true); //UP

servoGrip.write(0, 20, true); //close servoBase.write(16, 20, true);

servoJoint.write(110, 20, true); //UP servoJoint.write(76, 20, true); //down

servoBase.write(94, 20, true); //RED BIN servoGrip.write(0, 20, true); //close

servoJoint.write(28, 20, true); //UP servoJoint.write(110, 20, true); //UP

servoGrip.write(90, 20, true); //close servoBase.write(170, 20, true); //PINK BIN

} servoJoint.write(40, 20, true); //UP

void cyanBin(){ servoGrip.write(90, 25, true); //close

servoGrip.write(90, 20, true); //open }

servoJoint.write(100, 20, true); //UP void loop()

servoBase.write(16, 20, true); {

servoJoint.write(78, 20, true); //down color();

servoGrip.write(0, 20, true); //close Serial.print("R Intensity:");

servoJoint.write(110, 20, true); //UP Serial.print(red, DEC);

servoBase.write(130, 20, true); //CYAN BIN Serial.print(" G Intensity: ");

servoJoint.write(28, 20, true); //UP Serial.print(green, DEC);

servoGrip.write(90, 25, true); //close Serial.print(" B Intensity : ");

} Serial.print(blue, DEC);

void violetBin(){ //Serial.println();

servoGrip.write(90, 20, true); //open if (red >= 8 && red <= 12 && green >= 5 && green
<= 9 && blue >= 4 && blue <= 8)
servoJoint.write(100, 20, true); //UP
{
servoBase.write(16, 20, true);
Serial.println(" - (Cyan)");
servoJoint.write(78, 20, true); //down
digitalWrite(redLed, HIGH); // Turn RED LED ON else if (red >= 8 && red <= 18 && green >= 23 &&
green <= 36 && blue >= 18 && blue <= 29)
digitalWrite(greenLed, LOW);
{
digitalWrite(blueLed, LOW);
Serial.println(" - (Red)");
cyanBin();
digitalWrite(redLed, HIGH); // Turn RED LED ON
}
digitalWrite(greenLed, LOW);
else if (red >= 5 && red <= 12 && green >= 11 &&
green <= 23 && blue >= 7 && blue <= 15) digitalWrite(blueLed, LOW);

{ redBin();

Serial.println(" - (Pink)"); }

digitalWrite(redLed, HIGH); // Turn RED LED ON else{

digitalWrite(greenLed, LOW); Serial.println();

digitalWrite(blueLed, LOW); }

pinkBin(); delay(300);

} digitalWrite(redLed, LOW);

else if (red >= 4 && red <= 8 && green >= 6 && digitalWrite(greenLed, LOW);
green <= 10 && blue >= 9 && blue <= 15)
digitalWrite(blueLed, LOW);
{
}
Serial.println(" - (Yellow)");
void color()
digitalWrite(redLed, HIGH); // Turn RED LED ON
{
digitalWrite(greenLed, LOW);
digitalWrite(s2, LOW);
digitalWrite(blueLed, LOW);
digitalWrite(s3, LOW);
yellowBin();
//count OUT, pRed, RED
}
red = pulseIn(out, digitalRead(out) == HIGH ? LOW :
else if (red >= 19 && red <= 28 && green >= 26 && HIGH);
green <= 33 && blue >= 15 && blue <= 22)
digitalWrite(s3, HIGH);
{
//count OUT, pBLUE, BLUE
Serial.println(" - (Violet)");
blue = pulseIn(out, digitalRead(out) == HIGH ?
digitalWrite(redLed, HIGH); // Turn RED LED ON LOW : HIGH);

digitalWrite(greenLed, LOW); digitalWrite(s2, HIGH);

digitalWrite(blueLed, LOW); //count OUT, pGreen, GREEN

violetBin(); green = pulseIn(out, digitalRead(out) == HIGH ?


LOW : HIGH);
}
} For the Conveyor Belt and IR Sensor:

//ARDUINO B digitalWrite(in2, LOW);

//CODE FOR CONVEYOR AND IR PROXIMITY analogWrite(enA, 54);


SENSOR

// IF IR DETECTS AN OBJECT, STOP


MOTOR A }

// Motor A
void stopMotor(){

//Turn Off MotorA


int enA = 10;
digitalWrite(in1, LOW);
int in1 = 8;
digitalWrite(in2, LOW);
int in2 = 9;
}

void loop(){
//IR Prox Sensor
val = analogRead(sensorpin);
int sensorpin = A0;
Serial.println(val);
int val = 0;
delay(50);

counterClockwise();
void setup()

{ // Set all the motor control pins


to outputs

pinMode(enA, OUTPUT); if (val>= 40 && val<=75){


pinMode(in1, OUTPUT); Serial.println("STOP");
pinMode(in2, OUTPUT); stopMotor();
Serial.begin(9600); delay(15000);
} }
void counterClockwise(){

//Turn On MotorA }
digitalWrite(in1, HIGH);
Step 7: Final Output
After countless of sleepless nights, we are able to finally finish the project. This, we present to
you, our DIY Sorting of Objects Based on Color by Pick and Place Robotic Arm with Conveyor
Belt.

You might also like