The Implementation of Automated Optical Inspection in Printed Circuit Boards
The Implementation of Automated Optical Inspection in Printed Circuit Boards
Jafar Sobhi
Department of Electronic, Faculty of Engineering, Urmia University, Parlar Co,Tabriz, Iran.
In the field of error detection of SMD and DIP elements, The first section: Image Acquisition system
the following researches have been accomplished: a
method was provided by G. Acciani, G. Brunetti and G. a 5 Mpixel CDD camera with high resolution, a 12 mm
Fornarelli in 2006. In this detection, first, the IC image lens and an RGB lighting system has been used- being
and all bases of IC are removed from the board image, shown in figure 1. The working distance of the lighting
through Segmentation. Then, errors are detected by systems from the printed circuit board is 25 mm, the
removing Geometric and Wavelet features as well as distance between the camera and the board surface is 100
neural network training [6]. Fupei Wu and Zhang Xianmin mm. The amount of camera's FOV is 35 * 45 mm. To
proposed a method in 2011 that was used to detect IC cover the surface of the printed circuit board for shooting
errors through a lighting system with Red, Green and Blue an X_Y system was built with conveyor Figure 2.
lights. No Solder ،Surplos Solder ،Lacking Solder ،Lead
Lift ،Lead Left ،Shift ،Bridge ،Pesoudo Joint errors were
detected. The type of error is determined by feature
extraction and segmentation of images and comparing
them with a set threshold values [5]. A method is provided
concerning the error detection in resistors and capacitors
by Xie Hongwei et al. in 2011. The RGB lighting system
was used for the detection; this method, as the previous Figure 1.RGB lighting system
method has used element segmentation. A set of features
is extracted for each segment; due to the high number of
features, the most effective feature as well as a method is
proposed for each segment. Using the decision tree, the
appropriateness or inappropriateness of the segments are
determined. [7] To detect the basic soldering error of DIP
elements, T.S. Yun and colleagues proposed a method in
1999. The method has used the removed features' image to
detect errors and has provided a backup vector for each
type of error through the use of X feature vector. [9] B. C.
Jiang et al. in 2006 proposed a method for error detection
with the removal of printed circuit boards' background and
Figure 2. X-y table and conveyor
the discovery of basic parts through the feature extraction
and comparing it with threshold values. Good Solder,
Open Solder, Bridge, No Solder errors were detected. [8]
The aim of this project is to build a device to detect errors
The second section: Inspection Algorithm
before and after installation of elements on the board. The This section detects errors associated with 1) SMD
device has the ability of error detection glued on the resistance and capacitors, 2) IC SMDs, 3) basic elements
printed circuit board, before the element installation. Also, in the DIP, 4) the detection of glue error on the board, 5)
after mounting elements, the device is capable of error The best path to solve the traveling salesman problem. The
detection for SMD elements and DIP basic elements on following operations are conducted in order to detect
the surface of printed circuit board. Therefore, a software errors in all sections of 1 to 4; image segmentation, feature
is designed to receive the position of elements or segments extraction, feature selection and decision-making. These
of the printed circuit board that need to be inspected by the stages are explained in every segments.
user or through CAD file. Then, the program being based The image of each element is divided into a series of
on the position of defined elements extracts the centers of segments after the removal of the original image of the
shooting points and solving the traveling salesman board. These segments differ based on the type of
problem, it selects the best shooting path for the device. elements and errors. In this study, the segments are
Finally, the device is ready for shooting and error combined according to the type of error being detected for
detection. In the first part, the hardware of the device has the elements. In fact, by combining values of existing
been described. In the second part, the procedures of error properties, we have created fewer features in a way that
detections of elements are mentioned along with their these features have all the basic information in the initial
results. Finally, conclusions and comparisons with other features. In this part of the segment which is an RGB
works are expressed. image, first the desired color is removed from the desired
ranges (red, blue, green and the color of elements) using
the Color Segmentation. A series of removed colors are
IJCSNS International Journal of Computer Science and Network Security, VOL.17 No.6, June 2017 139
used to obtain some information about the error detection, B) Feature Extraction:
this information is called features. Since each image in Features extracted from R1 to R5 segments for the RGB
RGB color space has 3 gray images image in each segment are:
and for each image 3 binary images can be calculated, the 1. The red, blue, green area in every segment
number of features for each segment -taking into account 2. The conjunction of all three colors in the length
the extraction of 10 features- is 30 features (10*3 for each and width of each segment
segment). Thus, the features in this sections are discussed. 3. Calculation of the center of mass of every 3
The issue of feature selection, is one of the issues being colors in each segment
discussed in the context of machine learning and statistical 4. Calculation of the maximum amount of
identification of patterns. This issue is of great importance continuity
in many applications, because there is a large number of 5. The difference between the largest and smallest
features in these applications, many of whom are either gray value for all 3 dimensions in each segment
unused or of little information.[10] It does not create a 6. The average of gray features' design
problem in terms of information if the features are not 7. Average gray images for each 3 dimension
removed, but the computational load for a given 8. Objects' being in the shape of squares and circles
application increases.[10] In addition, it makes a lot of for each 3 dimensions in each binary segment
useless information to be stored along with useful data.
Due to the increase in features, we have attempted to find
the less features with the most effects in the resistance and C) Feature selection for R1 to R5 segments:
capacitance part using genetic multi-objective algorithm The principles for solving this problem follow the same
NSGA-2. general principles stated in the multi-objective genetic
algorithms [13] [14]. Here, we just refer to the methods
A) Resistance and SMD capacitors used in the project and explain the steps involved in the
The elements of this group have two bases on the sides project as well as the way of performing these steps.
and the element is placed in the middle of the pad. Figure Encoding of feature selection is a binary encoding that
3 shows the way of segmentation of SMD capacitor's pads, aims at converting the answer to a series of binary
body of the element and sides of the element. To detect numbers (in binary). Crossover in the feature selection: 1.
errors in the group first as shown in Figure 3. Each base is Single Point Crossover method, 2. Double Point Crossover
divided into a series of segments. The features mentioned method and 3. Uniform Crossover method are selected.
in the section on feature extraction are extracted in the Production phase of the initial population: according to the
section feature extraction, are extracted for each of the type of encoding system, the chromosomes of the initial
segments of R1 to R5. Due to the large number of features population are produced for the searching. The number of
and segments for detection, the best (most effective) the population, the chromosomes or the population size
features are selected using genetic multi-objective depend on the number of demanded population by the user.
algorithm NSGA-2. In the following, we will explain and The initialization phase: in this phase an initialized
discuss the results. After the feature selection, the function is used calculate the cost of each chromosome;
decisions are made about features by the cost faction of this phase is the most important phase in the genetic
the evolutionary algorithm. Finally, to detect the type of algorithms. Two factors are used in this project. One of
errors, the outputs of each segment are combined and by these factors is caused by the number of features and the
the use of fuzzy logic the type of error has been other factor is the cost function of the chromosome
determined. This is done intuitively by setting a Mamdani categorization. Since, the aim is to reduce the error rate as
fuzzy logic. Further explanation of R6 and R7 segments well as the features, this issue is solved as a multi NSGA-2
are given below. issue. As described in the multi-objective genetic
algorithms above [14][15] one advantage of this algorithm
is that it gives us a series of answers for decision-making
as Pareto Front at the end of each phase. Evaluation phase:
In this phase, the evaluation is on the classification of
Pareto Fronts according to the priorities which are selected
according to the number of the populations. Taking a ratio
for the number of features in each stage, we can search for
the best answer among the Pareto Fronts with priorities of
one. The stopping criterion for the algorithm is that if an
Figure 3. the elected segments of the SMD capacitors' pads for error
answer is repeated, first the Mutation factor in algorithm is
detection
increased so that in case of being trapped in the local
140 IJCSNS International Journal of Computer Science and Network Security, VOL.17 No.6, June 2017
minimum, it can get out of it, but if an answer is repeated are mentioned in the following. Table 3. Shows the error
more than a certain amount, the algorithm is stopped. The detection results for 1000 capacitor and resistor elements
flowchart is shown in Figure 4. The cost function: two used in 4 different boards. The same applies to error
cost functions are used for feature selection; LVQ faction detection methods of other SMD elements such as diodes
and the combination function being combined of some and LEDs of SMDs.
SVMs. Each categorizing function, categorizes each Coefficients used in the algorithm:
segment of the pad into three categories: 1. Good 2.
Excessive 3. Bad. The procedure was performed for each 2. Roles:
segment of 400 training data; 40 percent of them were
used for training of the categorization faction and 60 1- If (R1) is (Excessive) and (R2) is (Excessive) and (R3)
percent were used for the Test function. The best cost, is (Excessive) and (R5) is (Excessive) Then Pad is
error and effective features of the results of both cost (Excessive solder)
functions are shown in Table 1. In the following, a fuzzy 2- If (R1) is (Good) and (R2) is (Excessive) and (R3) is
mamdani logic is intuitively set for the decision making to (Excessive) and (R5) is (Excessive) Then Pad is
decide on the error by giving cost function's qualities in (Excessive solder)
every 5 segment (good - bad - Excessive). Figure 5 shows 3- If (R1) is (Bad) and (R2) is (Excessive) and (R3) is
a block diagram of fuzzy logic to determine the type of (Excessive) and (R5) is (Excessive) and (R4) is
error. Finally, 5 types of error out of 5 segments are used (Excessive) Then Pad is (Tumbstone)
in the soldering of Resistance elements and SMD 4- If (R1) is (Bad) and (R2) is (Bad) and (R3) is (Good)
capacitors. This 5 types of error can be named as follows: and (R5) is (Bad) Then Pad is (Cold solder)
No soldering, Excessive soldering, No pad (tomb stone), 5- If (R1) is (Bad) and (R2) is (Bad) and (R3) is (Bad)
cold soldering and safe soldering. For more explanation on and (R5) is (Bad) Then Pad is ( NO solder)
the way of detecting errors by the fuzzy logic, a few rolls
1) SMD ICs:
This group, like the first group is divided into a series of
segments. For each segments, some features are extracted
and finally the error is detected for each segment. The
Figure 5. a block diagram of Mamdani fuzzy logic segmentation of ICs for error detection is shown in Figure
5. The bridge, Pseudo joint, no element and element
direction are detected for ICs.
3. The seventh segment R7: For the error detection of ICs, first R4 segment is
investigated, if there is no error in this segment, other
errors will be investigated. If an error is detected in the R4
The seventh segment is considered for the detection of
segment, it is considered as No element error and there no
bridge error between two pads. Removing the total area of
need to investigate the other segments. 4 segments are
the solders' color (Red, Green, Blue) and comparing it
taken into account for ICs and since these segments are
with a threshold value, we decided on the detection of the
adequate for the type of error detections, and each segment
bridge error between two pads.
is determinant of one type of error, also the segments are
Table 3. Results of the error detection of SMD resistance and capacitors not dependent on each other like the first group, less
The type The number and features were involved in the error detection. Therefore,
of The type of error percent of the feature selection stage has been removed from this
categorizer respondents error detection. In the following, we will describe the segments
No solder 97 91 93.81 and selected features for each segment. The first R4
LVQ & Excessive solder 377 365 96.81 segment indicates pseudo joint error. First, the area
mamdani Tombstone ( No pad ) 5 5 100 occupied by Red, Green, Blue colors is extracted. If the
Fis Cold solder 21 19 90.47 red color is more than the sum of the two other colors, the
Safe solder 478 473 98.95 segment has a pseudo joint error. The second segment R2
No solder 97 95 97.93 indicates the Bridge error. First the area occupied by Red,
SVM & Excessive solder 377 365 96.81 Green, Blue colors is extracted. Calculating the largest
mamdani Tombstone ( No pad ) 5 4 80 association of colors for Red ،Green ،Blue and comparing
Fis Cold solder 21 18 85.71 both features of the segment, it is realized that the error
Safe solder 478 452 94.56 can be detected if the features are larger than the threshold
R6 No element 18 17 94.44 value of R2. Usually ICs have a series of symbols to detect
R7 Bridge between two gaps 4 4 100 their direction such as small circle on ICs or semicircle at
the top of the body of IC or a line on the body. These signs
are used in the R3 third segment to detect the direction of
IC. Segment 3 specifies the right direction of ICs;
extracting the colors from this segment and comparing it
with the threshold value, we can detect the right direction
of ICs. If the resulting number is less than the threshold
value, the error is detected for the segment. The R4
142 IJCSNS International Journal of Computer Science and Network Security, VOL.17 No.6, June 2017
segment identifies the No element error. By removing the The features related to the area of the Red color as well as
color of IC's body – which is black- or the green color of the dark color of the holes in bases are extracted.
the printed board and comparing it with the threshold Calculating the area and comparing it with the threshold
value, the No element error is detected. Table 4 shows the value, the error is detected. If the condition is not met, the
results of the 800 different ICs in 4 different types of Hole error will be determined. The threshold value is
boards: changeable by the user. As seen in Figure 7, several
features are combined to make decisions. Table 4 shows
Table (4) the results of error detection for ICs of SMD the results of the detection for 990 DIP pads from 4 boards.
The number of errors and the Dis: shows the distance of the desired color from the
Type of errors
percentage of error detection center of the image.
Bridge 200 199 99.5 Cir: shows the circularity of the desired color
Pseudo joint 200 194 97 Area: shows the area of the desired color in the image
No element 40 40 100 BigArea: shows the largest area of the object in terms of
Direction of
40 38 95 the desired color.
the element
Total percentage 98.875
2) DIP elements:
Some features are extracted from the image of the pad for
the third group or DIP elements. Considering 3 main
segments for the pads – being shown in figure 6- the errors
of ،No Solder ،Less Solder ،Bridge، ،Holes in Solder,
Excessive Solder, and no lead, safe solder are detected.
Figure 7. The flowchart of error detection for the second segment of Dip
Table (7) Results for solving TSP for the second sample
It = 500 It = 300 It = 100 population
NFE =
NFE =45100 NFE =15100
75100 100
168.5805 263.7227
156.1930
NFE =
NFE 135300 = NFE =45300
66900 300
165.669 266.737
156,7200
NFE =
NFE9.2750 = NFE =75500
135.500 500
162.287 282.935
154.4557
Optimal rout: Figure (13) the optimal route for the third sample
4. Conclusion:
Our goal in this project was to construct AOI system Fig.
15 and 16, and create algorithms for detecting various
errors on various elements, being used in all sectors of
production line. As mentioned the built device and its
software can be used in two production lines, before
mounting the elements and after the solder bath. In
addition, with minor changes the mentioned methods can
be used to detect errors of other elements such as:
regulators, diodes, LED, SMD, and transistor. Tables (10
and 11) indicate a comparison between our method and
earlier works. It is realized from the above tables that GS ،
NS ،SS ،LS ،PJ ،CS ،ES ،TS ،MS ،Br ،SF ،Dir ،LL ،Sh ، Figure (15) Inside of the built machine