*Article* **Development of a Rapid Optical Measurement System for Circular Workpieces with Irregular Tooth Contours after Broaching Process**

## **Yu-Liang Chen, Xuan-Qi Liang, Zi-Rong Ye and Quang-Cherng Hsu \***

Department of Mechanical Engineering, National Kaohsiung University of Science and Technology, 415 Chien-Kung Road, Kaohsiung City 80778, Taiwan; frankchen2341@gmail.com (Y.-L.C.); st0597pjz@gmail.com (X.-Q.L.); a0965349877@gmail.com (Z.-R.Y.)

**\*** Correspondence: hsuqc@nkust.edu.tw

Received: 9 June 2020; Accepted: 24 June 2020; Published: 27 June 2020

**Abstract:** During a manufacturing process, it is essential to quickly identify whether a tool needs to be replaced or adjusted, to ensure that production quality is not compromised. Therefore, the re-inspection of the product or first article inspection is an important process. Reducing the inspection time can reduce the time spent waiting for a product in the production line. This research aimed to design a system that can automatically and rapidly measure the dimensions of irregular tooth contours in the broaching process, to ensure cutting tools are replaced when necessary. This study developed an automatic machine for measuring the irregular tooth contours of large ring parts; the tooth root, tooth height, and tooth thickness of the workpiece are measured. The measurement diameter is approximately 200 mm, and the radial inspection accuracy is within ±20 μm; we aimed to reduce the detection time considerably. An optical micrometer and an automatic rotating platform were used in the measurement system. The workpieces to be measured were easy to install, and the eccentricity was automatically corrected by the system, thus saving time that would be taken to correct Abbe errors. This research successfully developed a rapid optical measurement system that can reduce the inspection time from 30 min to 60 s. Moreover, the maximum radial measurement error is −0.02 mm, which means that the measurement accuracy is within ±20 μm (total: 40 μm).

**Keywords:** automated optical inspection; precision measurement; circular contour; edge detection

## **1. Introduction**

Automatic optical inspection (AOI) is commonly used in industries. System stability is essential and must be considered when designing a suitable metrology system for use in manufacturing processes. The stability of a system depends on certain factors involved in the system design, such as the type of method/system used for object identification (e.g., line or area scanning system) and the type of filter employed.

There are many methods to improve the precision of AOI; these methods help save time, increase safety, and increase the reliability of the measurement performance. For example, Ali et al. [1] proposed a camera system with precision measurement that adaptively controls the threshold values to identify the gear profile. Therefore, the gear profile can be measured with safety and reliability. Camelio et al. [2] proposed a measurement system that quantifies broaching tool wear based on the overall worn area. This method uses automated image cropping and digital imaging processing tools to determine the affected area, without any manual intervention. To remove irrelevant noise, the desired portion of the unprocessed image is manually cropped into a region of interest from the original image, after which image processing is performed.

To improve the processing accuracy of products in automated manufacturing, the state of tool wear is monitored [3]. This approach extracts the tool edge by decomposing the original tool-wear image, to reduce the influence of texture and noise in edge measurement. Adamo et al. [4] proposed a low-cost, high-performance glass surface inspection system. The system uses two low-cost complementary metal-oxide-semiconductor (CMOS) (1.3 M pixels) USB cameras to form an array, and as the glass width increases, more cameras can be added to increase the number of images that can be acquired. Defects such as scratches and bubbles can be identified by using the Canny edge detection method.

Xiong et al. [5] proposed a large-scale spatial-positioning laser-scanning system. They proposed a single transmitter station calibration method based on a photoelectric-scanning multi-angle resection positioning model that combines photoelectric-scanning angle measurements and spatial resection with an external receiver array. The experiment results demonstrated that the method could achieve millimeter-level measurement accuracy.

Heikkila et al. identified errors occurring during the entire geometric camera calibration process, such as those occurring during the picking of pictures, model fitting, and image correction, to control point steps. In that paper, they present a four-step calibration procedure, which is an extension of the two-step method. In one of the additional steps, the distortion caused by circular features is compensated for, and in the other additional step, the distorted image coordinates are corrected [6].

Wan et al. [7] presented the concept of using the latitude and longitude coordinate system for spherical correction; various basic matrix formulas were used to perform automatic correction of the dual PTZ (pan-tilt-zoom) camera system. Ng [8] presented an improvement of Otsu's method. In the improved method, image segmentation is better when the grayscale histogram of the image has a double peak; if the grayscale histogram has only a single peak, the threshold will be close to the peak, which increases the possibility of poor image segmentation.

Samopa et al. [9] combined Canny edge detection and the fixed percentage method, to propose a method of setting binarization. The experiment results showed that the binarization threshold is set on the edge detection, and the performance of this method was better than Otsu's method. Jung et al. [10] created a 3D image through reprojection without an external light source, and the scanning time was shorter than that of a conventional stereo vision forming system. Previous studies have used the KEYENCE LS-7030 optical measurement meter to measure the extrudate swell of high-density polyethylenes in capillary flow [11,12]. This line scan device was also used in this proposed study.

Sun et al. [13] proposed a method for controlling autonomous underwater vehicles (AUVs); a Butterworth filter was used in the accelerometer and gravity sensor of the attitude compass. After the signal was filtered, the attitude control of the AUV was more precise, rendering AUVs more suitable for the exploration and rescue of underwater vehicles. It shows the Butterworth filter has a very flat frequency response in the passband.

The signal data of elevator safety pliers are produced by an accelerometer sensor. However, noise interferes with the signal of the accelerometer. This affects the measurement data and hampers the smooth braking of the pliers, or causes a delay in the application of the brakes. This study thus employed a Butterworth filter method to obtain smoother measurement data [14]. Unfortunately, the reliability of acceleration data is severely compromised by measurement noise; this noise needs to be suppressed to the maximum extent possible, to be able to use the data for comfort assessment. Pinto et al. [15] presented a fifth-order Butterworth low-pass filter; it is based on the fully differential difference transconductance amplifier (FDDTA) building blocks. That is, it is fifth-order transfer function according to the Butterworth theory. The Butterworth low-pass filter is a suitable smoothing method for electrical signal processing [13–15].

Ye et al. [16] proposed an in situ deflectometric measurement strategy for the robotic polishing of optical components where the accuracy is comparable to that of a coordinate measuring machine (CMM). In order to enhance the machining accuracy of curved contour on large thin-walled skin, Bi et al. [17] developed a method of isometric-mapping-based adaptive machining where the measurement system is a laser-scanner-based on-machine measurement (OMM) system to obtain 3D real geometry deformed

surface. There are several 3D measurement methods [18,19] devoted to the assessment of manufacturing processes or the evolution of surface texture.

Area scanning measurement can quickly obtain images, but a postprocessing step is required for photo distortion correction [6,10], and a graphic processing step is required to obtain the contours [1–4]. Moreover, the requirements of ambient light and a larger workpiece mean that the charge-coupled device (CCD) requires a higher resolution to maintain measurement accuracy; a high-resolution CCD is particularly expensive. The advantage of a line scanning system is that, when measuring a large workpiece, because of 1D linear image data, the sensor (camera) pixel requirements are much lower than those of an area scanning system [11,12]. Moreover, there are no strict requirements for ambient light. However, in the workpiece platform control system, signal processing is more complex, and the workpiece moving speed needs to be adequate to obtain the correct superimposed image.

In this study, we focused on measuring large workpieces of approximately 200 mm. To achieve high-speed detection, the following criteria should be met: easy installation of the workpiece, operation of the system should be simple, the system should be stable, measurement should be quick and precise, and the cost should be low. A general line scan method is applied for 2D measurements in plane, such as width, height, or length. The novel approach of this study is by integrating a rotational table and precise line scan device, to measure large circular workpiece. The micro-vibration of the transmission gears in the rotational table causes high-frequency vibration noise, which affects the measurement result; thus, this study used the Butterworth filter for low-pass filter processing.

#### **2. Proposed Metrology System**

In this study, we selected the line scanning system, where the workpiece can be placed directly on the rotating platform for measurement. The system is mainly divided into three parts: measurement unit (CCD and LS-7030), transmission mechanism (automatic detection rotating platform), and data processing (PLC and visual C# program).

A prototype system and a final rapid inspection system were investigated. The difference between these two systems lies in the speed employed and the data transfer interfaces. The prototype used the RS-232 interface to transfer data to the PC; the platform rotation speed for the prototype was 0.25 rpm (AC servo motor of 20 rpm). The platform rotation speed for the final rapid system was 2.5 rpm (AC servo motor of 20 rpm). Because of a 10-fold increase in speed, to improve data acquisition and transmission, we added an expansion input/output unit (KV-SIR32XT) module to the system. After the addition of this module, the Ethernet/IP interface could be used to transfer data to a PC.

In the program function, we needed to determine the coordinates of the rotation platform axis by using the CCD first; these coordinates were then used as the reference center of the subsequent image program. Next, we needed to convert the upper and lower limits (E1 and E2) of the LS-7030 measurement light band to the upper and lower limits of the image coordinates, to convert the measured results to the radius of the image coordinates.

Because the platform and workpiece are not on the same axis, an eccentricity error may occur during rotation; this error causes the measurement result to oscillate like a sine waveform. In this study, two different methods were proposed to determine the center of the measured object, and the eccentricity value was calculated by a program. Finally, the axis eccentricity was corrected by the eccentricity curve, and the measured value without eccentricity was obtained.

The center of a round workpiece, such as a ring gauge, can be determined by using four edge points at every 90◦. However, after broaching, because some portions of the contours change, a more accurate method to determine the center of a round workpiece is required. To this end, we propose a method of circular regression from the un-machined surface points.

The control software uses self-developed programs, employing Visual Studio C# with Emgu CV as image processing libraries and the Butterworth filter for low-pass filtering. In this study, numerical calculations were performed on the tooth root, tooth height, and tooth thickness. In addition, before beginning the measurement, the LS-7030 system needs to be switched on for 30 min, in order to ensure stable measurement.

### *2.1. System Design*

Figure 1 shows the schematic of the automatic optical measurement system. Figure 1a shows the direction in which the sample is loaded on the rotary table in the top view. Figure 1b shows the equipment; the equipment includes CCD components (IDS 500 million CCD/UI-3580CP-C-HQ\_REV 2), a Computar 2/3" 8 mm f1.4 locking iris and focus (M0814-MP2) lens, an LS-7030 CCD micrometer (LS-7001 micrometer display), a programmable logic controller (PLC) of KV-7500, a rotary table, an XY linear micrometer manual stage (TSD XY-TS100AR), a harmonic reducer (GTC 1:80), a servo motor (SME-L04030SAB, AC400W) and servo motor driver, and a control box.

**Figure 1.** Schematic of the automatic optical measurement system. (**a**) Top view. (**b**) Front view and equipment.

In the rapid measurement system, an I/O Special Unit (KV-SIR32XT) was added; this unit uses the Ethernet/IP interface to communicate with a PC, to facilitate high-speed data transfer.

The upper CCD is used to determine the rotation center of the machine rotating platform. The measurement sample is directly placed on the platform, using the outer diameter of the platform for alignment/fixation. There are two diameters within the inner diameter, as shown in the cross-section A-A of Figure 1a: a large diameter and a small diameter. The large diameter is the outer diameter of the platform and is used for alignment and fixation, and the small diameter is used to stop the sample on the platform. Thus, the workpieces to be measured can be simply and stably placed on the platform; however, a gap typically exists between the platform and the workpiece, resulting in a slight eccentricity error on the workpiece.

The rotary table consists of a harmonic reducer (1:80) and an AC servo motor. In addition, there is a pointer for positioning the machine to the 0◦ position. An inductive limit switch is used to return the machine to the 0◦ position.

This study used the KEYENCE line-scanning optical measurement system LS-7030, which is an all-in-one optical measurement instrument; the measurement range is 0.3 to 30 mm, the accuracy is ±2 μm, and the repeatability is ±0.15 μm. The LS-7030 consists of an integrated parallel beam system and an imaging system (high-brightness GaN light-emitting diode (LED), telecentric lens, and HL-CCD. The HL-CCD facilitates continuous exposure measurement (reaching 2400 times/s), so it can be used for high-speed continuous detection.

The following are the advantages of a harmonic reducer: (1) Compared with other reducers, the harmonic reducer has a smaller volume and simpler structure, and it generally consists of three basic components (wave generator, flexible wheel, and rigid wheel) [20]. (2) The harmonic reducer can be used with large loads. Because a large number of teeth mesh when the harmonic gear rotates and the flexible wheel meshes with the rigid wheel after elastic deformation, the teeth are in surface contact

with other teeth. Therefore, the backlash is small, and meshing is possible even without side backlash, which is suitable for reverse rotation during movement and maintaining output accuracy.

Other control buttons are on the outer cover of the control box, such as the start button, which triggers the rotating table to rotate once, the home position return button, which triggers the rotating table to return to the zero point position of the system, and the emergency stop button, which is required in case the measurement needs to be stopped.

In the prototype system, the rotation speed was only 0.25 rpm, and the measurement time was approximately 4 min. To achieve a measurement time of within 1 min, the rotation speed must be increased. According to Reference [21], the harmonic reducer has different vibration values for different rotation speeds. Due to the elastic deformation of the flexible wheel and the large number of teeth in contact with each other during the transmission, vibration causes measurement errors, and thus, different speeds have to be tested to determine the ideal measurement speed.

## *2.2. Calculation Method of Rotation Axis Center*

First, physical objects must be converted into coordinates of the virtual system. Therefore, the conversion coordinates of the rotation axis center and the measurement of the LS-7030 light band must be obtained. These two factors form the basis for the subsequent software calculation. We calculated the center coordinate C by using the area method.

As shown in Figure 2, the CCD was used to take photos of the correction block at three different positions; the positions of the three correction blocks do not overlap, and the total rotation angle is greater than 180◦. Then, image processing is used to identify the coordinates of the large and small circles on the calibration block, and the center of platform is C (*x*c, *y*c). A triangle (denoted in red) is formed from the center points of two circles and platform, as shown in the Figure 2. The area of the triangle at the three rotation positions is equal because the distance between the big circle and the small circle is fixed, as well as the distance to the center of point C.

**Figure 2.** Determining the rotation center by the triangular areas. The big circle locations are at 1, 3, and 5. The small circle locations are at 2, 4, and 6. C is the rotary table center with coordinates (*x*c, *y*c).

As shown in Figure 2, the positions of the big circles are numbered 1, 3, and 5, and the positions of the small circles are numbered 2, 4, and 6; the coordinates of the 6 points are written as (*xi*, *yi*), *i* = 1–6. Equation (1) shows the area calculation formulas for the three triangles, Δ12C, Δ34C, and Δ56C; the areas of the three triangles are equal (A0 = A1 = A2) to solve C.

The three triangle-area formulas are as follows:

$$\mathbf{A}0 = \frac{1}{2} \begin{vmatrix} \mathbf{x}\_1 & \mathbf{y}\_1 & 1\\ \mathbf{x}\_2 & \mathbf{y}\_2 & 1\\ \mathbf{x}\_3 & \mathbf{y}\_3 & 1 \end{vmatrix};\\\mathbf{A}1 = \frac{1}{2} \begin{vmatrix} \mathbf{x}\_3 & \mathbf{y}\_3 & 1\\ \mathbf{x}\_4 & \mathbf{y}\_4 & 1\\ \mathbf{x}\_5 & \mathbf{y}\_5 & 1 \end{vmatrix};\\\mathbf{A}2 = \frac{1}{2} \begin{vmatrix} \mathbf{x}\_5 & \mathbf{y}\_5 & 1\\ \mathbf{x}\_6 & \mathbf{y}\_6 & 1\\ \mathbf{x}\_5 & \mathbf{y}\_5 & 1 \end{vmatrix} \tag{1}$$

After derivation, the rotation center (*x*c, *y*c) values are as follows, in Equations (2) and (3):

*xc* <sup>=</sup> (*x*<sup>2</sup> *<sup>y</sup>*1−*x*<sup>1</sup> *<sup>y</sup>*2+*x*<sup>3</sup> *<sup>y</sup>*4−*x*<sup>4</sup> *<sup>y</sup>*3)(*x*2−*x*1+*x*5−*x*6)−(*x*<sup>2</sup> *<sup>y</sup>*1−*x*<sup>1</sup> *<sup>y</sup>*2+*x*<sup>5</sup> *<sup>y</sup>*6−*x*<sup>6</sup> *<sup>y</sup>*5)(*x*2−*x*1+*x*3−*x*4) (*y*1−*y*2−*y*3+*y*4)(*x*2−*x*1+*x*5−*x*6)−(*y*1−*y*2−*y*5+*y*6)(*x*2−*x*1+*x*3−*x*4) (2) *yc* <sup>=</sup> (*x*<sup>2</sup> *<sup>y</sup>*1−*x*<sup>1</sup> *<sup>y</sup>*2+*x*<sup>3</sup> *<sup>y</sup>*4−*x*<sup>4</sup> *<sup>y</sup>*3)(*y*1−*y*2−*y*5+*y*6)−(*x*<sup>2</sup> *<sup>y</sup>*1−*x*<sup>1</sup> *<sup>y</sup>*2+*x*<sup>5</sup> *<sup>y</sup>*6−*x*<sup>6</sup> *<sup>y</sup>*5)(*y*1−*y*2−*y*3+*y*4) (*y*1−*y*2−*y*5+*y*6)(*x*2−*x*1+*x*3−*x*4)−(*y*1−*y*2−*y*3+*y*4)(*x*2−*x*1+*x*5−*x*6) (3)

## *2.3. Conversion of Measured Values to Radius*

In this study, LS-7030 was used to simultaneously measure the inner diameter and outer diameter of the ring gauge, and the measured values were the upper and lower dimensions of the micrometer optical belt (Out2, Out1).

As shown in Figure 3, the measurement dimensions are the upper and lower dimensions of the light band (Out2, Out1). Using the Out2 and Out1 values at 0◦ and 180◦, the E1 and E2 values can be solved. Finally, the values of outer contour and inner contour radius can be converted, using E1 and E2. This study did not measure the inner contour radius, and therefore it is not discussed (Out2, E2).

**Figure 3.** Schematic of ring gauge measurement and symbols used in the calculation.

The ring gauge diameter is used for ensuring accuracy in calculation; the diameter value (2Ro) is calculated by using Equation (4), and Equation (5) is used for the calculation of the inner diameter (2Ri). Then, using these values, we can calculate E1 and E2 by using Equations (6) and (7), allowing the proposed system to also measure the inner diameter and contour.

$$2\text{Ro} = \text{E}\_1 - (\text{Out}\_1)\_{0^\circ} + \text{E}\_1 - (\text{Out}\_1)\_{180^\circ} \tag{4}$$

$$2\text{Ri} = \text{E}\_2 + (\text{Out}\_2)\_{0^\circ} + \text{E}\_2 + (\text{Out}\_2)\_{180^\circ} \tag{5}$$

$$\mathbf{E}\_1 = \frac{[2\text{Ro} + (\text{Out}\_1)\_{0^\circ} + (\text{Out}\_1)\_{180^\circ}]}{2} \tag{6}$$

$$\mathrm{E\_2} = \frac{[2\mathrm{Ri} - (\mathrm{Out\_2})\_{0^\circ} - (\mathrm{Out\_2})\_{180^\circ}]}{2} \tag{7}$$

### *2.4. Correction Calculation for Workpiece Eccentricity*

Because the platform and workpiece are not on the same axis, eccentricity errors may occur during rotation. In the prototype system, the ring gauge coordinate center was obtained by using the ring gauge, and then the correction of the eccentricity value and the measured value were calculated by the C# program. On the rapid measuring machine, using the outer diameter of the ring gauge or the maximum outer diameter of the tooth profile in the workpiece, a circle center was obtained through regression analysis. In this study, the ring gauge diameter is 192.68 mm.

As shown in Figure 4a, the rotating platform and workpiece (or ring gauge) are not on the same axis, and thus, the measurement result X varies due to eccentricity oscillation. The green zone is the LS-7030 measurement zone, C is the rotary table center, r is the sample or the ring gauge radius, r is the eccentricity distance (CP) from the ring gauge center to the rotation center, and θ is the angle between the eccentricity distance (CP) and the *X*-axis. In quadrant I, the angle is +θ.

**Figure 4.** Eccentric correction calculation. (**a**) Eccentricity between rotary table center and ring gauge center. (**b**) Simplification to slider-crank mechanism.

The measurement system moves in a clockwise rotation in the top view, and thus, the progressive rotation angle is −θ. Because the machine rotates in the clockwise direction, the maximum value of X is at 0◦; therefore, the measured values of X at the beginning of quadrants I and II gradually increase to the maximum value (θ = 0◦) as the platform rotates, after which they gradually decrease. The minimum value of X is at 180◦; therefore, the measured values of X at the beginning of quadrants III and IV gradually decrease to the minimum value (θ = 180◦) as the platform rotates, after which they gradually increase.

As shown in Figure 4b, all X values can be simplified to a slider-crank mechanism, and the distance X can be obtained by using the slider-crank mechanism, as expressed in Equation (8).

$$\chi = \text{ 'r'}\cos\theta + \sqrt{\text{r}^2 - \left(\text{'r'}\sin\theta\right)^2} \tag{8}$$

Equation (8) can be used to calculate the eccentricity sine curve where the input parameter of θ was derived from the cosine theorem in Equation (9) and finally can be obtained by using Equation (10).

When the prototype is used for ring gauge measurement, the eccentricity value (r') is calculated directly from the measured values; the value is obtained by dividing the difference between the maximum value of X and the minimum value of X by 2, as shown in Equation (11). The ring gauge radius (r) is 96.34 mm.

On the rapid measuring machine, using the outer diameter of the ring gauge or the maximum outer diameter of the tooth profile in the workpiece, a circle profile is obtained through regression analysis. Then, the circle is used to calculate the center P. Therefore, the eccentricity value r', the addendum circle radius r, and the X distance can be obtained simultaneously.

$$\mathbf{r}^2 = \mathbf{r}'^2 + \lambda^2 - 2\mathbf{r}'\lambda\cos\theta\tag{9}$$

$$\theta = \cos^{-1}\left(\frac{\mathbf{r}'^2 + \lambda^2 - \mathbf{r}^2}{2\mathbf{r}\lambda}\right) \tag{10}$$

$$\mathbf{r}' = \frac{(\mathbf{\dot{\chi}} \mathbf{max} - \mathbf{\chi} \mathbf{min})}{2} \tag{11}$$

To determine the error value of the measurement system, we take the result of the first measurement as the reference at origin 0 and then set the 1st value to zero. The method is to deduct the first value of all measured results, and then the origin is translated by subtracting the starting X0 value from the value of the first measured results.

Figure 5 shows the error graphs obtained from different starting eccentricity angles, when the eccentricity is assumed to be 0.1 mm (r = 0.1). As seen in Figure 5a, when the original eccentricity angle is 0◦, the X value is the largest when the coordinates of P are (0.1, 0), and the value is 0. Moreover, because the machine rotates clockwise, the resulting error value is less than 0 and has a minimum value at 180◦.

**Figure 5.** *Cont*.

**Figure 5.** Error graphs obtained for different starting eccentric angles (**a**–**h**).

As seen in Figure 5b, when the original eccentricity angle is 45◦, the coordinates of P are (0.07071, 0.07071), and r is in quadrant I. Therefore, when the machine is rotated 45◦ clockwise, the value of X is the maximum, the error is 0 at 90◦, and there is a minimum value at 225◦.

As seen in Figure 5c, when the original eccentricity angle is 90◦, the coordinates of P are (0, 0.1). Therefore, when the machine is rotated 90◦ clockwise, the value of X is the maximum, the error is 0 at 180◦, and there is a minimum value at 270◦.

As seen in Figure 5d, when the original eccentricity angle is 135◦, the coordinates of P are (−0.07071, 0.07071). Therefore, when the machine is rotated 135◦ clockwise, the value of X is the maximum, the error is 0 at 270◦, and there is a minimum value at 315◦.

As seen in Figure 5e, when the original eccentricity angle is 180◦, the X value is the minimum when the coordinates of P are (−0.1, 0). Therefore, when the machine is rotated 180◦ clockwise, the value of X is the maximum, and the error is 0 at 360◦.

As seen in Figure 5f, when the original eccentricity angle is 225◦, the coordinates of P are (−0.07071, −0.07071), and r is in quadrant III. Therefore, when the machine is rotated 45◦ clockwise, the value of X is the minimum, the error is 0 at 90◦, and there is a maximum value at 225◦.

As seen in Figure 5g, when the original eccentricity angle is 270◦, the coordinates of P are (0, −0.1). Therefore, when the machine is rotated 90◦ clockwise, the value of X is the minimum, the error is 0 at 180◦, and there is a maximum value at 270◦.

As seen in Figure 5h, when the original eccentricity angle is 315◦, the coordinates of P are (0.07071, −0.07071), and r is in quadrant IV. Therefore, when the machine is rotated 135◦ clockwise, the value of X is the minimum, the error is 0 at 270◦, and there is a maximum value at 315◦. As seen in Figure 5, at 180◦, the error patterns are reversed.

## *2.5. Main Size Measurement and Method*

In this study, a tooth of a ring object was measured. This object is mainly used for transmission connection, and the tooth shape is similar to that of a rectangular spline.

Because the ring-shaped workpiece with the qualified outer diameter (the maximum outer diameter of the tooth top) is screened and processed before machining of the tooth shape, in this study, the main dimensions considered were the tooth root, tooth height, and tooth thickness.

After the measurement is complete, the software corrects the center of the workpiece and then draws the results, as shown in Figure 6 (showing the contour of the ring-shaped workpiece); the tooth top (Rt), tooth root (Rr), tooth height (Rt − Rr), and tooth thickness (W) are shown in the figure.

**Figure 6.** Measurement result for the gear contour (only shows the outside contours of the ring sample). The yellow center point shows the actual sample center.

The tooth height is calculated by subtracting Rr from Rt. The tooth thickness (W) is measured at the top of the tooth, using two endpoints of the tooth. Each tooth is assigned a number (T1–T16), as shown in Figure 6.

## *2.6. Software and Program Processes*

This study used visual C# and Emgu CV as software development programs. Emgu CV is a cross-platform .Net wrapper for the OpenCV image processing library, allowing Open CV functions to be called from .NET compatible languages. Emgu CV can be used to develop real-time image-processing, computer-vision, and pattern-recognition programs.

This study developed a prototype and a rapid system. The program processing flow for each was the same, and only the program for signal processing was different.

## 2.6.1. Program Processing in the Prototype System

The following steps are involved in the program:


Step 4. Output: The main measured dimensions are the tooth height, tooth crest, tooth root, and tooth thickness. Except for the tooth thickness, the intermediate position of each tooth is taken as a basis, as shown in Figure 6. Rt and Rr are the intermediate positions of the tooth line. The tooth thickness is the length of the arc of the tooth top.

#### 2.6.2. Program Processing of Rapid Measurement System

Steps 1 and 2 are the same as those in the previous section. Step 2 is performed with a filter. Two types of filters are employed: the Butterworth filter and a simple filter. The Butterworth filter is used in ring gauge calibration, and the simple filter is used in the measurement of the toothed workpieces.

Because the speed was increased to 2.5 rpm and the Ethernet/IP interface was used in the final system, high-frequency noise occurs. A fourth order zero-phase shift low-pass with 1 Hz cutoff frequency of Butterworth filter was used on the ring gauge measurement results.

In the measurement of the tooth-shaped workpieces, a simple filtering method was used for the noise, because the Butterworth filter would distort the tooth shape. In the simple filter program, first, the top and root of the tooth are defined. When the measurement is complete, the addendum radius is considered to be 94.5 mm. The measurement values are between 92.6 and 94.5 mm, and they are considered the tooth root radius. Then, the measurement values are calculated by using the threshold set by the simple filtering method; the current set threshold is 0.1 mm.

We observed a phenomenon from the experimental data: The comparison value of each piece of data with the previous piece of data will not exceed 0.1 mm except for signal noise. This is the origin of the threshold filtering for tooth shaped workpieces.

The simple filtering method compares the current measurement data (the latter data) with the previous data. If the difference is more than 0.1 mm (threshold value), the current data are replaced with the previous data. This threshold is based on the comparison between the measurement results of the study machine and the results of the coordinate measuring machine (CMM) measurement.

Step 3 is eccentric correction and calibration. Two different samples are used: a ring gauge and a workpiece. To achieve further accuracy in the measurement of rectangular spline workpieces, different centers of circles are used for the eccentric correction in rapid measurement systems. For the ring gauge and workpieces, their centers are used for eccentric correction. Circular regression analysis is performed on both of them to determine the center of the circle. Because the arc of the tooth top is the outer diameter of the workpiece and the workpiece is manufactured using a precision lathe, the measurement of the concentricity of the workpiece is accurate.

## **3. Results and Discussion**

In this section, measurements using the prototype system and the rapid system are discussed. Furthermore, the rotation speed in the rapid measurement system is discussed.

The four steps of the program were described in Section 2.6: (1) real and virtual conversion, (2) filtering, (3) eccentric correction and calibration, and (4) output. The program uses the first step of real and virtual conversion to perform the calculation. The filtering requirements are discussed later in the measurement results. In the prototype system, the measurement results are used directly, without filtering. In the rapid measurement system, noise must be filtered out from the measurement results in order to achieve a more accurate eccentric correction. Experiments were conducted to verify the stability, measurement repeatability, and accuracy of the system.

In this study, an optical projector and CMM were used to verify the measurement results. The CMM measurement data are provided by the QC department in the factory, and the CMM measurement results are used for comparison and adjustment in the final rapid measurement system. Therefore, this system can be transferred directly to the production line.

#### *3.1. Prototype Development System*

## 3.1.1. Eccentric Correction

To determine the eccentricity value between the rotation platform and samples, the measurement results must be first converted to X0 relative offset values.

The X0 relative offset value (δ) is obtained by deducting all the measured values from the first measured value. In the expression δ(*i*) = X*<sup>i</sup>* − X0, *i* = 0~N, where N is the total number of measurement points for the entire circle, and δ(0) = 0 is the first offset value.

Figure 4a shows the origin translated by subtracting the starting X0 value, meaning that the first measurement value δ(0) is transferred to the 0 value as δ(0) = 0.

In the standard ring gauge measurement, the conversion result of the X0 relative offset shows the effect of eccentricity. The maximum and minimum values of δ equal X max and X min in Equation (11); Equation (11) is used to calculate the eccentricity value r , and r is substituted into Equation (8), to determine the eccentric correction curve.

In the eccentric correction of the prototype system, only the ring gauge eccentricity value was used.

Figure 7 shows the measurement results of the ring gauge that have been converted into X0 relative offset values. In addition to the sinusoidal oscillation trend, this X0 relative offset curve also includes the high-frequency error caused by the reducer vibration. The prototype system did not filter the measurement results.

**Figure 7.** Ring gauge measurement results translated to X0 relative offset data (0.25 rpm with RS-232).

All results are compared with the relative offset converted to X0, as shown in Figure 8. As shown in Figure 8a, after calculation of the eccentricity value r , using Equation (11), the r value is used to obtain the eccentric correction curve, using Equation (8). Figure 8b shows the result of subtracting the eccentric correction curve. If the curve is a horizontal line and all values are 0 mm, this means that all the values are the same as the first set of data; values closer to 0 imply that the error is small.

(**a**) **Figure 8.** *Cont*.

**Figure 8.** (**a**) Calculation result of ring gauge eccentricity curve. (**b**) Eccentric correction results.

Figure 8b shows that there are 80 periods of the wavelet phenomenon, and the number of small noise peaks is 80, which is same as the reducer ratio; this indicates the occurrence of loading deformation caused by the meshing of the flexible reducer and the fixed wheel on the harmonic reducer [22]. Because the speed of the prototype system is only 0.25 rpm and the RS-232 has almost no signal transmission noise, the reducer ratio of 1:80 can be determined clearly.

#### 3.1.2. Test for Virtual Measurement System Repeatability and Accuracy

To test the stability of the measurement system, the measurements were repeated thrice with the unloading test. During the unloading test, the sample is not removed or repositioned.

The tooth height and thickness of 16 teeth were measured, as shown in Tables 1 and 2. To easily compare the three sets of results, we subtracted the second and third measurement results from the first measurement results, to obtain the repeatability measurement error. The maximum repeatability measurement error is only 0.004 mm for the tooth height (Table 1), indicating that the measurements were accurate and repeatable.


**Table 1.** Measurement system repeatability test on tooth height (measurements were repeated thrice).

As seen in Table 2, the maximum repeatability error is −0.129 mm for the repeatability measurement results for tooth thickness, and this, too, was an outlier. The tooth thickness error is the sum of the signal noise error and sampling error. The signal noise error is the high-frequency noise in measurement, and the sampling error is determined from the sampling ratio.


**Table 2.** Measurement system repeatability test on tooth thickness (measurements were repeated thrice).

For the prototype system, the total number of CCD scan data points was 48,709, and thus, the angle of interval between each data point was 0.00739◦. The ring gauge diameter was 192.68 mm, and the sampling interval (0.012 mm sampling blind spot size) was obtained by using Equation (12). In Table 3, it can be seen that the percentage of errors of 0 to 0.01 mm in width are as high as 40.63%. Because the thickness of one tooth spans (pass) two tooth steps, in the worst case, the maximum error is twice the sampling interval: 0.024 mm (approximately 0.03 mm).


**Table 3.** Repeatability error zone distribution.

Figure 9 shows the statistical values in each error range and the percentage distribution of the error area in Table 3. Regarding the error ranges, 87.5% of errors are within 0.05 mm, and 96.88% of errors are within 0.07 mm.

**Figure 9.** Repeatable error distribution in tooth-thickness tests.

With respect to the influence of the tooth thickness error, the tooth edge positions could not be determined, because of the sampling interval error of the tooth thickness. Without considering the 0.129 mm maximum repeatability error volume (only one), the maximum tooth thickness error was 0.068 mm.

$$\text{Sampling interval} = \pi \text{D} \times \frac{\theta}{360} \tag{12}$$

3.1.3. Comparison Between Optical Projector Measurements and Prototype System Measurements

The optical projector can perform the measurement faster than the CMM; thus, we used the optical projector measurements for comparison with the prototype measurements.

Figure 6 shows the position of the teeth, and each tooth is assigned a number. The optical projector measures the tooth height and tooth thickness of T9–T12 of the workpiece, and the average of three measurements was considered in this study and compared with the optical projector measurement results. Table 4 lists the measurement results of the tooth height; the heights, as measured using the optical projector, are 3.192, 3.183, 3.164, and 3.236 mm for T9, T10, T11, and T12, respectively. The heights, as measured using the prototype system measurement, are 3.181, 3.163, 3.151, and 3.215 mm for T9, T10, T11, and T12, respectively. The measurement error between the tooth height values measured using the prototype system and the optical projector is approximately −0.02 mm.

**Table 4.** Comparison of tooth-height result using optical projector.


Table 5 lists the measurement results for tooth thickness; the thicknesses, as measured by using the optical projector, are 10.273, 10.425, 10.475, and 10.155 mm for T9, T10, T11, and T12, respectively. The thicknesses, as measured by using the prototype system, are 10.258, 10.415, 10.433, and 10.133 mm

for T9, T10, T11, and T12, respectively. The measurement error between the tooth thickness values measured using the prototype system and the optical projector is approximately −0.04 mm.


**Table 5.** Comparison of tooth-thickness result using optical projector.

As in the optical projector comparison result, the developed measurement system is highly precise and accurate, with errors within 0.04 mm.

## *3.2. Rapid Measurement System*

The system proposed in this study can be transferred directly to the production line. In the rapid measurement system, an I/O Special Unit that can use the Ethernet/IP interface to communicate with a PC to facilitate high-speed data transfer was added to the system. The ideal measurement speed was determined first.

As seen in Table 6, when the speed of the prototype system is 0.25 rpm, the sampling rate is estimated to be 203 data points/s. Data transmission through RS-232 is roughly 256 data points/s. In the final rapid measurement system, the rotation speed is 2.5 rpm, and the sampling rate is estimated to be 1326 data points/s, which is higher than the RS-232 transmission value. Therefore, an I/O Special Unit was appropriate to add to the system. This unit can use the Ethernet/IP interface to communicate with a PC to facilitate high-speed data transfer.

The prototype with the RS-232 interface takes approximately 4 min to complete the measurement, whereas the rapid system with the Ethernet/IP interface takes approximately 1 min.


**Table 6.** Data points estimated in 1 s under different rotary table speeds.

#### 3.2.1. Effect of Speed on Accuracy

Table 7 indicates that the radial direction error depends on the rotary speed. First, the measurement results must be converted to X0 relative offset values. The ring gauge is used for error analysis. When the speed changes, the total number of errors also changes. In the radial direction error, the maximum upper limit error is 0.004 mm, and the minimum lower limit error is −0.007 mm (total of 0.011 mm) at a rotary table speed of 2.5 rpm. Thus, increasing the speed helps reduce the deviation in measurement.


**Table 7.** Radial direction error depends on rotary speed.

Due to the hardware limitations of the PLC, a total of 48,709 data points are captured when the prototype system is employed, but only 31,817 data points are captured when the rapid system is employed.

Table 8 shows the determination of the arc length translated from the sampling interval, divide 360◦ by the total number of scanned data points to obtain the interval angle between each data point in a 360◦ rotation, and then calculate the arc length. In the prototype system, the sampling interval is 0.00739◦, and in the rapid system, the sampling interval is 0.01131◦. The total number of data points affects the sampling interval and precision. The most affected measurement is that of the tooth thickness, as Table 5 shown, the errors in the tooth thickness measurement when the measurement is performed by using an optical projector. Because the start and end positions of the toothed corners may not be measured correctly, the values obtained may be lower than the actual tooth-thickness values.

The maximum sampling interval error is 0.038 mm (0.019 × 2) when the rotary table speed was 2.5 rpm, which is within the tolerance level of 0.05 mm requested by customers; thus, we chose this rotating speed for final use.


**Table 8.** Translation of sampling interval into arc length.

## 3.2.2. Filtering and Eccentric Correction

The rapid measurement system needs to filter the measured results before subsequent program processing; the noise error generated by high-frequency reducer vibration needs to be optimized, as done in Reference [22].

As shown in Figure 10a, all results are converted to X0 relative offsets values for analysis, and the blue line indicates the X0 relative offset data of the original measurement result. The orange line represents the results after they have been filtered using a Butterworth filter.

There is considerable signal noise in the blue line, and the maximum upper limit error is 0.0887 mm, whereas the minimum lower limit error is −0.383 mm. The orange line indicates that, when the noise is eliminated, the maximum upper limit error is 0.043 mm, and the minimum lower limit error is −0.211 mm.

Circular regression analysis is used to determine the center of the circle; the value obtained is then input into Equation (8). As shown in Figure 10b, the eccentric correction curves with and without the filter are similar; for the blue line, the maximum upper limit error is 0.037 mm, and the minimum lower limit error is −0.198 mm; and for the orange line, the maximum upper limit error is 0.036 mm, and the minimum lower limit error is −0.197 mm. This indicates that both curves are similar.

Figure 10c shows the eccentric correction results. For the blue line, the ring gauge maximum upper limit value changes from 0.087 mm (without correction) to 0.069 mm (with correction), and the lower limit value changes from −0.383 mm (without correction) to −0.42 mm (with correction)—a total value of 0.488 mm.

For the orange line, the ring gauge maximum upper limit value changes from 0.043 mm (without correction) to 0.026 mm (with correction), and the lower limit value changes from −0.211 mm (without correction) to −0.023 mm (with correction)—a total value of 0.049 mm. The error value is lower than the prototype error value of 0.06 mm.

**Figure 10.** Ring gauge measurement results translated to X0 relative offset data. The blue line indicates the X0 relative offset data of the original measurement result. The orange line indicates the data after being filtered using a Butterworth filter. (**a**) Measurement results translated to X0 relative offset data. (**b**) Calculation result of ring gauge eccentricity curve. (**c**) Eccentric correction results.

3.2.3. Virtual Measurement System Repeatability and Accuracy Test

The results presented in the previous section indicate that the Butterworth filter can improve measurement accuracy and does not affect eccentric correction. In this section, we discuss how both filters affect different parameters. The direct simple filter was used for the tooth-shape workpieces, and the Butterworth filter was used for the ring gauge process.

First, the stability of the rapid system was tested. Table 9 lists the system stability results obtained via the unloading test; the measurement was repeated thrice.


**Table 9.** Measurement system repeatability test (measurements repeated thrice).

To easily compare the three measurement results, the first measurement result is subtracted from the second and third measurement results, to obtain the repeatability measurement error.

The repeatability measurement result indicated a maximum difference of 0.007 mm, which demonstrates that the accuracy and repeatability of the radial measurement are highly satisfactory in our system. This result is slightly higher than that of the prototype system (0.004 mm). This implies that the Butterworth filter is effective and can achieve the desired goal.

After comparing with the ring gauge diameter of 192.68 mm, we find that the diameter error value obtained from using this system is −0.02 mm, and the tooth height error value is within −0.02 mm, which is comparable to the optical projector result. Both comparison results show the same error for the radial measurement.

When the radial results shown in Tables 4 and 9 are combined, the difference between the measurement system and the actual size is seen to be −0.02 mm, which means that the system accuracy and repeatability of the diameter measurement are good.

In the tooth-shape workpiece, the measurements were conducted thrice in an unloading test. The tooth height and tooth thickness of 16 teeth were measured, as shown in Tables 10 and 11. To easily compare the three measurement results, the first measurement result was subtracted from the second and third measurement results, to obtain the repeatability measurement error.

As seen in Table 10, the maximum repeatability measurement error was only 0.023 mm for the tooth height, which indicates that the accuracy and repeatability of the radial measurement are highly satisfactory.

Table 11 lists the repeatability measurement results for tooth thickness; the maximum repeatability error is 0.479 mm because the total number of data points is reduced to 31,817.

As mentioned in Section 3.2.1 and indicated in Table 8, in the worst case, the sampling interval translates into an arc length of 0.019 mm (sampling blind spot size). The maximum sampling error for tooth thickness is twice the sampling interval, and thus, it is twice the arc length; therefore, the maximum sampling error is 0.038 mm (0.019 × 2).


**Table 10.** Measurement system repeatability test on tooth height (measurements were repeated thrice).

**Table 11.** Measurement system repeatability test on tooth thickness (measurements were repeated thrice).


Figure 11 shows the thickness error distribution. Because of the sampling interval effect, the count is 0 in the 0–0.01 mm range of error. The count for thickness errors more than 0.2 mm is 15, which is 47% of the total count. The count for thickness errors more than 0.35 mm is 7, which is 22% of the total count.

**Figure 11.** Histogram showing thickness error distribution.

The results show the impact of the decrease in sampling volume. The simple filtering method is only effective for measurement of the radial direction, and the increase in noise also increases the error in the measurement of tooth thickness.

## 3.2.4. Comparison between CMM and Actual Rapid System Measurements

The measurement results obtained from using the proposed system were compared with results obtained in an actual situation. To reduce the time taken to adjust the parameters when the machine is eventually moved to the factory, the factory provided CMM measurement data to use as the basis for machine adjustment/comparison.

This study successfully developed a rapid optical measurement system that can reduce the inspection time from the 30 min of CMM to 60 s.

Figure 12 shows the CMM measurement positions. Because the workpiece tooth groove is processed by a broach, the groove is tapered toward the top of its face. The CMM measurement is based on the middle position. In this study and in the projector measurement, the maximum size was measured because the optical measurement system can only measure the outermost shape projection. This section discusses the difference in dimensions obtained with the optical method and the CMM.

**Figure 12.** Coordinate measuring machine (CMM) measurement positions and face taper.

Figure 6 shows the tooth positions, which are numbered. The key measurement point of the CMM is the maximum size of 16 roots (Rr) because this is the dimension where interference occurs during product assembly. As in Section 2.6.2, a simple direct filter was added to the data-processing step. The system accuracy and repeatability of the diameter measurement were highly satisfactory. The radial direction error was within 0.007 mm, as shown in Table 9.

As shown in Table 12, the results of using two different eccentric corrections for the measurement of the same tooth-shaped workpiece were compared with the results of the CMM. When a wrong correction value for the ring gauge was used, large deviations between values occurred (Figure 13); two measurement values were lower than those obtained with the CMM. The minimum error value is −0.044 mm, the error range is between −0.044 and 0.121 mm, and the total error value is 0.165 mm. The measurement result indicates that the actual size of the workpiece is larger than the measured size, and therefore, interference may occur during actual assembly and work.


**Table 12.** Comparison results of three measurement systems.

**Figure 13.** Tooth root error value comparison between the developed system and CMM.

When the right correction value was used, the curve in Figure 13 is almost horizontal, and the oscillation is small; all measurement values were lower than those obtained with the CMM. The minimum error value is 0.005 mm, the error range is between 0.079 and 0.005 mm, and the total error value decreased to 0.075 mm.

The measurement result indicates that the actual size of the workpiece is smaller than the measured size, and therefore, interference may not occur during actual assembly and work.

The proposed optical measurement system can only measure the outermost shape projection of tapered face of the workpiece. Therefore, it is reasonable that the measurement results obtained from using our system will be bigger than the results obtained from using the CMM. Figure 13 shows the error between the correction results of two different circle centers and the CMM measurement result. When using the correct sample center, the error curve is smoother and approaches the horizontal, which indicates consistency in the trend of each error value; moreover, the total error is also small. When using an incorrect center correction, the curve oscillates like a sinusoid.

The CMM measures the middle of the sample, and the dimensions measured by the system and the projector are the outermost contour dimensions of the workpiece. Therefore, differences in dimension and measured results occur. Results obtained with the CMM were compared with the results acquired from using optical projectors; the measurement errors are the same (−0.02 mm) for the ring gauge and tooth shape samples. This means that our measurement system is accurate and stable. The result is satisfactory because the difference between the CMM measurement data and the results obtained with our system is 0.079 mm when using only the direct filter method.

## **4. Conclusions**

We successfully developed a rapid optical measurement system that can reduce inspection time from 30 min to 30 s for 360◦ measuring time (total 60 s including output the result). This system can quickly identify the cutting tools that need adjustment or replacement, to maintain product dimension accuracy and yield.

Measurements were first conducted by using a prototype system in the laboratory. The rotation speed was slow, and the measurement time was long. Moreover, the amount of data was large, and the resulting tooth thickness measurement error was small. The signal stability of the system was good; no glitches were observed. A wavelet periodic signal with 80 noise peaks was observed; the number of noise peaks is the same as the harmonic reducer ratio. Therefore, the prototype system can be used to observe the extent of vibration generated when the harmonic reducer is in operation.

Measurements were then conducted by using a rapid stable system. The radial dimension measurement results of the prototype and rapid system were similar when using the ring gauge. The difference between these results and that obtained with the optical projector is −0.02 mm. Although the signal of the rapid machine had considerable noise, it could be reduced by using a Butterworth filter, and the total eccentricity error is controlled to within 0.04 mm.

In the rapid measurement machine, due to the need for a larger sampling rate/data, the I/O unit was replaced, leading to errors in the signal noise and the sampling interval. The maximum error in tooth thickness measurement is 0.48 mm because the signal was only filtered by a simple direct filter. We will attempt to resolve this issue in our future work.

Whether we used the prototype or rapid system, the radial measurement dimension error of the ring gauge is within −0.02 mm. This means that the system is highly stable, accurate, and yields reproducible results.

The novel rapid measurement system was compared with the CMM used in the production line. The difference in measurement between the two systems is 0.08 mm, and thus we determined that our system can be directly transferred to the production line after completion. Another good benefit is on the equipment prices: CMM is approximately USD 50,000, and the proposed system is around USD 20,000.

In the future, to solve the problem of reducer-generated noise, the drive mechanism of the rotation platform may be changed to a direct drive motor.

**Author Contributions:** Conceptualization, Q.-C.H.; methodology, Q.-C.H.; software, Y.-L.C., X.-Q.L. and Z.-R.Y.; validation, Y.-L.C. and Z.-R.Y.; investigation, Q.-C.H.; writing—original draft preparation, Y.-L.C.; writing—review and editing, Q.-C.H.; visualization, Y.-L.C., X.-Q.L. and Z.-R.Y.; supervision, Q.-C.H.; project administration, Q.-C.H.; funding acquisition, Q.-C.H. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was partially funded by the Ministry of Science and Technology, Taiwan, under grant number MOST 106-2622-E-151-017-CC3. The authors would like to thank Linesoon Industrial Co., Ltd. (Taiwan) for providing the measurement specimens and for valuable advice.

**Conflicts of Interest:** The authors declare no conflict of interest.

## **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
