3.1. Galvo Scanning Laser Soldering System
The galvanometer scanning laser soldering system includes a motion control system, soldering system, vision system and industrial control host computer. The overall frame of the system is shown in
Figure 3.
The motion control system mainly controls the movement of the galvanometer lens and the three mechanical axes, controls the movement of the laser and camera through galvanometer scanning, and monitors the field of vision. At the same time, the mechanical axis is used to control the movement of the workpiece and galvanometer lens. The soldering system includes lasers, temperature measurement modules, etc., and completes the soldering tasks according to the instructions issued by the industrial computer.
The vision system is used to obtain the current position information. Through optical design, the vision, laser and infrared are coaxial, so that the soldering position is consistent with the position of the visual monitoring area. The industrial control host is the information processing center of the system, which is mainly responsible for the control of the whole system.
Among them, the camera in the vision system adopts an area scan camera that can obtain images more intuitively. The optical system uses a coaxial lens to make the laser beam, infrared and visual light on the same optical axis. The lens at the optical outlet uses a telecentric lens to correct the parallax caused by the industrial lens. Since the light source has an important impact on the quality of the final captured image, the annular light source with the specification of SN-90(188) is selected in this paper.
The motion control system includes galvanometer scanning motion control and three-axis motion. Among them, the galvanometer lens in the system adopts a two-dimensional galvanometer, and there are scanning lens X and scanning lens Y inside. The relevant parameters of the galvanometer lens are shown in
Table 1. The three-axis motion includes three motion axes, X, Y and Z, among which the X and Y axes are responsible for the movement of the processing platform. The Z axis moves the galvanometer up and down so that it can focus and defocus the laser. The system motion axis structure is shown in
Figure 4.
The soldering system includes a semiconductor laser, STM32 microcontroller and a thermometer with a range of 100 to 600 °C. Compared with other types of lasers, semiconductor lasers interact better with metals and are more easily absorbed by them, thus facilitating soldering. At the same time, the semiconductor laser can be coupled with the fiber to facilitate the transmission of the laser beam. Related parameters of semiconductor laser are shown in
Table 2.
The controller uses a STM32 microcontroller, which can meet the demand of the thermometer acquisition rate. Through feedback adjustment, the controller can effectively ensure that the temperature on the solder joint is basically constant. The related technical parameters of the thermometer are shown in
Table 3.
3.2. Camera and Workpiece Calibration Research
- (1)
Calibration of the processing position of the galvanometer
In the galvanometer laser scanning system, the laser beam is shifted by rotating X, Y and two galvanometers. In the actual machining process, it is necessary to determine the distance conversion relationship between the input position value of the vibrator scan and the actual optical output position. The distance between the solder joints of the marking plate was measured by electron microscopy. During the marking process, the system gave an interval coordinate value of 5000. In order to reduce the error caused by measurement, the distance between points was measured 20 times in the actual process, and the average distance was calculated. The conversion equation between the calculated coordinate value and the actual distance is
where
Lm is the actual corresponding distance, and
Ps is the input coordinate value.
- (2)
System camera calibration method
The transformation relationship between the pixel coordinate system and galvanometer processing coordinate system is obtained by calibration in the laser galvanometer scanning system. Since the shooting surface of the camera is not in the same direction as the actual shooting surface, the reflected light path of the telecentric lens and galvanometer is regarded as the processing surface into which the camera shoots vertically.
In the galvanometer laser scanning system, the design of the telecentric lens makes the distortion very small. When the galvanometer deflects to the critical point, the maximum distortion is 0.5283%, and the scanning range of the galvanometer can meet the soldering use of the system. Images taken at different positions are shown in
Figure 5.
Comparing the boundary position image captured by the camera with the origin image, it can be found that the distortion produced by the camera is very small.
- (3)
System camera calibration method
Because the laser optical path in the actual system is coaxial with the visual optical path, it can be equivalent to the pixel coordinate system. At the same time, the height of the machining surface and the luminescence point remain unchanged during the machining process, so the machining coordinates of the galvanometer can be converted into two-dimensional coordinates. The camera needs to change its position with the movement of the galvanometer, so the deflection of the galvanometer can be used to carry out the calibration process. The relationship between the pixel coordinate system and galvanometer processing coordinate system is shown in
Figure 6.
In the figure, (
) is the deflection position of the galvanometer, and
is the position of the center point of the laser spot in the image when the galvanometer is turned to the position of (
). At the same time, when the two coordinate systems are converted, the unit needs to be unified. The transformation relationship between the two coordinate systems is as follows:
The system is used to mark a point on the marker plate when the galvanometer is deflected towards the origin. The pixel position of the center of the circle in the image is identified by moving the galvanometer, and the corresponding galvanometer motion position is recorded. The motion of galvanometer makes the camera shoot at (0,0), (1,0) and (0,1), as shown in
Figure 7. The conversion relationship between the galvanometer coordinate system and the pixel coordinate system is calculated through three points, and the calculation results are as follows:
After the actual measurement of the conversion relationship between the laser luminescence position and the image coordinate system, a cross is drawn to mark the luminescence position in the image display area, to facilitate subsequent operations. The light output position is shown in
Figure 8.
3.3. Workpiece Position Calibration
Before machining the system, the solder joint position information of the workpiece needs to be imported into the system. After setting the origin coordinates in the PCB source file, location information such as marker points and pad positions can be exported in Altium Designer software.
In the actual machining process, the placement position of the workpiece is not completely parallel to the machining plane, so it is necessary to calculate the mark points on the circuit board in the system and calculate the transformation relationship between the workpiece coordinate system and the machining coordinate system of the oscillator meter [
21]. At the same time, according to the position of the marker in the pixel coordinate system, and the transformation relationship between the pixel coordinate system and the galvanometer processing coordinate system, the relationship between the solder joint position and the galvanometer processing coordinate system can be obtained.
- (1)
Marking point recognition
Common marking points on the circuit board include circles, crosshairs and other figures. The setting diagram of marking points on the circuit board in this paper is shown in
Figure 9. In the actual detection process, the marker is usually set far away, and the center of the marker is asymmetric. Therefore, the image acquired by the camera should be preprocessed, and the noise on the image should be eliminated by median filtering. The median filtered image is shown in
Figure 10. After removing the noise, the image is binarized and segmented. The image after binarization is shown in
Figure 11. The pixel edge points in the binarized image are extracted, and the extracted image is shown in
Figure 12. Since the image after point imaging will be an ellipse rather than an ideal circle, circle fitting is required.
After the pixel edges are obtained, the least squares fitting is performed on the obtained pixel edge points. The least squares circle fitting equation is
where
r is the radius of the circle, and the point (
A,
B) is the center of the circle. Another form of the fitted circle equation can be obtained by making
:
According to the principle of least squares, the objective function can be obtained as
When the objective function takes the minimum value, the fitting accuracy is the best. To make the objective function reach the minimum value, it can be obtained according to the extreme value principle:
where the values of
a,
b, and
c can be solved. At this time, the radius of the circle and the position of the center of the circle are
The visual processing flow is shown in
Figure 13.
- (2)
Processing coordinate conversion
During the processing of the system, the position of the solder joints directly imported through the Altium Designer software needs to be converted into the galvanometer processing coordinate system, so it is necessary to use the imaging point for calibration process to complete the transformation of the position relationship. The coordinate system conversion relationship between the galvanometer processing coordinate system and the actual workpiece is shown in
Figure 14.
is the coordinate system for galvanometer processing, and
is the coordinate system when the actual workpiece is designed. The coordinate of point P in the workpiece coordinate system is set as
, and the coordinate in the galvanometer processing coordinate system is
; there are rotation and translation between the two coordinate systems, and the transformation relationship is as follows:
In the process of position transformation, the actual position corresponding to the center of the circle is obtained by identifying four marking points on the workpiece. At the same time, the coordinate positions of the four marking points on the workpiece are derived by software in the workpiece coordinate system, and the actual positions of the corresponding solder points in the workpiece can be obtained by Equation (10). After the actual position of the circuit board is obtained, the pixel position of the marking point in the image is used to convert the actual solder position into the galvanometer table processing coordinate system according to the conversion relationship between the pixel coordinate system and the galvanometer processing coordinate system.
3.4. Systematic Path Planning Improvement Algorithm
- (1)
Full coverage soldering point processing frame generation
The size of clusters in solving traditional clustering problems is not limited. The number of clusters in the K-means clustering algorithm needs to be determined in advance as the initial value input into the algorithm, and the number of clusters is often obtained through experience. The size of the clusters is limited by the processing range, and there is no limit to the number of clusters; the number of clusters needs to be as small as possible. At this time, the traditional K-means algorithm cannot be directly applied to this problem.
In order to solve the problem of processing frame generation with full coverage of solder joints, the K-means clustering algorithm is improved as follows:
Step 1: Divide the workpiece into meshes; the mesh size is consistent with the size of the processing frame, and each mesh area is used as an initial cluster.
Step 2: Delete the grid that does not contain the position of the solder joint. The position of the solder joint appears on the corresponding position of the circuit board according to the design requirements. If there is no solder joint position in the area, it is an invalid grid.
Step 3: Perform sample allocation for each cluster. During the sample allocation process, the size of the cluster range after adding the sample should not exceed the size of the processing frame.
Step 4: Recalculate the cluster center and adjust the division of the sample data.
Step 5: For each cluster, try to merge the nearby clusters. If the range of the merged clusters does not exceed the size of the processing frame, the two clusters are merged. The generated cluster collection, n, is the number of clusters. Each cluster needs to meet the following requirements:
where
and
are the maximum and minimum values of cluster
k in the
X direction, respectively.
and
are the maximum and minimum values of cluster
k in the
Y direction, respectively.
and
represent the lengths of the machining frame in the
X-axis and
Y-axis directions, respectively; any of the final generated clusters are within the scope of the processing frame.
Step 6: Repeat steps 3 to 5 until there are no merged clusters.
The overall algorithm flow is shown in
Figure 15.
There will be intersections between the processing frames obtained by the full coverage solder joint processing frame generation algorithm. For the problem of attribution of solder joints in the intersection part, the position of the processing frame of the solder joints belonging to the cluster has the solder joints in the intersection part. The schematic diagram of the attribution of cross solder joints is shown in
Figure 16.
- (2)
Principle of Ant Colony Algorithm
The ant colony algorithm searches the optimal path by simulating the behavior of ants searching for food. When an ant searches for food, pheromones stay in the path it takes, and the best path is determined based on the concentration of pheromones the ant leaves behind. In the process of finding food, the ant colony determines the next destination by the concentration of pheromones, and its transition probability is as follows:
where
k is the number of ants in the ant colony, and
is the pheromone concentration between the two cities at
time.
is used to represent the heuristic function, and
is the distance between two cities.
is the pheromone importance factor,
β is the heuristic function importance factor; the larger the value, the greater the probability of moving to this point.
is the set of cities that ant
k needs to visit.
When all ants complete a cycle, the pheromone concentration needs to be updated, and the pheromone update is calculated as follows:
Among them, is the pheromone volatilization concentration, is the sum of the pheromone concentrations released by all ants between the two cities, and is the information concentration left by the ant in the two cities.
In the classic ant colony algorithm,
is usually calculated as
where
is a constant, and
Lk is the total length of the path passed by the
k-th ant.
The ant colony algorithm needs to set the parameters in advance, and the parameter setting has a great influence on the final effect of the algorithm.
Pheromone heuristic factor : The value of the pheromone heuristic factor is too small. The blindness of the ant’s path search is relatively large, and the convergence speed of the algorithm will be slowed down. When the value of the pheromone heuristic factor is too large, the algorithm will easily converge prematurely and fall into the local optimal solution.
Expectation heuristic factor β: When the value of β is too large, the ants are more likely to choose the local optimal path. When the value of β is too small, the randomness of ants searching for the optimal path is weakened, and it is easy to fall into a local optimum.
- (3)
Path optimization based on hybrid algorithm
The ant colony algorithm can find feasible solutions in a short time and can also combine the advantages of other algorithms to improve the overall performance of the algorithm. However, when the scale of the problem becomes larger, the ant colony algorithm tends to fall into the local optimal solution, and the convergence speed slows down [
22]. Particle swarm optimization (PSO) is a random search algorithm proposed by simulating bird foraging. The particle swarm algorithm has strong local search ability in the early stage. The initial distribution of pheromones in ant colony algorithm is set by the particle swarm optimization algorithm, which can effectively solve the problem of low search efficiency in the initial case of the ant colony algorithm. According to this characteristic, the combination of particle swarm optimization and the ant colony algorithm can improve the effect of path optimization.
In the galvanometer scanning laser soldering system, the processing platform and the moving path of the laser beam do not need to return to the starting point, and the algorithm needs to be modified accordingly. The working steps of the overall hybrid algorithm are as follows:
Step 1: Initialize the parameters related to the particle swarm, including the number of particles, learning factors, inertia factors and other parameters.
Step 2: Randomly generate the initial position and velocity of particles, calculate the fitness value of each particle, and calculate the initial individual extremum and group extremum. Add virtual points. The virtual points are used as the start and end points of the path. At the same time, the distance from the virtual point to any point is set to 0.
Step 3: Update the inertia factor; the update equation is shown as follows:
where
is the inertia factor,
is the maximum inertia factor,
is the minimum inertia factor,
is the current iteration number, and
is the overall iteration number of the particle swarm algorithm.
Step 4: Update the individual extremum and the global extremum of each particle. If the fitness value is greater than the individual extremum, replace the fitness value with the individual extremum. If the fitness value is greater than the global extreme value, the fitness value is replaced by the global extreme value.
Step 5: Each particle updates its velocity and position according to its own individual optimal value and the global optimal value of the particle swarm. Update the particle’s velocity and position according to the update equation. The update equation is as follows:
where
is the velocity of the particle
in the
th dimension, and
is the position of the particle
in the
th dimension.
and
are learning factors, which reflect the particle’s self-learning ability and the learning ability of the group optimal particle, respectively.
and
are uniform random numbers.
is the individual extreme value, and
is the global extreme value.
Step 6: Repeat steps 3–5 and stop when the set maximum number of iterations is reached.
Step 7: Carry out the initial distribution of the ant colony pheromone according to the results of the preliminary planning. Let the initial pheromone value of the ant colony algorithm be
, and the pheromone converted by the particle swarm algorithm after path planning be
; at this time, the initial pheromone of the ant colony algorithm becomes
Step 8: Add a virtual point to the ant colony algorithm; the position of the virtual point to any point is 0, and the start and end points of the path are virtual points.
Step 9: When the ant colony algorithm reaches the maximum number of iterations, it stops and outputs the optimized path result. At this time, the starting point of the path is the virtual point as the starting point and the next point, and the end point is the virtual point as the end point and the previous point.
The workflow of the hybrid algorithm is shown in
Figure 17.