Experimental Investigation on an Algorithm for Testing the Quality of Powder Distribution During 3D Printing Process

Metal 3D printing is a modern manufacturing process that allows the production of geometrically complex structures from metallic powders of varying chemical composition. This paper shows the results of testing the powder feeding and distribution system of the developed 3D printer. The device using the SLM method (Selected Laser Melting) was developed by research team of WroclawTech and used in this investigation. The powder feeding and distribution system was tested using a vision system integrated into the printer control system. Thousands of tests performed made it possible to identify the reasons corresponding to incorrect powder distribution on the working field. In addition, a quality control algorithm was developed and implemented in the MatLab environment. Algo - rithms based on image analysis automatically identifies powder distributed in an unacceptable way. An 88% accu - racy rate was achieved for identifying defects in all images within a dataset of 600 pictures, classified into follow - ing categories OK and NOK consisting of: recoater streaking, recoater hopping, super-elevation. The strength of the algorithm developed lies in its utilization of variations in shades of gray, rather than solely relying on the actual gray values. This approach grants the algorithm a certain degree of adaptability to changing lighting conditions.


INTRODUCTION
Additive manufacturing, also known as 3D printing, is a manufacturing process that builds three-dimensional objects by adding successive layers of material based on a digital design [1].One of the varieties is selective laser melting (SLM) used to produce metal parts [2].In this method, a thin layer of powdered material is spread across a build platform, and the object is formed by selectively fusing or solidifying the powder particles layer by layer.Among the factors that influence the quality of the final parts is the quality of the powder layer, specifically uniformity and powder packing [3].The laser scanning parameters and thickness of the powder layer are linked via the volumetric energy density given by Equation (1): where: P -output laser power (W), v -scan speed (mm/s), d -scan spacing (µm), t -powder layer height (µm) [4].
Inadequate powder spreading can result in insufficient energy transfer, leading to incomplete melting or inadequate fusion between powder particles, resulting in higher porosity levels in the final part [5].The higher powder packing improves the heat conductivity of the powder bed and contributes to the production of parts with improved surface roughness [5].In summary, the ideal powder layer should exhibit a consistent and uniform packing density across its surface, while ensuring a relatively smooth surface finish with minimized discrepancies between the actual and the intended (theoretical) layer thickness [6].Several studies have been conducted to optimize the spread of powder [7,8].External modules are also being developed to test the spreadability of the powder under different conditions [5,9].Recently, vision systems have been introduced to monitor the quality of powder layers.This approach might be helpful in the development of new powder coating strategies, especially in powder with low flowability, such as small powder [10] or powder with magnetic properties [11].The combination of vision systems with dedicated algorithms allows in situ detection of defects, including, among others, recoater hopping, recoater striking, incomplete spreading, and superelevation [12].Usually, some sophisticated algorithms based on machine learning or deep learning are applied [13].Yin et al. [14] conducted research on identifying the defect known as recoater hopping, which appears as vertical lines in selective laser melting (SLM).This defect occurs when the recoater hits the part or experiences vibrations.The detection method used a camera and the local binary pattern (LBP) recognition algorithm and achieved a recognition rate of 98% [14].Scime et al. [15] used a widely used machine learning technique, known as the bag-of-keypoints (or words) algorithm, to detect defects and categorize them during printing on the commercial EOS LPBF machine.The algorithm was further developed to improve the precision of the location of the defect [12].The mentioned approaches require a large number of classified images to train the algorithms and obtain satisfactory precision [16].In this work, a much simpler solution has been proposed based on the so-called 'line profile' defined as the average of five.The Image Processing Module is responsible for taking the image and processing it into a state that can be analyzed vertical lines in the image of a powder bed, as proposed by Craeghs et al. [17].The algorithm was further developed and extended to include defects such as superelevation, blade scratch, local defect, or recoater hopping, which were not present in the [17].The algorithm used to evaluate defects in the powder layer uses relatively simple operations on the image.As a result, the processing and data analysis time is shorter than for the use of machine learning algorithms, for which a large learning data set is necessary.The proposed system might be used successfully to develop new feeding strategies, especially for powders with limited flowability, and to monitor the powder spreading process.
Additionally, the implementation of online control systems provides the opportunity to identify deviations or anomalies as soon as they occur.This early detection allows prompt corrective actions to be taken, mitigating the risk of producing defective or substandard parts, and therefore, reducing material costs and printer depreciation.In addition, the use of a vision system coupled with an algorithm for recognizing irregularities will enable their direct identification and correction of the mechanical-technological parameters of the device.The designed and manufactured 3D metal printer is an original project made by the research team of Wroclaw University of Technology.To validate the powder feeding system, hundreds of trials and tests, based on which it would be possible to identify potential defects that occur during metal powder distribution.For this reason, it was decided to develop a vision system and implement an algorithm for quick and efficient evaluation of the powder distribution system.

Powder-feeding platform
To perform the powder spreading and testing the algorithm, a custom-build platform has been developed.The CAD module of the system is presented in Fig. 1a and 1c and the built prototype in Fig. 1b and 1d.The building platform has a diameter of 80 mm and a usable length of 95 mm The powder might be supplied based on two principles: 1) the vertical feeding platform with a diameter of 100 mm and usable length of 95 mm, 2) the powder hopper with vibrating motors and a rotating textured roller.The spreading system might be adjusted according to needs by applying two of the most popular solutions: a blade and a roller.The recoater carriage is mounted on the belt drive (ZLW-1040-02-S-100-L-400, Igus) powered by a stepper motor (MOT-AN-S-060-035-060-M-C-AAAC, Igus).The platforms are driven using a ball screw with a 5 mm lead (EBB1605-4RR, THK), a hollow rotary reducer (LiMing GT-60C-25, LiMing) and a stepper motor with brake and encoder (MOT-AN-S-060-020-056-M-D-AAAD, Igus).The theoretical resolution is ~1 µm.The all-mentioned stepper motors are controlled with a dedicated controller (Dryve D1, Igus).
Depending on the chosen version of powder feeder, the course of powder spreading is as follows (Fig. 1): • Vertical powder feeding platform.
The powder platform slides out at a specified height, the build platform is lowered, and the recoater carriage is passed.The carriage might be equipped with a stationary blade or rotating shaft responsible for spreading the powder.The shaft is powered by a stepper motor (MOT-AN-S-060-005-042-L-A-AAAA, Igus) and controlled with a dedicated stepper motor controller (D8, Igus).
• The powder hopper.
The build platform lowers.The powder is supplied from hopper with vibrating motors to the recoater carriage and its amount is regulated through a textured rotating roller powered with a stepper motor (MOT-AN-S-060-001-028-L-A-AAAA, Igus) controlled by a dedicating stepper motor controller (D7-1, Igus).The recoater carriage passes to spread the powder on the build platform.The whole system is controlled by PLC (S7-1200, 6ES7215-1AG40-0XB0, Siemens) using a TIA system environment and an HMI control panel (HMI KTP700 BASIC COLOR PN-6AV2123-2GB03-0AX0, Siemens).In automatic run mode, the following variable might be controlled: thickness of the layer, the rotation angle and the velocity of the textured shaft in the powder hopper, the velocity of the recoater carriage, the direction and rotation speed of the roller in the carriage, number of loops.The panel also allows for monitoring of current positions and axis statuses, along with error indicators (Fig. 2).The last element of the panel are five buttons enabling: starting sequence, stopping sequence, changing from manual to automatic mode, reset, and configuring vibrating motors.Additionally, each axis might be independently controlled via a dedicated screen assigned to it.

The powder spreading for the tests
The set-up with a powder feeding platform and a stationary blade was used for the purpose of the tests of the developed algorithm to detect defects in powder bed (Fig. 1b, c).The powder spreading was performed by the procedure described in 'The vertical powder feeding platform'.

Image acquisition of the deposited powder layer
The video system used for testing consisted of the following: − Balluff BVS002C industrial camera, − C-mount KOWA HR964SR lens with a focal length of 35mm, − Balluff BAE000K ring LED illuminator.
The undoubted advantage of the Balluff BVS002C camera is its built-in graphics processor, operating RT system and BALLUFF Cockpit 2.0 software, with which it is possible to communicate via a webserver.Once the programming stage is completed, the camera becomes an independent device that does not require connection to a PC or industrial computer.In Table 1 technical parameters of the Balluff BVS002C industrial camera are presented.
The camera's development environment allows image capturing, region of interest (ROI) definition, and implementation of image processing operations including filtering, geometric measurements, and barcode reading.Due to the builtin graphic processor, it is also possible to apply and implement classification algorithms.As standard, the camera is equipped with Profinet, Eth-ernetIP, IO-link communication interfaces, and classic digital IO-ports in 0-24V logic.One of the available ports is configured as a trigger so that the camera does not operate in continuous mode, but captures images off at a hardware-and software-defined moment (the corresponding position of the powder feeder).The digital signal can be generated directly from the limit switch or controller.In addition, the camera software allows communication with an FTP server to which images captured from the camera are automatically sent.Using the described configuration, it was possible to capture a large amount of data (images) without the presence of an operator.The resulting data were used to test algorithms for classifying potential defects during the process of spreading metal powder on the printer's working  field.Figure 3 shows the complete vision system equipped with Balluff BVS002C industrial camera, C -mount KOWA HR964SR lens with a focal length of 35mm, Balluff BAE000K ring LED illuminator (a) and its position over the working field of thedeveloped 3D printer (b).

EXEMPLARY IMAGES OF THE POWDER LAYER DEFECTS AND THE REFERENCE POWDER LAYER
Figures 4-7 show the three types of defects that were analyzed in this work and examples of the correct powder layer.The first defect was super-elevation, which is sticking out of the part above the powder level.This is usually caused by the detachment of the part due to residual thermal stresses [18] or swelling of the part caused by excessive energy input [19], as a consequence the part can lose its intended shape and elevate above the powder bed surface.This is considered a serious defect that directly influences the geometry of the final part geometry [12].
The second analysed defect was recoater streaking, characterized by the presence of a distinct line, running parallel to the direction of the recoater movement, which occurs when the blade is either damaged or the recoater drags a relatively large contaminant across the powder bed [17].The last defect appeared during research was the recoater hopping observed when a rigid recoater blade makes contact with a part positioned just below the surface of the powder bed.This phenomenon is visible in the form of repeated lines that are perpendicular to the direction of recoater travel [12].The reference powder layers without defects are given in Figure 7.

INITIAL TEST OF ALGORITHM
The purpose of the designed vision system is to determine whether the metal powder has been properly distributed in the printer's work area.Once the powder is distributed through the recoater, the printer's PLC sends a signal (trigger) to the vision system and then can determine the quality of the powder distribution.In practice, this means that a photo is taken, processed, and analyzed.On the basis of the analysis and specified parameters, an evaluation algorithm decides whether the surface quality of the distributed powder is adequate.If so, the printing process continues, and then more layers of powder are distributed.If a defect is detected on the surface of the powder, actions specified by the station operator are taken (e.g., an alarm is triggered, the powder is redistributed, or the printing process is stopped).
The class diagram of the Unified Modeling Language (UML) of the considered algorithms has been presented in Figure 9.The overall software of the vision system consists of several classes: Program, Communication Module, Image Processing Module, and Graphical User Interface.The Program class aggregates the other classes completely.This means that it owns and manages the objects of the other classes.The Communication Module is used to exchange information and defines communication channels.Its functions include accepting information about the possibility of inspecting the surface of the distributed powder, as well as sending information about image processing and the result of the analysis performed.The User's Graphical Interface has been used for the ability to display the image and to retrieve the data needed for calibration.
The Image Processing Module [20] is responsible for taking the image and processing it into a state that can be analyzed, and on it a decision can be made about whether the quality of the powder distribution is good enough.
In a given vision system, it is important for the operator to be able to calibrate it.It is necessary because of the use of powders of different materials and gradations, as well as other variables present in the printer environment, such as lighting or the possibility of changing the position of the camera in relation to the working field.Correct calibration helps to make the system as effective as possible.During the calibration stage, the operator defines ROI and sets control parameters (e.g.brightness, contrast, mean of pixel brightness, standard deviation of mean value of pixel brightness).The development of the algorithm has been carried out on the basis of pictures of manually distributed powder.The first step of the research was to create the initial evaluation algorithm, which has been prototyped in the MatLab environment.At the beginning, the images were processed by cropping them to the region of interest (called ROI) and increasing the contrast, as shown in Figure 10.
First, the global evaluation parameters of images have been tested: standard deviation, mean gradient, and percentage of edges for different thresholds (Fig. 11).The threshold value was determined based on the statistical parameters of the image, such as the mean value and standard deviation, which were calculated by histogram analysis.It has been investigated that the standard deviations calculated for the entire ROI do not allow one to satisfactorily separate the samples classified as OK and NOK.The other basic image processing operations, thresholding, and morphological operations have been applied.Thresholding involves transforming an image so that pixels with values above or below a certain fixed threshold (set by the user) are assigned to one of two categories.It is a popular method of image segmentation that allows separation of objects from the background based on their intensity or pixel values.Morphological operations, on the other hand, modify the shape and structure of objects in an image on their geometric properties.Global methods based on the control of the parameters of the entire working area (limited by ROI) do not give a satisfactory evaluation efficiency.Adaptive selection on the basis of standard deviation and mean is not effective enough.There is a false positive problem presented in Figure 12 and a false negative problem shown in Figure 13.
In the second approach, an algorithm has been applied to assess local image properties.In this method, defect detection is carried out using image profile analysis.For that reason, it is crucial to specify parameters for image processing: rotation angle, profile positions, profile lengths, number of profiles in a set, and the like.These parameters can be adjusted depending on the specific requirements of the application.Then the image is loaded and, based on the defined profile positions and other parameters, sets of profiles are extracted from the image.For each set, an average profile is calculated by averaging the pixel values along the profile lines.The resulting profiles are subjected to highpass filtering to remove waviness.The differences between the maximum and minimum values for each profile are then calculated.Based on these, detection thresholds are determined; If any of the values exceed the threshold, a defect is considered to have occurred, NOK; otherwise, OK.
Differences in the way each type of defect is detected are related to the arrangement of the profiles in the image: • Detecting defects related to a recoater streaking To detect this defect, the image is rotated in parallel with the direction of powder distribution, which is important for the accuracy of defect detection.
• Detection of defects related to the recoater hopping phenomenon Detection of this defect is also done using image profile analysis.First, the image is rotated 90°.Profiles are then extracted from the image in the same way as for detecting defects related to streak wear.
• Detection of non-directional defects like a super-elevation This defect is detected by both previous algorithms assuming that the profiles are sufficiently dense placed or where according to the CAD model the printing occurs.
It is possible to generate visualizations of the images and graphs obtained as a result of the processing presented in Figure 14. Figure 15, 16, and 17 show the profiles of pixel brightness (deviation from the mean), crossing the markers for selected images (Fig. 14).
It can be seen in Figure 15 that profiles crossing red (1) and blue (5) markers show the higher deviation from mean pixel brightness, which corresponds to the super-elevation case.
It can be seen in Figure 16 that profiles crossing red (1), yellow (2) and green (3) markers show the much highest deviation which corresponds to the recoater streaking.
Figure 17 presents profile lines for case where the powder layer has been distributed without defects.It can be noticed that each brightness profile (1-7) is similar to each other and that its deviation from the mean brightness is relatively low.

Evaluation of algorithm effectiveness
After the algorithm its effectiveness has been analyzed.It can be seen in Table 2, the algorithm has the highest efficiency in detecting that the surface of the distributed powder is correct.For all images with defects, an efficiency of 88% was achieved for 600 selected images with 3 groups of NOK's and OK (Table 2).Intensive work is  currently underway to improve the effectiveness of the algorithm and increase its efficiency.

CONCLUSIONS
In the process of 3D metal printing, there can be defects in the distribution of powder by the recoater.They have various forms and can be caused by recoater streaking, recoater hopping, super-elevation and other reasons (not researched in this study): • The study identified defects that occur during the powder distribution process.These include: recoater streaking, recoater hopping, and super-elevation.• Global image processing algorithms, as mean gradient and standard deviation, do not allow for effective image classification.• The Algorithm involving profile analysis developed and implemented in the MatLab environment allows satisfactory performance in evaluating defects including: recoater streaking, recoater hopping, and super-elevation.The advantage of the developed algorithm is that it uses the difference in shades of gray rather than the gray value itself, so that the algorithm is partly adaptive to lighting conditions (and does not depend so much on lighting).• The highest algorithm efficiency (100%) has been obtained for OK cases.In case of defects, efficiency drops slightly, however, it is still relatively high (93% for recoater streaking and super-elevation, 90% for recoater hopping)

Fig. 1 .
Fig. 1.CAD model of the powder feeding and spreading system, version with powder hopper, CAD model (a) and its physical realization (b), the set-up used for the test of the algorithm detecting powder layer defects, CAD model (c), physical set-up (d)

Fig. 3 .
Fig. 3. Vision system for assessment of powder distribution quality (a), vision system over the working field (b)

Fig. 4 .Fig. 5 .
Fig. 4. The images showing a super-elevation defect in the powder layer

Figure 8
Figure8shows a diagram of how the developed system works in practice.Once the powder is distributed through the recoater, the printer's PLC sends a signal (trigger) to the vision system and then can determine the quality of the powder distribution.In practice, this means that a photo is taken, processed, and analyzed.On the basis of the analysis and specified parameters, an evaluation algorithm decides whether the surface quality of the distributed powder is adequate.If so, the printing process continues, and then more layers of powder are distributed.If a defect is detected on the surface of the powder, actions specified by the station operator are taken (e.g., an alarm is triggered, the

Fig. 8 .Fig. 9 .
Fig. 8. Simplified algorithm of the vision system for quality assessment of the metal powder distribution

Table 2 .
Effectiveness of the algorithm based on local image properties assessment