Abstract: This paper proposes a machine vision-based method for inspecting the solder ball quality of BGA devices. The method uses the same light source to illuminate the solder balls of the BGA connector under test at two different incident angles from the same viewpoint, obtaining two images. Then, the surface information of the BGA connector solder balls in the x-direction is obtained, and the main quality parameters of the solder balls under test are calculated. Finally, the main algorithm for BGA connector solder ball inspection is given. Keywords: BGA connector, solder ball inspection, machine vision inspection algorithm 1 Introduction BGA (Ball Crid Array) is an electronic device packaging technology that has developed rapidly in recent years. It is very suitable for the packaging of large-scale integrated circuits. BGA connectors and BGA packaged devices are now widely used; BGA packaged devices can be found in almost all electronic products such as computers and mobile phones. Figure 1 shows the BGA soldering surface of a BGA connector. BGA connectors use solder balls as pins to connect to the printed circuit board. During installation, the BGA connector is heated, causing the solder balls to directly fuse onto the printed circuit board, thus completing the installation process. Compared to other types of connectors, BGA connectors offer advantages such as easy installation, reliable operation, high packaging density, ease of assembly, small size, and low self-inductance and mutual inductance. They are particularly suitable for packaging ultra-large-scale integrated circuit chips such as computer CPUs or as connection sockets for IC devices. Figure 2 shows a side view of the BGA connector after installation. As shown in Figure 2, BGA connectors require very high manufacturing precision, especially for the mechanical dimensional accuracy of the BGA solder balls. The height difference of the solder balls on the BGA connector should be less than 0.2 mm; otherwise, one or more solder balls on the BGA connector will fail to properly fuse with the circuit board, rendering the entire circuit product unusable. Figure 3 is a schematic diagram of a circuit connection failure caused by inconsistent BGA solder ball heights. To avoid BGA connector connection failures, the quality of the BGA connector solder balls is usually inspected one by one on the production line (the main inspection parameters are the diameter and height of the solder balls). Using traditional contact measurement methods not only results in a long measurement cycle but also fails to meet the requirements for online inspection of each solder ball on the connector at the production line. Applying machine vision to the quality inspection of BGA connector solder balls enables non-destructive, non-contact online inspection. Because machine vision uses image acquisition and image processing methods, it can acquire the entire image of the BGA connector under test in a single sampling process. Therefore, its entire inspection cycle is very short, and it can complete the inspection of all solder balls on the BGA connector in one go. Obviously, it is a relatively ideal method for BGA connector quality inspection. 2 Inspection Principle To detect the diameter, height, and other parameters of the solder balls of a BGA connector using machine vision, the image acquisition device first acquires an image of the end face of the solder balls of the BGA connector, as shown in Figure ( ). Then, the surface information of the solder balls of the BGA connector is extracted from the image, and finally, the diameter, height, and other parameters of the solder balls under test are obtained from the surface information. The solder ball image generation process is shown in Figure 4. The light source illuminates point S on the surface of the solder ball, and its reflected light is projected onto point S' on the image surface through the center of the lens. When the light source is parallel light, the reflected light is uniformly scattered, and the projection of the solder ball is an approximately planar projection, the gray value I of point S' on the image surface is related to the illumination direction angle (α, β) and the state of point S on the surface of the solder ball. Its functional relationship can be expressed as: I(x,y,α,β) = A * ρ(x,y) * G(p,q,α,β) I(x,y,α,β) is the grayscale value of point S' on the image surface corresponding to point s, which can be directly obtained from the image acquisition device; it is also a function of point S(x,y) on the object surface with respect to the light projection direction angle (α,β). A is a constant. ρ(x,y) is the surface reflectivity at point S(x,y), which is related to the surface properties of point S(x,y). For example, stains or patterns on the surface will affect the reflectivity, and different locations have different ρ(x,y). G is the density of incident light on the object surface. Once the light projection direction angle (α,β) is determined, it is related to the surface slope of point S(x,y). As can be seen from the above analysis, the image generated on the image plane contains the three-dimensional information p and ρ of the object being measured. After detecting the gray value of point S, as long as p and ρ are extracted from equation (1) or equation (2) based on the coordinates x and y of point S and the incident light direction angle (α, β), the slope of the solder ball surface can be obtained, and then the diameter and height of the measured solder ball can be calculated from the slope of point S. However, the surface reflectivity ρ(x, y) in equation (1) is relatively complex. Different objects have different surface reflectivities, and the surface reflectivity of the same object at different locations is also different. Moreover, in a continuous industrial production environment, it is impossible to obtain the accurate surface reflectivity ρ(x, y) of the measured object. Therefore, it is impossible to calculate the slope of point S from the gray value I by directly applying equation (1). Although the surface reflectivity ρ(x, y) is complex, it depends only on the surface properties of point S and is independent of the lighting conditions. Utilizing this characteristic of surface reflectivity ρ(x, y), under the same viewpoint, the solder balls of a BGA connector are illuminated by the same light source at two different incident angles. An image acquisition device obtains two corresponding grayscale values I1 and I2 at point S' on the image surface. Since I1 and I2 are the grayscale values of point S' on the image surface under different lighting conditions, corresponding to the same point S on the BGA connector solder balls, they have the same planar coordinates x, y and surface reflectivity ρ(x, y). Solve the following simultaneous equations: Under the same viewpoint, the solder balls of the BGA connector under test are illuminated by the same light source at two different incident angles. On the image plane, two corresponding BGA connector images are acquired using an image acquisition device. Then, the two gray values of corresponding points in the two images and the incident light source angle are substituted into equation (5) to calculate the p value of each point of the BGA connector. The obtained p values are stored in a two-dimensional array, and the subscript of the array is made to correspond to the x and y coordinates of the image, thereby converting the grayscale image of the BGA connector into the surface slope image of the BGA connector (along the x direction). Finally, the surface slope information of the BGA connector is extracted from the surface slope image of the BGA connector, and the diameter and height of the BGA solder balls are calculated. The above measurement process is called "two projections". Since the goal is to detect the height and diameter of BGA solder balls, after obtaining the surface slope image of the BGA connector (along the x-direction), the maximum and minimum values of all slope changes p along the x-direction are found. Then, the diameter and height of the BGA solder balls can be easily calculated based on the distance between adjacent extreme values in the x and y directions. The distance between adjacent extreme values in the x and y directions can be obtained from the pixel spacing of the image acquisition device and the subscripts of the two-dimensional array storing the p values. Figure 5 shows the BGA solder ball surface information obtained when the y-coordinate is a certain value. 3 Main Detection Algorithm Two M×N pixel images are acquired from the same viewpoint using the image acquisition device and stored in the arrays image1[m,n] and image2[m,n] respectively. The following algorithm calculates the slope of the tested BGA connector surface in the X-axis direction corresponding to each pixel on the image surface. The calculation results are stored in an M×N array. Detection Algorithm: 4 Running Results This BGA connector solder ball inspection device employs a 768x590 pixel area-array CCD camera, an NI-1907 image capture card, an LED planar light source, and a P4-1.7G computer. The device is used to inspect BGA connectors (40x40mm) with 200 solder balls, focusing on solder ball height and diameter. Its inspection cycle is less than 800ms, and its inspection accuracy reaches 2%, featuring high speed and reliable operation. 5. Conclusion This paper proposes the principle and main algorithm for using machine vision to inspect the solder ball quality of BGA connectors. By using a "double projection" method to inspect BGA connector solder balls, only one inspection process is needed to acquire two images, obtaining three-dimensional information of all solder balls (usually dozens) on the entire connector, thus detecting important quality indicators such as solder ball height and diameter. The superiority of machine vision is fully demonstrated in practical applications.