A model approach for in-process tool condition monitoring in CNC turning using machine vision

Tool wear monitoring and real-time predicting tool life during the machining process is becoming a crucial element in modern manufacturing to properly determine the ideal point to replace tool, remains a challenge currently. In this paper, the model approach for in-process monitoring and predicting progressive tool wear by using machine vision is proposed. The developed method adopts machine vision to acquire tool wear images from a CCD camera. The emerged wear analysis is conducted based on the in-progress of signal processing on captured tool wear images, received throughout the cutting process. This automated analysis is carried out with programming to assess and compare a number of pixels of cutting edge images between cutting tools before machining and during the machining process. The developed system is evaluated through experiments of actual cutting conducted on the CNC turning machine with the proposed system installed to evaluate progressive wear during the machining process. Experimental results are capable of indicating the emerged wear at the current state by comparing the number of pixels between the new and used tools. Average flank wear (VB) is also evaluated linked to tool rejection criteria. The developed system is validated by the 3D microscope measuring actual wear on the used tool after cutting experiments. Comparative wear analysis is then performed by finding the correlation equation of pixels examined by a developed system and SMr2 value measured by the microscope. The results showed that the relationship between the number of pixels and SMr2 is a strong correlation.


Introduction
Tool wear monitoring with the direct measurement method has always been of interest to researchers because its results are more accurate and reliable than indirect ones. In particular, measurement is conducted during machining the workpiece, so-called online measurement or real-time measurement, which is often measured without direct contact to the cutting tool (Non-contact measurement) due to the limitations of the method. Therefore, the direct method is preferable to non-contact measurement, especially the machine vision method because it has many advantages such B Worapong Sawangsri fengwps@ku.ac.th Pakanun Wattanasinbumrung pakanun.wa@ku.th 1 Department of Mechanical Engineering, Faculty of Engineering, Kasetsart University, Bangkok, Thailand as high flexibility, high spatial resolution, and high measurement accuracy, etc. [1][2][3][4].
Machine vision has become popular and applied to various types of automatic inspection tasks in the modern industry. For example, crop monitoring, precision agriculture, in-line inspection such as in the automotive industry, semiconductor, electronic device, food and pharmaceutical industry and non-destructive inspection, as well as quality control and classification in production lines [5][6][7]. Especially, machine vision and image processing technology have been used to analyze and verify the wear and tear of cutting tools in the past decade. It can be used to directly monitor the wear conditions of the cutting edge or the workpiece while being machined. This leads to the development of various types of vision sensors consequently [8][9][10]. However, machine vision and image processing technology have also been less applied for monitoring on cutting tool conditions. This is because of machine vision and image sensors have not been developed to be efficient and resolution enough, especially for real-time measurement. Another important issue is the limitations of the machine vision installation on the machine and the obstruction of chips, coolant, equipment, etc., during machining [11,12]. Thus, it is consequently reason that the machine vision is not often used to develop a system for monitoring the condition of cutting tools during machining operations.
There are some examples of research using machine vision systems for tool condition monitoring (TCM) system. For example, Shahabi and Ratnam [13] indicated that although machine vision is generally used to monitoring for cutting tool wear, it is an offline measurement or measurement after finished machining. But they conducted the initiative to use the machine vision system while machining workpiece. They did not measure the cutting tool directly, the surface roughness of the machined part was instead analyzed in relation to the cutting tool wear. Chen and Jilin [9] developed a wear condition monitoring system of ball-end milling cutter in milling operations using an offline machine vision. However, although they measured the cutting edge wear directly, it is not assessed during machining, just measured before and after machining of each experiment.
Regarding, analysis and inspection of cutting tool conditions with machine vision, most research works prefer to use the technique of converting image information into binary images or black and white images. This is an image that occupies only 1 bit per pixel, with only two color values; 0 or black and 1 or white, respectively. The condition of the used cutting tool is then analyzed [14,15]. Analysis techniques are varied from various researches. For instance, Dutta and Sen [14] analyzed the flank wear of turning tool from turned surface images by extracted features analysis technique. Yu and his team [16] used a curve fitting technique to plot the collected data from the captured image of the cutting edge in each machining state, then calculate the wear area that occurs at the tool tip., etc. In recent years, state of the art in tool wear monitoring systems using machine vision technology as well as various image processing techniques have been proposed. Some potential and significant research are properly selected and summarized in Table 1. The new technological advantages are currently presented with more accurate, applicable, and cost-effective. However, the challenges and limitations are still existing and thus higher technology and applicable methodology are keeping needed to explore.
In this paper, an applicable and simple tool wear monitoring system with a more accurate solution as well as the ability to operate during machining cycles is proposed. The   Luminance 67,000 Lux model approach of an in-process monitoring and predicting progressive tool wear has been purposed. The system is adopted a machine vision system with a charged couple device (CCD) camera for processing and obtaining image information of cutting edge. The progressive tool wear analysis is accomplished based on the automated analysis to assess and compare a number of pixels of cutting edge images between before machining and during the cutting process. The average flank wear (VB) is also evaluated by the developed system. The experimental study is conducted on the OKUMA GENOS L250E CNC lathe with the developed system installed to observe the emerged wear during the machining process. Furthermore, the developed system has been validated by measuring and comparing the occurred wear of cutting tools before and after cutting experiments by using the 3D Measuring Laser Microscope.

Tool wear mechanism
The abrasion, adhesion, and diffusion during metal cutting process are known as the mechanisms of tool wear. Thus, tool wear always occurs with the deterioration of machining efficiency due to the changes in tool shape and geometry. The different classifications of tool wear are flank, crater, nose, notch wear, etc. [12,15]. The flank wear is one of the Fig. 4 Flowchart showing the operation of the system most important and common wear that affecting on drastically decreasing in cutting tool performance [21,22]. It is the wear of the cutting edge due to ploughing process between workpiece surface and tool flank face. Based on the ISO3685 standard [23] and [12], two parameters related to flank wear were defined namely included the average width of the flank wear land (VB) and the maximum width of the flank wear land (VB max ), as shown in Fig. 1. These indicate the minimum wear area that the consideration of replacing the new tool should be decided. Thus, the measurement of VB is assigned as automatic detection during the cutting process by the developed system to present progressing wear related to the tool rejection criteria [23,24].

Cutting tool wear image capturing and analyzing techniques
Flank wear detection on the cutting edge is a crucial issue that needs to be precisely and accurately detected. Otherwise, the tool wear cannot reliable observed and evaluated by the developed system. Sharma and team claimed that Pixel matching is one of the best image processing techniques for accurately detecting tool wear area within machine vision system [15]. The pixel matching [9,15,16,[26][27][28] is a method that converted images captured by CCD camera to binary images and counting the number of pixels within the selected area on the tool surface to determine emerged wear (Fig. 2). Algorithm of the developed system has been set up as an automatic comparison of the number of objective pixels between the unused (so-called the reference tool) and worn tools. The progressive tool wear is thus analyzed by comparing the numbering of pixels between the referent tool and the used tool during machining process. The system is  also conducted to evaluate the average wear land (VB) on the tool flank face. The VB is thus used as the tool rejection criteria that whenever the users should be deciding to replace a new tool, will be notified by the system.To determine wear land (VB), Wang et al. developed the measurement system for flank wear using successive image analysis in milling [29] and presented a method to measure flank wear width using edge detection together with Hough transform to identify reference line of a tool then using orthogonal scanning to determine both average and max flank wear [30]. Dong and Li further studied by using distance between Hough transform determined from edge detection to identify flank wear width [17]. Hough Line transform is a technique that is increasingly being used in vision tool condition monitoring currently. For instance, Kassim et al. used to determine tool wear by monitoring the pattern of machined surface [31]. Jianbo et al. also determine tool wear on milling machine by drawing outer shape of an unworn tool then fill the counted pixels in the worn area [18] (Fig. 3).

Algorithm and system setup
The development of the purposed system is performed based on the image checker which is embedded software and system of the Panasonic ANPVT30 CCD camera with SV5014H Len fix length and their specifications are shown in Table  2. The system architecture has been developed by the MS Visual Basic and Python programming comes along with an OpenCV library connected through Ethernet cables. Thus, algorithm approach and features are designed with the following steps (Fig. 4). Firstly, images of the tool are captured by CCD camera and converted into binary images. Secondly, the number of pixels on the binary image of an in-process tool during machining process is counted and compared to pixels of the referent tool by the pixel matching technique. Finally, the wear area is evaluated from the missing pixels that occurred on the used tool images. Further diagnosis also has been made to analyze the VB in deciding for tool replacement.
All image information and analysis are either automatically or manually manipulated by the control algorithm. Also, the basic control of the system such as start/stop inspection and capture image can be handled, as well as its consequently  Fig. 5. Furthermore, the system can be connected to the output signal of the machine (i.e., the I/O port) to provide an interface between the proposed system and the machine tool. This allows the system to realize the current position of cutting tool in each machining cycle. This enables the system to automatically analyze and assess the image data for tool wear conditions in any cutting cycle.

Experimental design and setup
The experimental study is established and installed as a wiring diagram as shown in Fig. 6. The system comes along with a CCD camera and a bar light, which are attached to the wall opposite to the cutting tool holder within the machine. This position is above the main spindle and passed through the test for acquiring clearly captured images of cutting edge during the machining process without obstacles. Thus, a certain distance from the camera's lens to the cutting edge is fixed and pointed to the same selected area on the tool in any cutting cycles. The camera and the bar light are contained in a removable square-fixture unit and well-sealed to be protected from hot chips, coolant, and absorb vibration. Installation and setup of the developed system are presented in Fig. 7. 3 sets of the unworn turning insert of T and V types are used for rough and finish cutting, respectively. The cutting experiments are conducted on the material SCM440 to perform 3 different products with varies in cutting and related parameters in dry cutting condition. The determined parameters and details presented in Fig. 8 and Table 3, respectively. Cutting trails are set in a cutting cycle, 1 cycle (included facing, roughing, and finishing) means that a workpiece is completely produced. Therefore, every single captured image was carried out whenever each machining cycle is stopped and after properly removing chips from the cutting edge. The machining processes are keep continuing in a cycle until the tools are beginning to wear, then stop and change a new tool.
The number of pixels and VB of the cutting edge during the cutting process are targeted evaluations on progressive wear. Both concepts are based on counting pixels on the selected area and line inspections, respectively, as shown in Fig. 9. A number of pixels are automatically analyzed for emerged wear within the selected area. The lesser pixels mean the more occurring wear. Meanwhile, the conceptual identification of VB is possibly assessed by counting pixels on lines laid down on the cutting edge across the flank face, presented in Fig. 10. Counting pixels for VB is performed only pixels that present the unworn area on the tool face, i.e., the white   [33] pixels (the black is a wear area). This conceptual idea can be achieved by using the Hough line transform technique. This method automatically determines the start and end points as well as draws of the cutting insert's upper and lower boundary lines as presented in Fig. 11. The VB is automatically computed by counting only white pixels on 5 lines dragging in-between these boundary lines perpendicularly. Thus, the increasing VB is able monitored by comparing the total numbers of white pixels of unworn and worn tools. The lesser pixels of the worn tool proportionally indicate the reduction in its unworn area on the flank land, i.e., increasing VB. The more VB means the more flank wear land which related to the tool rejection criteria. If VB is reaching the tool rejection criteria, the system will automatically notify for deciding to replace a tool.

Analysis and prediction of tool wear
The system has been developed with user-friendly to control various functions of the system via GUI. The system automatically detects pixels on the captured images in 2 categories namely includes a number of pixels in the specified area and on the 5 lines parallel dragging to the cutting edge across the tool face. The length of 5 lines is limited by boundary lines which are perpendicularly and automatically drawn by using edge detection together with Hough line transform as shown in Figs. 10 and 11, respectively. The number of pixels is checked to analyze occurred wear within the specified area. The different pixels are re-calculated in any measuring cycle by comparing to pixels of a reference tool and expressed on a feature of GUI named Tool Condition (Figs. 5 and 9). Therefore, the less Tool Condition value indicates the more occurring wear. Meanwhile, inspection on the lines that automatically dragging is performed for VB average analysis, the system counts the number of pixels of the non-wear on the flank face which the pixels have seen as white. Afterward, total pixels on mentioned 5 lines dragging perpendicular to boundary lines are proportionally converted into unit length in millimeters representing the length of flank wear land (VB). Thus, the evaluable mean VB by the system can compare to the VBmax or the tool rejection criteria to ensure the tool performance during machining. In other words, if the VB has not exceeded the tool life criterion, it is able to keep using the cutting tool, but if it is similar or higher than the tool rejection criteria it is better to decide for replacing the cutting tool.

Inspection of tool wear with a microscope
The experimental measurement has been made after cutting trials to validate the emerged wear of the used tool by the 3D Measuring Laser Microscope (Olympus LEXT OLS5000). The Material Ratio Curve [32][33][34] is adopted to examine and analyze actual wear on the cutting edge. In this research, SMr2 (valley material portion) was measured and the wear results were analyzed from different SMr2 values between the unused and the used tools. Due to the used cutting edge, the Valley Void Volume (Sv) at the cutting edge surface is higher because the worn surface is deeper (valley) where the wear is more occurred. In other words, the area in the Valley Void Volume increases which resulted in the decrease in the Fig. 13 The captured images of V and T types before experimental trials Percent Contact Area of SMr2 (Fig. 12). Therefore, the more occurred wear, the less measuring SMr2. Incidentally, the selected area on the cutting edge measured and inspected by microscope is determined as an identical area as assessed by the developed system. This performed based on the mark point by microscope.

Experiment results
The initial test after installed the developed system clearly seen the images of the cutting tool (Fig. 13). The experiments are conducted to produce 3 different parts as shown in Fig. 14 and recorded all data results in order for assessing both numbers of pixels and VB. The cutting experiments start with the first set of new tools and keep machining as a cutting cycle until the tool starting to wear, then change the tool until finishing 3 sets of tools. The captured images of V and T types are accordingly performed in each cutting cycle. Thus, the collected data are shown as graphical results represented decreasing trends of pixels on both V and T types throughout experiments (Fig. 15). Furthermore, the results show the different levels of emerged wear on each cutting tool due to the different cutting parameters is assigned to each tool set. It is observed that the second tool is the most wear occurring while the first tool is the least one because the highest cutting parameters especially the RPM (Table 3) are assigned to the second tool set, in accordance with the different values of pixels and also SMr2 in Tables 4 and 5, respectively. However, the shortest time of cutting is the last (third) tool for both T and V types due to the most depth of cut is applied. The results presented that the longest time is approximately 170 min for the first tool while the shortest time is approximately 35 min for the last tool, respectively (Fig. 16, 17, 18 and 19).
The collected data also presented in 2 separate kinds of evaluated results namely a number of pixels and a VB. The assessments of the number of objective pixels of V and T types presented in Figs. 16 and 18, respectively. Meanwhile, the VB of both types showed in Figs. 17 and 19, respectively. Curve fitting of correlation equations is also conducted and placed on each graphical result. Each graph is presented that the starting time of the cutting experiment, and ending with the time of replacing a tool. It can be seen that the slowly decreasing trends in the number of pixels happened to all tools, it is assumed that emerged wear gradually occurs until deciding to change a new tool. Moreover, it can also be observed that the tool type T has lost pixels rather than type V, it may be assumed that type T is more wear occurring due to it is used for rough machining. Figures 16 and 19 demonstrate the progressive analysis of gradually occurring wear according to a number of pixels on type V and T tools using the Pixel matching technique. Progression of the worn tool is slowly presented until the wear   16,17,19, and 20, respectively for emerged tool wear analysis (Fig. 22). With regard to VB evaluation, it can be found that the slowly increasing trends in the VB values for all tools. It is assumed that the flank wear land gets slowly increasing on the flank face according to the VB values until reaching tool rejection criteria. Besides, the emerged wear on T type getting bigger and quicker than V type, this confirmed that T type has worn rather than V type in term of wear area and time.

Experimental measurement of cutting tool wear for validation
The experimental measurements of emerged wear are performed to validate the developed system. Before and after cutting experiments and collected data, all unused and used tools are taken to measure the occurred wear by using the 3D Measuring Laser Microscope. The Material Ratio Curve has been used to evaluate the occurred wear on the cutting edge by measuring and analyzing the SMr2 [35][36][37]. The comparison between SMr2 values before and after cutting experiments is explored that how much wear is exactly occurred. It can be seen that all SMr2 values after cut is lower than before cut, presented in Table 5. However, the different values of SMr2 compared before and after cuts are increasing when increased Fig. 16 Pixels of V type: 1st tool (above), 2nd tool (middle), and 3rd tool (below) Fig. 17 Average VB of V type: 1st tool (above), 2nd tool (middle), and 3rd tool (below) Fig. 18 Analysis of VB on tool type V using Hough line for reference (left) and worn tools (right) in levels of cutting parameters, this can be observed through all tool types. It indicated that V and T types get worn after cutting experiments that level of wear is well related to the cutting parameters. Figures 23, 24 are a correlation between the numbers of pixels examined by a developed system and the SMr2 values measured by the microscope for both tool types. Furthermore, the correlation coefficient indicating a relationship level between pixels and SMr2 values was also calculated based on formula 1 [38]. They were found to be highly correlated and tend to be in the same direction, expressed with the following Table 6

Discussion and conclusion
The model approach to the system of in-process monitoring and predicting progressive tool wear is developed in this paper. The developed system adopted machine vision with a CCD camera for obtaining captured images of the cutting tool. The pixel matching technique is applied to evaluate and compare the number of pixels between the referent and the used tools. The key finding is the missing pixels of the used tool indicate an occurred wear. The emerged wear and average flank wear (VB) are thus automatically analyzed based on algorithm design and implementation. The experimental testing is conducted to validate the developed system by installing the system on the CNC lathe machine and machining the actual products. Progressive tool wear is thus evaluated considering the number of pixels and VB assessments through the cutting experiments.
Results presented that numbers of pixels tend to decrease steadily for all cutting tools due to the ever-increasing wear of the cutting edge while machining the workpiece. This reduction trend can be described by the correlation equations between the number of pixels and the machining time for every tool. It is also found that there is a greater reduction in the number of pixels when setting higher cutting parameters. Also, the reducing rate of pixels of T type is greater than that of V type because the higher the cutting parameters, the faster and more likely the cutting tool wear. Meanwhile, it is also observed that the verifiable mean VB tended to increase as the wear gets increasingly more and more during machining. The correlation equations can also be used to describe the increasing trend of the mean VB.
Installation and testing of the developed system on the machine and comparing results to the actual wear measurement with the microscope. It is found that the number of pixels verifiable by the system and the SMr2 values measured by microscope is similarly decreasing trend as well as in the same direction. The indication of a relationship level expressed with correlation coefficient and correlation equations have been performed between the number of pixels and the SMr2 values of both tool types. This strong relationship benefits the tool wear monitoring applications that if the system is validated with this correlation, the actual wear level on the cutting edge is able to be assessed with the developed system. Moreover, the system is able to evaluate and analyze the mean VB at real-time machining which determines the acceptable limit for tool rejection criteria. Thus, the system is able to predict and automatically notify users the optimal time to replace a new tool before damaging the workpiece. This potentially benefits a mass or continuous production in the manufacturing industry.
More advantages, the proposed system is user-friendly with a plug-in module that is convenient to install and monitor on the machine. However, even though the proposed system is well-applied to the selected machine and specifically used tool types and shapes, further experimental validation is still needed for the different types of cutting tools. Also, proper Fig. 19 Pixels of T type: 1st tool (above), 2nd tool (middle), and 3rd tool (below) Fig. 20 Average VB of T type: 1st tool (above), 2nd tool (middle), and 3rd tool (below) Fig. 21 Analysis of VB on tool type T using Hough line for reference (left) and worn tools (right)    system setup is needed to verify whenever apply to other turning machines. Furthermore, this proposed system is limited to apply for turning machines only, it is still not applicable for any other machines, e.g., CNC milling machines. Thus, a new design of jig and fixture and a proper area for installing the system as well as new sets of measurements will be required for other CNC machine types. Thus, the challenges of future works will be afforded to develop the tool wear monitoring system for the CNC milling machine and others.