Professional Documents
Culture Documents
Workpiece Classification Using Robot Arm and Computer Vision
Workpiece Classification Using Robot Arm and Computer Vision
GRADUATION THESIS
MAJOR: INDUSTRIAL INFORMATICS
THESIS TITLE:
Da Nang, 07/2022
REVIEWER’S COMMENT
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
SUPERVISOR’S COMMENT
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
ABSTRACT
The thesis was carried out in Oanh Vu Electronics Co., Ltd. The project aims to
build a robotics system combined with computer vision to classify workpieces on the
conveyor, effectively improving productivity. The thesis focuses on the study of robot
arms that pick up moving workpieces on the conveyor and classify them according to
selected criteria.
The contents of the thesis include the research and design of a simple robot arm
that picks up workpieces moving on a conveyor based on pre-existing requirements,
using Arduino to control and classify workpieces based on color through the image
processing program on the laptop.
i
DANANG UNIVERSITY
UNIVERSITY OF SCIENCE AND SOCIALIST REPUBLIC OF VIET NAM
TECHNOLOGY Independence – Freedom - Happiness
FACULTY OF ADVANCED
SCIENCE AND TECHNOLOGY
ii
- Robot arm detailed drawing
- System model drawing
6. Supervisors:
NGUYEN Le Hoa, Dr.
Faculty of Advanced Science and Technology, University of Science and
Technology - The University of Danang, Vietnam.
LE Van Day, Engineer
CEO, Oanh Vu Electronics Co., Ltd.
7. Date of assignment: 7/3/2022
8. Date of completion: 5/7/2022
iii
ACKNOWLEDGEMENT
With the permission of the leadership of Oanh Vu Electronics Co., Ltd as well as
the Faculty of Advanced Science and Technology, The Danang University - University
of Science and Technology, we had the chance to practice doing a graduation project at
Oanh Vu Electronics Co., Ltd and this is a valuable opportunity for us to work in a
professional environment of enterprises and apply the theoretical knowledge of the
major into practice. Below is the graduation internship report, the result of studying at
Oanh Vu Electronics Co., Ltd.
We would like to say many thanks to all employees and managers in Oanh Vu
Electronics Co., Ltd and our supervisor, Dr. Nguyen Le Hoa for the help and enthusiastic
instruction during our internship.
Thank you sincerely!
iv
COMMITMENT
Students
Truong Thi Mai Hue Nguyen Van Anh Quan Phan Chi Vu
v
TABLE OF CONTENTS
ABSTRACT .....................................................................................................................i
GRADUATION PROJECT REQUIREMENTS............................................................ ii
ACKNOWLEDGEMENT ..............................................................................................iv
COMMITMENT .............................................................................................................v
TABLE OF CONTENTS ...............................................................................................vi
LIST OF TABLES ...................................................................................................... viii
LIST OF FIGURES ........................................................................................................ix
LIST OF ABBREVIATIONS ......................................................................................xi
Chapter 1. PROJECT OVERVIEW ............................................................................1
1.1. Introduction ..........................................................................................................1
1.2. Related research....................................................................................................2
1.3. Research objective ................................................................................................3
Chapter 2. DESIGN A CLASSIFICATION SYSTEM USING ROBOT ARM AND
COMPUTER VISION .....................................................................................................4
2.1. System overview ..................................................................................................4
2.2. Workpiece selection and design ...........................................................................4
2.3. Conveyor selection ...............................................................................................5
2.4. Robot arm design ..................................................................................................6
2.4.1. Robot arm structure selection ................................................................ 6
2.4.2. Kinematics problem ...............................................................................8
a) Denavit - Hertenberg representation ................................................................ 8
b) Forward kinematics ........................................................................................10
c) Inverse kinematics .......................................................................................... 11
2.4.3. Transmission system selection for rotational joints ............................ 13
2.4.4. End-effector selection ..........................................................................13
2.4.5. Material and dimension selection ........................................................16
2.5. Control circuit design .........................................................................................18
2.5.1. Central processing block .....................................................................18
2.5.2. Communication block..........................................................................19
a) UART communication ...................................................................................19
b) I2C communication ........................................................................................19
2.5.3. Power supply block .............................................................................20
vi
a) Power supply for Arduino ..............................................................................20
b) Power supply for geared motor and solenoid valve .......................................21
c) Power supply for servo and vacuum pump ....................................................22
2.5.4. Capacity block .....................................................................................23
a) Servo control capacity block ..........................................................................23
b) Geared motor control capacity block ............................................................. 23
c) Vacuum pump and solenoid valve control capacity block............................. 24
2.5.5. Complete control circuit schematic .....................................................25
2.6. Camera selection ................................................................................................28
2.7. Complete model of the system ...........................................................................28
Chapter 3. CONTROL ALGORITHM .....................................................................29
3.1. The main idea .....................................................................................................29
3.2. Image processing algorithm ...............................................................................29
3.3. Robot arm control algorithm ..............................................................................33
Chapter 4. EXPERIMENTAL RESULTS AND EVALUATION ........................... 35
4.1. Experimental results ...........................................................................................35
4.1.1. Control circuit ......................................................................................35
4.1.2. Robot arm ............................................................................................ 36
a) Joint movement .............................................................................................. 36
b) Impact of vacuum gripper ..............................................................................36
c) Robot arm control ........................................................................................... 37
4.1.3. Workpiece detection algorithm ........................................................... 38
4.1.4. Classification system model ................................................................ 39
4.2. Experimental evaluation .....................................................................................41
4.2.1. Operation of control circuit .................................................................41
4.2.2. Operation of robot arm ........................................................................41
a) Movement range and end-effector impact .....................................................41
b) Robot arm control .......................................................................................... 41
4.2.3. Workpiece detection algorithm ........................................................... 41
4.2.4. Operation of classification system model ............................................41
CONCLUSION .............................................................................................................42
REFERENCES ..............................................................................................................44
APPENDIX .....................................................................................................................1
vii
LIST OF TABLES
viii
LIST OF FIGURES
Figure 1.1. Project " Thiết kế và chế tạo cánh tay robot phân loại sản phẩm sử dụng xử
lý ảnh " by UD - DUT students .......................................................................................2
Figure 1.2. Project "Thiết kế và chế tạo cánh tay robot 3 bậc tự do ứng dụng trong phân
loại sản phẩm bằng xử lý ảnh" by UD - DUT students ...................................................2
Figure 1.3. Functional block diagram of the system .......................................................3
Figure 2.1. Shape and size of the workpiece design .......................................................4
Figure 2.2. Shape and size of the workpiece container ...................................................5
Figure 2.3. Conveyor with geared motor 370L 24VDC..................................................6
Figure 2.4. Some popular robot arm structures ............................................................... 7
Figure 2.5. The overall structure of the robot arm ..........................................................7
Figure 2.6. Modeling links and joints in terms of Denavit - Hartenberg ........................8
Figure 2.7. Identify the coordinate system for the robot arm ..........................................9
Figure 2.8. Procedure for calculating inverse kinematics .............................................11
Figure 2.9. Solve inverse kinematics problem by geometric method ........................... 12
Figure 2.10. MG996R servo .......................................................................................... 13
Figure 2.11. SG90 servo ................................................................................................ 14
Figure 2.12. ZPT vacuum pad .......................................................................................15
Figure 2.13. Vacuum pump PYP-370 and solenoid valve YQK513 ............................ 15
Figure 2.14. Absorbing workpiece process description ................................................16
Figure 2.15. Releasing workpiece process description .................................................16
Figure 2.16. Kinematic parameters of the robot arm ....................................................17
Figure 2.17. 3D model of the robot arm ........................................................................17
Figure 2.18. Control circuit block diagram ...................................................................18
Figure 2.19. Arduino Nano ............................................................................................ 18
Figure 2.20. LCD 1602 and I2C communication converter module ............................. 20
Figure 2.21. Adapter 5VDC - 1A ..................................................................................21
Figure 2.22. Adapter 24VDC - 2A ................................................................................21
Figure 2.23. LM2596 Module .......................................................................................22
Figure 2.24. Schematic of servo control capacity block ...............................................23
Figure 2.25. Schematic of geared motor capacity block ...............................................23
Figure 2.26. Schematic of vacuum pump and solenoid valve control capacity block ..24
Figure 2.27. Complete control circuit schematic .......................................................... 25
Figure 2.28. PCB design of the control circuit .............................................................. 26
ix
Figure 2.29. 3D model of the control circuit .................................................................27
Figure 2.30. Shape and size of the control box design ..................................................27
Figure 2.31. Webcam Logitech C310............................................................................28
Figure 2.32. 3D model of classification system ............................................................ 28
Figure 3.1. Algorithm of image processing ...................................................................30
Figure 3.2. Algorithm of workpiece detection .............................................................. 31
Figure 3.3. Image in RGB (left) and HSV (right) color space ......................................31
Figure 3.4. Binary image ............................................................................................... 32
Figure 3.5. Binary image after morphological transformation ......................................32
Figure 3.6. Contour and center coordinates of colored region distinguished ...............32
Figure 3.7. Algorithm of robot control ..........................................................................33
Figure 3.8. Algorithm of robot control for lifting and moving the workpiece ..............34
Figure 4.1. Actual system model ...................................................................................35
Figure 4.2. Actual control circuit ..................................................................................35
Figure 4.3. Actual robot arm model ..............................................................................36
Figure 4.4. Absorbing process of robot arm ..................................................................37
Figure 4.5. Feature extraction by detection processing .................................................38
Figure 4.6. LCD screen displays data from the system .................................................40
Figure 4.7. Workpiece data in database.........................................................................40
x
LIST OF ABBREVIATIONS
Abbreviations Explanations
OpenCV Open Source Computer Vision Library
DOF Degrees Of Freedom
I2C Inter-Integrated Circuit
UART Universal Asynchronous Receiver-Transmitter
LCD Liquid Crystal Display
RGB Red, Green, Blue
HSV Hue, Saturation, Value
PID Proportional Integral Derivative
xi
Workpiece classification system using robot arm and computer vision
1.1. Introduction
Currently, robotics systems are increasingly developing and playing an important
role in the industry. They include complex and advanced technologies from many fields
such as sensors, mechanics, electronics, automatic control, computer science and
artificial intelligence. Therefore, this is a high-tech industry that influences the future
development of mankind.
Robot arms are used in automated production lines ranging from heavy industries
such as automobile manufacturing to the sorting of consumer products. This is
considered a future labor tool, the main workforce in all fields. Robots greatly assist
humans in production, especially in harsh environments with many toxic and dangerous
substances. Currently, in the world, many new types of robots have appeared, marking
a breakthrough development in this field, helping large enterprises increase sales by
reducing human resources, production costs and increasing productivity.
Therefore, the current trend of education in universities is to promote research
into more advanced technologies in the field of robotics, to approach the robotics
industry of countries that thrive in this industry.
Along with the development of the robotics industry, computer vision is also an
area that is considered to be the trend of the future. Essentially, these systems include
acquiring, processing, and interpreting image-related data for several specific
applications. Computer vision is considered as the eyes of robots, making them easier
and more flexible to operate, helping to handle complex tasks, improving labor
productivity, and reducing dangers to humans.
The combination of computer vision and robotics in the workpiece classifying
systems is being increasingly promoted. These workpiece classification systems can
recognize and classify different objects based on color, shape, size, etc. Using images
from the camera, conducting analysis and processing helps extract useful information
for robots, helping them to execute specific tasks. Thence, we can see that the
programming, control, calculation, image processing and communication between the
computer and the robot are extremely necessary and important.
Figure 1.1. Project " Thiết kế và chế tạo cánh tay robot phân loại sản phẩm sử dụng
xử lý ảnh " by UD - DUT students [1]
Figure 1.2. Project "Thiết kế và chế tạo cánh tay robot 3 bậc tự do ứng dụng trong
phân loại sản phẩm bằng xử lý ảnh" by UD - DUT students [2]
Truong Thi Mai Hue
Nguyen Van Anh Quan
Phan Chi Vu Supervisor: Dr. Nguyen Le Hoa 2
Workpiece classification system using robot arm and computer vision
We can calculate the conveyor’s stable speed using the following formula:
Croller shaft × Sroller shaft
Vconveyor = (cm/s) (2.1)
60
In which,
- Croller shaft : Perimeter of roller shaft [cm]
- Sroller shaft : Rotation speed of roller shaft [RPM]
When the workpiece is placed on the conveyor, because the weight of the
workpiece is extremely small (5g), insignificant compared to the conveyor’s weight, it
can be considered that the conveyor’s speed is the speed of the workpiece.
2.4. Robot arm design
The design of the robot arm should take into account the characteristics of the
system, specifically the operating space, reach and load capacity. The target is to build
a robot arm for the purpose of classifying workpieces on the conveyor along with the
parameters of the workpiece and conveyor which are selected above.
2.4.1. Robot arm structure selection
A workpiece classification system needs fast processing speed, workpieces are
on dynamic conveyors so the robot arm requires flexible handling capabilities, and at
the same time achieves high accuracy.
With the requirements of the research, the robot arm needs an essential quantity
of DOF to accommodate the handling. However, the more DOF, the more complex the
design process as well as the investment cost increase. We need to strike a balance
between these two factors.
Here are some popular robot structures:
a) b)
c) d)
Figure 2.4. Some popular robot arm structures
Thereby, the robot with structure c), a spherical robot is chosen as the foundation
for the design.
For the convenience of the purpose of picking workpieces on the conveyor, we
have chosen an overall structure of the robot arm with 4 rotational joints which ensure
that the last link is always in the direction perpendicular to the conveyor surface.
2. Joint twist θi is the angle between the X i−1 - axis and the X i - axis measured
around the Zi−1 - axis. The positive direction is determined by the right-hand
rule.
To perform the Denavit - Hertenberg representation, we proceed to set up the
coordinate frame on the selected robot arm as follows:
- Select O0 x0 y0 z0 coordinate frame has O0 located at the center of joint axis 1.
- The z0 - axis has the same direction as joint axis 1.
- The z1 - axis has the same direction as joint axis 2.
Since joint axis 1(z0 ) và joint axis 2(z1 ) are perpendicular and intersect so O1 is
located at the intersection of these two joints axis.
- The direction of the x1 - axis is selected by the product of the vector + (z⃗⃗⃗0 × ⃗⃗⃗
z1 ).
- O1 x1 y1 z1 translates along the z0 - axis a distance of d1 relative O0 x0 y0 z0 .
- Select the x0 - axis in the same direction as the x1 - axis.
- The y0 - axis and the y1 - axis are chosen according to the right-hand rule.
- O2 x2 y2 z2 translates along the x1 - axis a distance of a2 .
- O3 x3 y3 z3 translates along the x2 - axis a distance of a3 .
- O4 x4 y4 z4 is placed at the end point of the end-effector and is a distance of a4
away from the center of joint axis 4.
Figure 2.7. Identify the coordinate system for the robot arm
From the built coordinate system, we get the Denavit - Hertenberg table as below.
b) Forward kinematics
Forward kinematics is the problem of finding the end-effector position and
orientation from the specified values of joints (𝜃1 , 𝜃2 , 𝜃3 , 𝜃4 , 𝜃5 , 𝜃6 … ) → (x, y, z, α,
β, γ…).
After representing Denavit - Hartenberg, we have the transformation matrices:
i−1
Ai = Rot z (θ)Transz (d)Transx (a)Rot x (α)
cosθi −sinθi 0 0 1 0 0 0 1 0 0 ai 1 0 0 0
sinθi cosθi 0 0 0 1 0 0 0 1 0 0 0 cosαi −sinαi 0
= [ ][ ][ ][ ]
0 0 1 0 0 0 1 di 0 0 1 0 0 sinαi cosαi 0
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
cosθ −sinθ cosα sinθ sinα a cosθ (2.2)
sinθ cosθ cosα −cosθ sinα a sinθ
= [ ]
0 sinα cosα d
0 0 0 1
From this we can calculate the homogeneous transformation matrix for the robot
arm:
0
Tn = 0 A1 1 A2 3 A3 … n−1
An (2.3)
Thus, after obtaining the Denavit - Hartenberg paramete defined in Table 2.2.
above, we can calculate the transformation matrices for each link as follows:
Notation: cos(θi ) = ci , sin(θi ) = si , cos(θi + θj ) = cij , sin(θi + θj ) = sij
c1 0 s1 0 c2 −s2 0 a 2 c2
0 s 0 −c1 0 1 s c2 0 a2 s2
A1 = [ 1 ] A2 = [ 2 ]
0 1 0 d1 0 0 1 0
0 0 0 1 0 0 0 1
c3 −s3 0 a3 c3 −s23 c23 0 −a4 s23
2 s c3 0 a3 s3 3 −c −s23 0 −a4 c23
A3 = [ 3 ] A4 = [ 23 ]
0 0 1 0 0 0 1 0
0 0 0 1 0 0 0 1
c1 c2 −c1 s2 s1 a2 c2 c1
s c −s1 s2 −c1 a2 c2 s1
⇒ 0 A2 = 0 A1 1 A2 = [ 1 2 ]
s2 c2 0 a2 s2 + d1
0 0 0 1
c1 c23 −c1 s23 s1 c1 (a2 c2 + a3 c23 )
s c 3 −s1 s23 −c1 s1 (a2 c2 + a3 c23 )
⇒ 0 A3 = 0 A1 1 A2 2 A3 = [ 1 2 ]
s23 c23 0 d1 + a2 s2 + a3 s23
0 0 0 1
0 c1 s1 c1 (a2 c2 + a3 c23 )
0 s1 −c1 s1 (a2 c2 + a3 c23 )
⇒ 0 T4 = 0 A3 3 A4 = [ ]
−1 0 0 d1 − a4 + a2 s2 + a3 s23
0 0 0 1
0
From the homogeneous transformation matrix T4, we can know where the end-
effector point is:
O4 (c1 (a2 c2 + a3 c23 ), s1 (a2 c2 + a3 c23 ), d1 − a4 + a2 s2 + a3 s23 )
c) Inverse kinematics
Inverse kinematics is the problem of determining the joint angles when knowing
the position of the end-effector (x, y, z, α, β, γ…) → (𝜃1 , 𝜃2 , 𝜃3 , 𝜃4 , 𝜃5 , 𝜃6 … ).
The complexity of the inverse kinematics problem increases as the number of
DOF increases.
To solve the inverse kinematics problem, two main methods are used, that is the
geometric method (if the robot has a special configuration) or the algebraic method
(using transformations to give the equation of joint variables).
Here is the procedure for calculating inverse kinematics for the robot arm:
Assume the point the robot arm wants to reach has coordinates (𝑃𝑥 , 𝑃𝑦 , 𝑃𝑧 )
Pz − d1 + a4 a3 . sin(|θ3 |)
= arcsin + arctan ( )
a2 + a3 cos(θ3 )
√Px 2 + Py 2 + (Pz − d1 + a4 )2
( )
MG996R servo has a stall torque of 9.4 kg-cm, which means the servo can
withstand a load of 9.4kg at a distance of 1 cm from the center of the servo’s shaft.
When the distance is doubled, the weight of the load is halved.
Since the weight of the workpiece is quite small (approximately 5g), the load
acting on the servo is mainly the links of the robot arm. This is the main factor in
choosing the material of the links to ensure the load capacity of the selected servo motor.
2.4.4. End-effector selection
The end-effector, known as the gripper, is the part that directly performs the work
of the robot arm.
The requirements of the gripper of the robot arm are not too demanding on the
movement mechanism, but it is necessary to ensure some factors such as gripping the
right workpiece, holding it firmly but not damaging the workpiece, in addition, it also
needs to be compact and quickly impact.
With the rectangular-box shape of the workpiece, we chose a vacuum gripper
with a rotational wrist to orient the workpiece.
SG90 servo is selected to create a circular motion for the gripping wrist.
Because the wrist part only bears the load from the gripper and the workpiece,
there is no need for large stall torque like other rotational joints of the robot.
The gripper is made up of a vacuum pad combined with a solenoid valve and a
vacuum pump. The lifting force of the vacuum gripper can be found by equation:
F=P×A (2.4)
In which,
- F: The weight of the objects [kg] multiplied by the safety factor (A safety factor
of 2 is recommended when the pad face is in a horizontal position)
- P: The vacuum pressure [bar]
- A: The area of the vacuum pad measured [cm2]
With a circular vacuum pad:
2 mworkpiece = P × πr 2 , mworkpiece = 5g
This is the basis to choose the following components:
Based on the number of devices that need to be controlled and the basic
parameters of the Arduino Nano, it is a perfect choice.
2.5.2. Communication block
a) UART communication
Arduino and laptop communicate with each other via the UART protocol.
Arduino Nano has the built-in IC CH340 to convert USB - UART, so to transmit and
receive data between these 2 devices, we can use a USB cable.
b) I2C communication
Workpiece classification results will be displayed on LCD 1602. This LCD is
capable of displaying several types of characters (text, number, or graphic characters),
easy to put into an application circuit, consumes very little system resources, and has a
low cost.
To connect easily and avoid occupying many pins of the Arduino, we have
chosen an I2C communication converter module that supports LCD connected to the
microcontroller via I2C communication.
Adapter 5VDC - 1A is used quite a lot for multiple devices such as network
modems, converters, or power supplies for microcontrollers. With a compact design
along with a high-quality current drop protection circuit, it is suitable for powering
devices and extending their lifespan.
- When the signal of these two pins is opposite, the motor runs in a certain direction
(for example, when INA level 1 and INB level 0, run in the forward direction and
vice versa).
- In this project, we only need the conveyor to rotate in a certain direction, so we
fixed the INB pin to always be at 0, then put the PWM control pin on the Arduino
into the INA to control the geared motor with the pulse width modulation method,
thereby we can control the speed of the conveyor.
- Similar to the servo control power block, when there is a control signal, the INA
pin will be pulsed to control the desired motor speed.
c) Vacuum pump and solenoid valve control capacity block
Figure 2.26. Schematic of vacuum pump and solenoid valve control capacity block
- Phototransistors PC817 (U4, U11) are inserted to isolate the 5VDC supply for
Arduino and the 5VDC, 24VDC supply of the LM2596, avoiding the
phenomenon that when the pump or the valve is operating, the generated current
is quite large, causing interference with the Arduino.
Truong Thi Mai Hue
Nguyen Van Anh Quan
Phan Chi Vu Supervisor: Dr. Nguyen Le Hoa 24
Workpiece classification system using robot arm and computer vision
- When there is a control signal from the Arduino, resistors R5 and R17 have the
function to limit the current through the LED inside U4 and U11, making these
LEDs operate. At that time, the light detector makes the BJT inside U4 and U11
conduct. Thereby, resistors R6 and R18 limit the current through Q3 and Q4 BJT
and conduct the RL2 and RL4 relays, so the pump and the valve can operate.
- LED D5 and D7 help notify if there is a control signal.
- Diodes D6 and D8 consume the electromagnetic induction current generated by
the coil in the relay when the relay loses power, which help to protect the BJT
from this current.
2.5.5. Complete control circuit schematic
- 5 and 6 digital pinouts have the function to control the vacuum pump and the
solenoid valve.
- 7, 8, 9 and 10 digital pinouts are responsible for controlling the servo attached to
the robot arm.
- 11 PWM pinout is used to control the speed of the geared motor by the pulse
width modulation method.
- TX and RX pinouts help the Arduino to communicate with the laptop by UART
communication.
- LCD is controlled through I2C communication converter module, connecting
SDA, SCL pins to A4, A5 analog pinouts.
- The power supply block consists of two separate blocks:
+ 24VDC supply from Adapter 24VDC - 2A which powers the geared motor
controlling the conveyor, the solenoid valve and 5VDC from LM2596 module supplies
for servos and the vacuum pump.
+ 5VDC supplies for Arduino from Adapter 5VDC - 1A.
Below are the pictures of the PCB design and 3D model of the control circuit.
If no workpiece is detected, the laptop sends a command to control the robot arm
to its original position, called the ‘Home’ command.
Figure 3.3. Image in RGB (left) and HSV (right) color space
- Create a corresponding mask for each range selected color. After this step, the
image is binarized, the desired color is assigned a value of 1, and the remainder
of the image is assigned a value of 0.
Figure 3.8. Algorithm of robot control for lifting and moving the workpiece
From the received coordinates of the workpiece, Arduino calculates the value of
joint variables of the robot arm after solving the inverse kinematics problem in Section
2.4.2 above.
Next, we calculate the time for the robot arm to move from the current position
to the position where the workpiece is detected (t robot_motion ). This time is equal to the
angle at which the robot arm rotates divided by the speed of each joint.
So if the robot arm moves to the position where the workpiece is deteced, the
workpiece has moved to a new position ynew = t robot_motion × vworkpiece as the
conveyor only moves in a certain direction (y-axis), the x-axis and z-axis coordinates of
the workpiece are unchanged.
Arduino controls the robot arm to the new position of the workpiece and then
proceeds to lift it at the time t = t robot_motion , then control the gripper to rotate the wrist
based on the tilt angle of the workpiece and move it to the corresponding workpiece
container.
After designing and building the algorithm for the workpiece classification
system model, we conduct experiments to test the system and evaluate the obtained
results.
4.1. Experimental results
The actual system model that we have built is shown in Figure 4.1. below.
From Table 4.2, the average error for each axis is:
̅̅̅̅̅̅̅̅ ∑5i=1|∆ePx |
|∆ePx | = = 0.88 (cm)
5
̅̅̅̅̅̅̅̅ ∑5i=1 |∆ePy |
|∆ePy | = = 0.58 (cm)
5
̅̅̅̅̅̅̅̅ ∑5i=1|∆ePz |
|∆ePz | = = 0.36 (cm)
5
4.1.3. Workpiece detection algorithm
The workpiece is fixed on the conveyor, then use a ruler to measure the initial
position of the center of the workpiece in the x and y axes, then start running the program
to identify the color, the coordinates of the center, and the tilt angle of the workpiece
and convert the detection coordinates to the robot coordinates to check the implemented
algorithm and the accuracy of the received data.
Orientation angle
1 1 2 1 0 0
error (°)
The data of the workpiece which the system has successfully classified is saved
to the database.
CONCLUSION
1. Achieved results
- Successfully build a model of the workpiece classification system by color using
a robot arm and computer vision.
- Successfully design control circuit for stable operation.
- Successfully design and built a 4-DOF robot arm with vacuum gripper.
- Control the robot arm to a given position according to inverse kinematics with an
error of less than 9 mm.
- Apply image processing techniques to detect and extract features of workpieces.
- Display system data on the LCD screen.
- Store the workpiece data after classifying into the database.
- The model's workpiece classification rate is quite high, approximately 84% in
different lighting conditions.
2. Limitation
- The mechanical design of the robot arm is not completed.
- The robot arm's dynamic model has not been considered yet.
- The movement time of the robot arm is long because the servos are controlled
sequentially, which leads to the system classification speed is not high.
- The classification is only limited to the color criteria of the workpiece with 3
certain colors: Red, Blue, and Green.
- The measurement of the robot's parameters is carried out with a ruler, so the
accuracy is not high.
- There is no user interface for the system model.
3. Orientations of development
- Consolidate the structure of the robot arm by replacing the mica acrylic plastic
material with a metal material.
- Build the dynamic model to increase the accuracy in designing and controlling
the robot arm.
- Build an algorithm to control servos at the same time to increase the classification
efficiency of the system.
- Stable the conveyor’s speed by PID and Fuzzy PID controller.
Truong Thi Mai Hue
Nguyen Van Anh Quan
Phan Chi Vu Supervisor: Dr. Nguyen Le Hoa 42
Workpiece classification system using robot arm and computer vision
REFERENCES
[1] Lương Thế Phi, Huỳnh Minh Lựu, Thiết kế và chế tạo cánh tay robot phân loại sản
phẩm sử dụng xử lý ảnh. Da Nang: The University of Danang - University of Science
and Technology, 2019.
[2] Đặng Hữu Tuyến, Bùi Đăng Quân, Thiết kế và chế tạo cánh tay robot 3 bậc tự do
ứng dụng trong phân loại sản phẩm bằng xử lý ảnh. Da Nang: The University of Danang
- University of Science and Technology, 2019.
[3] John J. Craig, Introduction to Robotics - Mechanics and Control, 3rd ed. London:
Pearson Education International, 2005.
[4] Nguyễn Trường Thịnh, Giáo trình kỹ thuật Robot. Ho Chi Minh: Hochiminh
National University Publishing House, 2014.
[5] Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani, Giuseppe Oriolo, Robotics:
Modelling, Planning and Control. New York: Spinger, 2008.