• Contact sales

Automating Electron Beam Free Form Fabrication with MATLAB

By Bill Seufzer Ph.D., NASA Langley Research Center

On the International Space Station and other long-term space missions, the ability to replace a broken part on a critical system can turn a potential mission failure into a success. But how can astronauts fabricate parts or tools in microgravity, and hundreds of miles above the earth's surface?

Electron Beam Free Form Fabrication (EBF3) technology offers a possible solution. Invented at NASA Langley Research Center, EBF3 is a layer additive manufacturing process for metals that uses an electron beam energy source and wire feed stock to build 3D objects by adding material (primarily aluminum and titanium alloys) layer by layer. NASA Langley's current system is based on a Sciaky electron beam welder that has been used in industrial plants for years (Figures 1a and 1b). Electron beam welders are well-suited to space applications because they must be operated in a vacuum and function well in microgravity.

Figure 1a. The electron beam welder at the NASA Langley Research Center.


Figure 1a. The electron beam welder at the NASA Langley Research Center.

Figure 1b. Electron beam freeform welding.


Figure 1b. Electron beam freeform welding.

Until recently, however, fabricating even relatively simple shapes using the electron beam welder was a labor-intensive manual process that required close supervision by a skilled operator. At NASA Langley, we’ve developed a control system in MATLAB® that fully automates the process and is capable of producing complex titanium and aluminum components from a 3D representation created in CAD software.

The interactive environment and object-oriented programming features of MATLAB simplified each stage in the control development process: developing robotic controls, adding support for reading shape data from Standard Tessellation Language (STL) files, and incorporating measurement and image acquisition capabilities.

Generating Control Code with MATLAB

In the manual EBF3 process, an engineer wrote instructions in G-code, a computer numerical control programming language. These instructions would, for example, turn on the electron beam and set its intensity, start feeding the wire to initiate a molten pool of metal, and move the robotic welder to create a bead of metal. Because the precise thickness of the bead cannot be predetermined, the engineer had to estimate where the next layer should begin. If the estimate was off, the engineer had to manually readjust the height of the welding platform during deposition. Even with specialized skills and knowledge, it was a challenge to write the G-code and shepherd the process to completion for any part more complicated than a basic 3D shape.

Our first priority in automating this process was to simplify the creation of G-code for more complex shapes, such as the orthogrid geometries used to reinforce cryogenic tanks (Figure 2). The G-code for such structures was difficult to write by hand, particularly the code needed to prevent excessive amounts of material from being deposited at the intersections.

Figure 2. A rough orthogrid structure, created with G-code generated by MATLAB.


Figure 2. A rough orthogrid structure, created with G-code generated by MATLAB.

Our solution was to develop a MATLAB script that could automatically generate G-code for creating a complex object from a description of the object’s points of interest. Given a description of the grid shown in Figure 2, for example, the MATLAB script generates commented G-code to turn the beam on, set the appropriate power settings, move the robotic welder through the points needed to fabricate the grid, and then turn the beam off.

Fabricating Parts from CAD Files

Some of the shapes we fabricate are designed using CAD software packages, which can export designs as STL files. Our next automation step was to read these STL files directly using MATLAB and then generate the G-code needed to fabricate the shapes they defined.

We wrote MATLAB code that parses STL files to obtain a 3D representation of a shape (Figure 3). The code then slices the shape into layers that are approximately the thickness of the metal bead deposited by the welder.

Figure 3. MATLAB visualization of the part as defined in the STL file.


Figure 3. MATLAB visualization of the part as defined in the STL file.

For example, given a target height of 1 inch and a thickness of 0.025 inches, the MATLAB code applies geometric calculations to identify the points at which the shape and a plane 1 inch above its base would intersect (Figure 4).

Figure 4. Three layers of the 3D shape, each consisting of a set of unordered points.


Figure 4. Three layers of the 3D shape, each consisting of a set of unordered points.

The MATLAB code orders those points into a logical welder tool path (Figure 5) and generates G-code for that layer. As we developed this code, we used MATLAB to visualize the 3D shapes, the individual layers, and the resultant tool paths for those layers.

Figure 5. A set of points describing the welder tool path for a single layer.


Figure 5. A set of points describing the welder tool path for a single layer.

Incorporating Instrumentation

Having automated the process of producing G-code to create an arbitrary 3D shape, we turned our attention to the welding process. Because it is impossible to precisely control the height of the metal bead produced by the welder, the thickness of each deposited layer may vary. Although layer thickness typically varies from what was expected by less than 0.002 inches, when several hundred layers are required to form a part, repeating even a small error on each layer can cause a noticeable discrepancy between the part’s height as designed and its height as fabricated. The operator cannot manually adjust the height of the welder to correct for this error.

Our solution is a laser measuring system called Sequential Horizontal Automated Z-Axis Measurement, or SHAZAM. Controlled via Instrument Control Toolbox, this system directs a laser beam onto the part being fabricated to determine its current height. The MATLAB code uses this value to select the location of the next slice to fabricate. This basic feedback control enables us to reproduce the original design much more accurately and with less manual intervention from the welder operator (Figure 6).

Figure 6. The part shown in Figure 5, partially fabricated after multiple layers have been deposited.


Figure 6. The part shown in Figure 5, partially fabricated after multiple layers have been deposited.

Our next process refinement focused on tightening control of the bead. Specifically, we wanted to automatically adjust the power of the electron beam based on the size of the molten pool of metal at the weld point. To deposit a uniform bead, we needed to reduce power when the molten pool became too large and increase power when the pool became too small. Again, this task is typically handled manually by the operator, and requires substantial experience.

To automate this part of the process, we set up an 8-bit black-and-white camera to photograph the welding. We used Image Acquisition Toolbox to import images from the camera, and Image Processing Toolbox and Fuzzy Logic Toolbox to programmatically determine when the size of the molten pool required adjustment. It’s easier to express the empirical observations of a machine operator in fuzzy logic than to describe them in an equation. We can simply tune the fuzzy logic until we get the results we want. Based on the fuzzy interference system we created, the MATLAB code adjusts the beam current via Instrument Control Toolbox and an RS-232 link to the welder’s computer.

Assembling the Complete Control System

The complete control system consists of a console PC and an instrumentation PC running MATLAB code, and Sciaky’s embedded computer, which controls the robotics. On the instrumentation PC, a MATLAB application known as the choreographer generates the G-code from the STL file. It sends this code to the console PC, where the code is compiled and uploaded to the welder’s embedded computer. The choreographer then signals the welder to begin welding.

As the layer is being deposited, the MATLAB closed-loop controller monitors the molten pool and adjusts the beam current as needed. When the layer is complete, the choreographer instructs the welder to move SHAZAM into place and measure the height of the part. It then takes the next slice from the STL file based on the current height, and the process repeats until the part is complete. A key benefit of MATLAB in this domain is its ability to integrate and coordinate disparate technologies, including the G-code generating software, the welder, the camera, and the laser measurement system.

Development and maintenance of the more than 12,000 lines of MATLAB code that the system comprises have been simplified by applying object-oriented programming techniques. The SHAZAM device, for example, is represented as an object that is accessed via well-defined methods such as s.open() and s.measure. The object-oriented code is almost self-documenting, and is much easier to debug than a set of scattered subroutines (Figure 7).

classdef shazam < handle
        lmu         % Laser measurement unit (Acuity® AR 700)
        zab         % interface to the Zaber® vacuum rated actuator
        w2kOffset   % [x y z] vector offset of probe to the welder
        points      % a set of points to measure [x y z t]
        results     % the result of measurements
        portLmu = 'com2';
        portZab = 'com3';
        % not a complete set of methods
        function open(sha)
            % function to simplify typing for manual operations
            % open the shield door
        function measure(sha,w2k)
            % at each point make a Z axis measurement
            for x=1:size(sha.points,1)
                % move the probe above the point
                % get the X and Y coordinates
                curPos = sha.points(x,:);
                % get measurement (Z)
                curPos(3) = sha.height;
                % record the location
                sha.results(x,:)= curPos;
Figure 7. SHAZAM classdef object. This object encapsulates two serial interfaces, one to the Acuity laser, and the other to a Zaber actuator that opens and closes a door that protects the laser.

Using MATLAB we can interactively inspect any object at any time. The object-oriented approach also makes adding new capabilities to the system easier. We are currently testing a system that uses the camera to detect problems with the wire feeder and thermocouples to monitor the temperature of the base plate that holds the part during fabrication.

We have already field-tested a miniature version of our EBF3 welding system aboard NASA’s reduced-gravity aircraft. We have also used the technology in a number of practical applications. For example, an aerospace company that we work with asked us to produce a 4-pound part to demonstrate the potential materials and labor-saving benefit of the EBF3 process. The shape of the part would have required them to start with a 400-pound titanium billet, which would lead to a great deal of waste and would have required weeks to machine. Using our system, I produced a rough version of the part weighing just 23 pounds in one day. Starting with this part instead of the 400-pound block eliminated two weeks of machining and reduced the amount of titanium needed by more than 80%.

Published 2012 - 92009v00

Receive the latest MATLAB and Simulink technical articles.

Related Resources

Latest Blogs