# Measuring the Positions of the Solder Pins of Electrical Connectors from the Side
## 2 Materials and Methods
### Measurement of Pins' Positions from the Side  
Before introducing the mechanism of measuring a connector from the side, some background information must be laid down. A typical through-hole connector, consisting of solder pins and plastic housing, is shown in Figure 2. This type of connector must be soldered on the printed circuit board (PCB), as shown in Figure 2a. One or two reference pegs are usually made to guide the connector to the proper position on the PCB. The PCB has holes for the pegs, allowing the multiple solder pins to easily slide into the corresponding plated through-holes when the reference pegs go into the holes. As shown in Figure 2a, the connector with the solder pins is at the bottom. In measuring the positions of the solder pins, the connector is usually placed on the table upside down so that the camera of the AOI or the 2D VMM can capture the positions of the solder pins from the bottom side of the connector, as illustrated in Figure 2b, where the \(x\)-axis is in the longitudinal direction of the connector, and the \(y\)-axis is in the transverse direction. Figure 1: The experimental setup of the machine vision system. When viewing the pin of a connector from the bottom, the pin's position can be seen in the \(x\)-direction and \(y\)-direction relative to the reference peg, or in-plane position, as illustrated in Figure 2b. The position's information is two-dimensional. However, only one-dimensional information can be obtained when viewing the pins of a connector from the side. Therefore, the connector must be viewed from two different directions using two cameras oriented in different directions, as shown in Figure 3, to obtain the two-dimensional information. The relationship between the two cameras and the connector in Figure 3 can be rearranged in Figure 4a,b separately. In this research, an equation to calculate the in-plane position from the two images was employed. The equation is derived as follows. Figure 4: The bottom view of a connector. The solid square represents the pin of a connector at its actual position, and the dotted square represents the pin of a connector at its theoretical position. The solid circle represents the reference peg. (**a**,**b**) represent two different orientations \(\theta_{b1}\) and \(\theta_{b2}\) for the connector relative to the cameras. Figure 3: Using two cameras oriented in different directions to capture the pin position from the side of a connector. Figure 2: (**a**) The side view and (**b**) the bottom view of a typical through-hole connector. In Figure 4, \(\theta_{b1}\) and \(\theta_{b2}\) are two different connector orientations relative to the camera, \(\theta_{ri}\) is the theoretical angular position for the \(i\)-th pin, \(\theta_{i}\) is the difference between the actual angular position and the theoretical angular position of the \(i\)-th pin. Moreover, \(r_{i}\) is the distance from the center of the reference peg to the center of the pin at its theoretical position, and \(d_{1}\) and \(d_{2}\) are the transverse distances from the center of the reference peg to the center of the pin at its actual position. Figure 4a shows a right-angled triangle consisting of a green line (the hypotenuse), a blue line (the leg), and a red line (another leg). The length of the hypotenuse, or the deviation from the theoretical position, is equal to the square root of the summation of the legs' square, i.e.,  
\[\text{deviation}= \sqrt{\left[r_{i}\times\cos(\theta_{b1}+\theta_{ri})-d_{1}\right] ^{2}+\left[d_{1}\times\tan(\theta_{b1}+\theta_{ri}+\theta_{i})-r_{i}\times \sin(\theta_{b1}+\theta_{ri})\right]^{2}}\] (1) Similarly, in Figure 4b, the length of the hypotenuse, or \[\text{deviation}= \sqrt{\left[r_{i}\times\cos(\theta_{b2}+\theta_{ri})-d_{2}\right] ^{2}+\left[d_{2}\times\tan(\theta_{b2}+\theta_{ri}+\theta_{i})-r_{i}\times \sin(\theta_{b2}+\theta_{ri})\right]^{2}} \tag{2}\]  
The hypotenuse, or the deviation, in Figure 4a and the one in Figure 4b are the same.