# An Architecture for Hybrid Manufacturing Combining 3D Printing and CNC Machining

Authors: Marcel Müller; Elmar Wings
Journal: International Journal of Manufacturing Engineering
 (2016)

---

## Abstract

Additive manufacturing is one of the key technologies of the 21st century. Additive manufacturing processes are often combined with subtractive manufacturing processes to create hybrid manufacturing because it is useful for manufacturing complex parts, for example, 3D printed sensor systems. Currently, several CNC machines are required for hybrid manufacturing: one machine is required for additive manufacturing and one is required for subtractive manufacturing. Disadvantages of conventional hybrid manufacturing methods are presented. Hybrid manufacturing with one CNC machine offers many advantages. It enables manufacturing of parts with higher accuracy, less production time, and lower costs. Using the example of fused layer modeling (FLM), we present a general approach for the integration of additive manufacturing processes into a numerical control for machine tools. The resulting CNC architecture is presented and its functionality is demonstrated. Its application is beyond the scope of this paper.


---

## Body

## 1. Introduction

Modern machine tools are controlled by a computerized numerical control (CNC). For this reason, manufacturing processes, for example, drilling, turning, and milling, are also referred to as CNC machining when the machine tool is controlled by a CNC. The main task of the CNC is to control the relative motion of the tool and the workpiece. All these tools cut away unwanted material to manufacture a part with the desired geometry. Therefore, these processes are also referred to as subtractive manufacturing. Further subtractive manufacturing processes are reaming, threading, or laser cutting, plasma cutting, and water cutting. Because of their commonalities, some processes are contained in one machine. For example, most milling machines allow a tool change so that a drill or reamer can be used. A milling machine with an automatic tool changer and an automatic workpiece changer is called a machining center. A fourth axis offers further processes, for example, threading and turning. The machining center described could carry out many manufacturing processes. The combination of different processes in one machine facilitates more economical manufacturing because, for example, the quantity of clamping can be reduced. Furthermore, the costs of purchase and upkeep for one machine are often lower than for two [1, 2].In contrast to the subtractive manufacturing processes, additive manufacturing processes add material to manufacture parts with the desired geometries. This enables waste reduction because unwanted material will not be added. Particular process steps, such as drilling, do not have to be applied; for example, a hole is formed by not adding material in the desired position.This paper [3] focuses on energy consumption and indicates that accurate assessment and modeling of manufacturing processes are becoming increasingly important. The case study presented shows that additive manufacturing has greater advantages than conventional manufacturing processes when the number of parts was small. In addition, additive manufacturing offers new manufacturing strategies and makes customized solutions possible, even for small quantities. Furthermore, additive manufacturing makes production on demand and production on site possible [1, 2, 4]. All these properties indicate that additive manufacturing is a key technology for economical manufacturing. Depending on the additive manufacturing processes, postprocessing is required for good results. The postprocessing can be done manually or automatically by CNC machining [1, 2]. The processes of additive manufacturing are completely different to subtractive manufacturing processes, although they have many commonalities, which are outlined later in this paper. Additionally, [5, 6] suggest that a combination of subtractive and additive manufacturing processes is recommended.This paper describes a general approach for combining subtractive and additive manufacturing in one CNC architecture. In this paper, we will use the term hybrid manufacturing to describe the combination. In Section2, conventional methods for hybrid manufacturing and its disadvantages are discussed. In Section 3, the fused layer modeling (FLM) process and special benefits of combining FLM with CNC machining are presented. Section 4 highlights the objective of this paper and Section 5 presents commonalities and differences between FLM and CNC machining. The approach is presented in Section 6, but its implementation is divided into several sections: Section 7 describes temperature control, Section 8 describes temperature measurement for temperature control, Section 9 describes physical computing for communication, and Section 10 describes motion control. Section 11 describes the operation principle of the resulting CNC architecture for FLM. Finally, Section 12 concludes the paper.


## 2. State of the Art

A manually organized workpiece transport is flexible but not effective: each machine requires reclamping and its own setup, which takes time and reduces the achievable accuracy [2]. Therefore, a production strategy is required.


### 2.1. Hybrid Manufacturing with a Production Line

A production line with machines which complement each other is illustrated in Figure1. Machines are labeled with rectangles and processes are labeled with letters. On the one hand, the automatic workpiece transport system of the production line reduces the quantity of clamping and setup, increasing the productivity and achievable accuracy. On the other hand, the production line takes up much space and flexibility is reduced. There is no possibility of manufacturing parts which need variants of the process order. This strategy is optimal for manufacturing identical parts but not individual parts; this is a significant disadvantage because one of the main advantages of additive manufacturing is making customized solutions possible, even for small quantities [1, 2, 4]. Therefore, another strategy is required.Figure 1
Production line with machines which complement each other.


### 2.2. Hybrid Manufacturing with a Machining Center in a Production Line

As previously described, a machining center combines several manufacturing processes in one machine (see Figure2). This enables several different process steps with a minimum of clamping to reduce time and costs. For example, a machining center which carries out the processes B, C, and D can carry out several process orders (BCD, CBD, CDB, …). In addition to the manufacturing processes, the machining center can also be equipped with a measurement system to save a separate measuring machine. This enables the reduction of required space and can be more economical because fewer machines and buffers are needed between the machines. Referring to Figures 1 and 2, the failure of one machine stops the production of the whole line. In contrast to a production line with complementary machines, the production with machining centers enables a concept in which the machines complement and cover each other. An alternative concept to a production line is a flexible manufacturing system (FMS) [2].Figure 2
Production line with machines and a machining center.


### 2.3. Hybrid Manufacturing with a Flexible Manufacturing System

The process steps are distributed to particular machines or machining centers which are connected by a rotating workpiece transport system (see Figure3). The common workpiece transport system offers a minimum of clamping. Each machining center offers different and/or equivalent processes to complement and/or cover the others. The advantage of such an FMS is maximum flexibility. The failure of one machine does not stop the entire production because another machine covers the failed process. Furthermore, different process times do not have to be compensated for by synchronizing machines if agent-based dynamic scheduling for flexible manufacturing systems arranges an intelligent and flexible process order [2, 7, 8]. Scheduling is a separate issue that could fill many papers. Nevertheless, subtractive and additive manufacturing can be combined with an FMS. In some cases, an FMS could be best practice, but an FMS needs a great deal of room and is not the least expensive or most economical variant in every case.Figure 3
Flexible manufacturing system with a rotating workpiece transport system and machines which complement and cover each other.


### 2.4. Different Process Times as Bottleneck

The main problem with the combination of subtractive and additive manufacturing can be the difference in the process times when subtractive manufacturing is only used for postprocessing or short intermediate steps, for example, threading a thread, reaming a fit, or finishing single contours. With a focus on the different process times, the subtractive machine is uneconomical when only one machine for additive manufacturing is available. Depending on the different process times, it could also be uneconomical with two or three additive machines when the subtractive manufacturing processes are ten times faster than the additive. Irrespective of this problem, such an FMS is not applicable in every company. Therefore, a large-scale integrated machining center which provides both additive and subtractive manufacturing could be a better application.


### 2.5. Hybrid Manufacturing with a Large-Scale Integrated Machining Center

A large-scale integrated machining center prevents other machines from becoming uneconomical when one machining center fails because a large-scale integrated machining center produces independently from the others. Furthermore, the production rate can be increased using less space when large-scale integrated machining centers are used (see Figure4).Figure 4
Production with machines which cover each other.As a result, it is the best application when the additive machine offers additional subtractive manufacturing processes. This is a new kind of machining center which needs a common control providing additive and subtractive manufacturing. However, up to now, no control has been found which supports both kinds of processes. Therefore, process integration has to be carried out which requires specific process knowledge.


## 2.1. Hybrid Manufacturing with a Production Line

A production line with machines which complement each other is illustrated in Figure1. Machines are labeled with rectangles and processes are labeled with letters. On the one hand, the automatic workpiece transport system of the production line reduces the quantity of clamping and setup, increasing the productivity and achievable accuracy. On the other hand, the production line takes up much space and flexibility is reduced. There is no possibility of manufacturing parts which need variants of the process order. This strategy is optimal for manufacturing identical parts but not individual parts; this is a significant disadvantage because one of the main advantages of additive manufacturing is making customized solutions possible, even for small quantities [1, 2, 4]. Therefore, another strategy is required.Figure 1
Production line with machines which complement each other.


## 2.2. Hybrid Manufacturing with a Machining Center in a Production Line

As previously described, a machining center combines several manufacturing processes in one machine (see Figure2). This enables several different process steps with a minimum of clamping to reduce time and costs. For example, a machining center which carries out the processes B, C, and D can carry out several process orders (BCD, CBD, CDB, …). In addition to the manufacturing processes, the machining center can also be equipped with a measurement system to save a separate measuring machine. This enables the reduction of required space and can be more economical because fewer machines and buffers are needed between the machines. Referring to Figures 1 and 2, the failure of one machine stops the production of the whole line. In contrast to a production line with complementary machines, the production with machining centers enables a concept in which the machines complement and cover each other. An alternative concept to a production line is a flexible manufacturing system (FMS) [2].Figure 2
Production line with machines and a machining center.


## 2.3. Hybrid Manufacturing with a Flexible Manufacturing System

The process steps are distributed to particular machines or machining centers which are connected by a rotating workpiece transport system (see Figure3). The common workpiece transport system offers a minimum of clamping. Each machining center offers different and/or equivalent processes to complement and/or cover the others. The advantage of such an FMS is maximum flexibility. The failure of one machine does not stop the entire production because another machine covers the failed process. Furthermore, different process times do not have to be compensated for by synchronizing machines if agent-based dynamic scheduling for flexible manufacturing systems arranges an intelligent and flexible process order [2, 7, 8]. Scheduling is a separate issue that could fill many papers. Nevertheless, subtractive and additive manufacturing can be combined with an FMS. In some cases, an FMS could be best practice, but an FMS needs a great deal of room and is not the least expensive or most economical variant in every case.Figure 3
Flexible manufacturing system with a rotating workpiece transport system and machines which complement and cover each other.


## 2.4. Different Process Times as Bottleneck

The main problem with the combination of subtractive and additive manufacturing can be the difference in the process times when subtractive manufacturing is only used for postprocessing or short intermediate steps, for example, threading a thread, reaming a fit, or finishing single contours. With a focus on the different process times, the subtractive machine is uneconomical when only one machine for additive manufacturing is available. Depending on the different process times, it could also be uneconomical with two or three additive machines when the subtractive manufacturing processes are ten times faster than the additive. Irrespective of this problem, such an FMS is not applicable in every company. Therefore, a large-scale integrated machining center which provides both additive and subtractive manufacturing could be a better application.


## 2.5. Hybrid Manufacturing with a Large-Scale Integrated Machining Center

A large-scale integrated machining center prevents other machines from becoming uneconomical when one machining center fails because a large-scale integrated machining center produces independently from the others. Furthermore, the production rate can be increased using less space when large-scale integrated machining centers are used (see Figure4).Figure 4
Production with machines which cover each other.As a result, it is the best application when the additive machine offers additional subtractive manufacturing processes. This is a new kind of machining center which needs a common control providing additive and subtractive manufacturing. However, up to now, no control has been found which supports both kinds of processes. Therefore, process integration has to be carried out which requires specific process knowledge.


## 3. The Fused Layer Modeling Process

This paper focuses on fused layer modeling (FLM), a generic name for the fused deposition modeling (FDM) developed by S. Scott Crump and trademarked (http://www.trademarkia.com/fdm-74133656.html) by Stratasys, Inc. In the context of the RepRap project (http://www.reprap.org/), an ongoing project that made and freely distributed a replicating rapid prototyper, FLM is also called fused filament fabrication (FFF). As described in [1], FLM is an extrusion process in which thermoplastic material (filament) is continuously squeezed through a nozzle and deposited on a substrate. The material’s energy suffices to fuse the substrate; after cooling down, a permanent connection is available. In contrast to other additive processes, the FLM is suitable for both prototyping and production applications because parts with a high mechanical load capacity can be produced. Referring to the RepRap project, a wide range of users choose the fused layer modeling [1, 9, 10].


### 3.1. Materials for Fused Layer Modeling

Generally, plastics are used with fused layer modeling, for example, polylactide (PLA), acrylonitrile butadiene styrene (ABS), polycarbonates (PC), or combined plastics, for example, PC-ABS. There are also types of plastic that can be sterilized by gamma or by ethylene oxide for medical technologies. In addition, with small modifications, materials other than plastics can be processed, such as metals and ceramics [1, 11–13].


### 3.2. Fast Hybrid Manufacturing for Higher Accuracy

As described previously, additive manufacturing can be done without subtractive manufacturing processes, for example, drilling. Generally, this also applies to fused layer modeling. The postprocessing was cited as a reason for combining both. This will now be explained with a focus on FLM. The achievable accuracy depends on many parameters, for example, the layer height and nozzle diameter. If the layer height or the nozzle diameter is too large, the resulting staircase effect will reduce accuracy and surface quality of the part as well as the production time. Therefore, postprocessing is required. Improvement of surface finish by staircase machining in fused deposition modeling is outlined in [14]. Generally, a smaller nozzle diameter can increase the achievable accuracy (see Figure 5) but also increases manufacturing time, whereas a larger diameter can reduce manufacturing time but also reduces the achievable accuracy (see Figure 6(a)). An approach will be explained for manufacturing a part with accurate holes for fit. Firstly, the part is manufactured with undersized holes using a large nozzle diameter (see Figure 6(a)). Thereafter, the holes are rebored. This strategy enables an optimal result with accurate holes and minimum production time (see Figure 6(b)). This concept is also applicable to threads and other fields requiring high accuracy.Figure 5
Additive part manufactured by FLM with a small nozzle diameter and layer height.Figure 6
Additive part manufactured by FLM and subtractive postprocessed by drilling.
(a)
Undersized hole (b)
Drilled out hole


## 3.1. Materials for Fused Layer Modeling

Generally, plastics are used with fused layer modeling, for example, polylactide (PLA), acrylonitrile butadiene styrene (ABS), polycarbonates (PC), or combined plastics, for example, PC-ABS. There are also types of plastic that can be sterilized by gamma or by ethylene oxide for medical technologies. In addition, with small modifications, materials other than plastics can be processed, such as metals and ceramics [1, 11–13].


## 3.2. Fast Hybrid Manufacturing for Higher Accuracy

As described previously, additive manufacturing can be done without subtractive manufacturing processes, for example, drilling. Generally, this also applies to fused layer modeling. The postprocessing was cited as a reason for combining both. This will now be explained with a focus on FLM. The achievable accuracy depends on many parameters, for example, the layer height and nozzle diameter. If the layer height or the nozzle diameter is too large, the resulting staircase effect will reduce accuracy and surface quality of the part as well as the production time. Therefore, postprocessing is required. Improvement of surface finish by staircase machining in fused deposition modeling is outlined in [14]. Generally, a smaller nozzle diameter can increase the achievable accuracy (see Figure 5) but also increases manufacturing time, whereas a larger diameter can reduce manufacturing time but also reduces the achievable accuracy (see Figure 6(a)). An approach will be explained for manufacturing a part with accurate holes for fit. Firstly, the part is manufactured with undersized holes using a large nozzle diameter (see Figure 6(a)). Thereafter, the holes are rebored. This strategy enables an optimal result with accurate holes and minimum production time (see Figure 6(b)). This concept is also applicable to threads and other fields requiring high accuracy.Figure 5
Additive part manufactured by FLM with a small nozzle diameter and layer height.Figure 6
Additive part manufactured by FLM and subtractive postprocessed by drilling.
(a)
Undersized hole (b)
Drilled out hole


## 4. Objective

As described above, there are good reasons to add the subtractive manufacturing processes to an additive manufacturing machine instead of using an FMS with different machines. Considering the mechanical load occurring with subtractive manufacturing, it is much better to equip a subtractive manufacturing machine with the additive manufacturing tool instead of equipping an additive manufacturing machine with the subtractive manufacturing tool. Therefore, the objective of the development work carried out at the Institut für Maschinen und Anlagenbau was to integrate the process of fused layer modeling into a CNC which is designated for subtractive manufacturing. This offers the development of machining centers combining both subtractive manufacturing and additive manufacturing.


## 5. Commonalities and Differences between FLM and CNC Machining

As described above, the processes of additive manufacturing are completely different than subtractive manufacturing processes, though they have many commonalities. These commonalities and differences are outlined in the following, with a focus on FLM and CNC machining.


### 5.1. Commonalities

As described above, a machining center could offer many different manufacturing processes. For this reason, the CNC provides many process-specific functions for a wide range of processes [2].Both kinds of manufacturing processes (subtractive and additive) need a precise control to move the tool and the workpiece on several axes. The movement is determined by an NC program code written in G-code, whereas the process-specific functions are determined by miscellaneous functions (M-codes). The NC program can be generated with computer-aided manufacturing (CAM) software from a drawing created using computer-aided design (CAD) software.Furthermore, the CNC needs sensors to collect data about the tool and the working area. In addition, actuators, for example, cooling aggregates, have to be controlled. On these grounds, a common CNC is a good choice.Generally, the process of FLM is not restricted to specific machine kinematics. Unusual kinematics is as suitable as trivial three-axis kinematics for tool and workpiece positioning. The focus is on simple three-axis kinematics, because it is often used for both kinds of processes.


### 5.2. Differences

The subtractive process needs a clamping device to withstand the mechanical load occurring during manufacturing. Such a clamping device is not intended for FLM. Experiments at the Institut für Maschinen und Anlagenbau in Emden and recommendations of the RepRap project indicate that a heating bed improves the FLM process. Therefore, a heated clamping device as a combination of both is needed. This could be achieved with a heated vacuum clamp. The challenge of engineering such a heated vacuum clamp is to prevent the additive manufactured parts from absorbing and deforming while clamping.In addition, a special extrusion tool is required. In contrast to milling and threading, a further axis is needed inside the tool for accurately defined motions of the filament for predefined deposing. This tool has to be compatible with existing tool holder and tool changer systems.Furthermore, the process-specific M-codes of additive manufacturing are completely different from M-codes for subtractive manufacturing. These M-codes have to be integrated into the CNC to make additive manufacturing possible. The challenge is to make a minimum of modifications and protect the integrity of existing M-codes.


## 5.1. Commonalities

As described above, a machining center could offer many different manufacturing processes. For this reason, the CNC provides many process-specific functions for a wide range of processes [2].Both kinds of manufacturing processes (subtractive and additive) need a precise control to move the tool and the workpiece on several axes. The movement is determined by an NC program code written in G-code, whereas the process-specific functions are determined by miscellaneous functions (M-codes). The NC program can be generated with computer-aided manufacturing (CAM) software from a drawing created using computer-aided design (CAD) software.Furthermore, the CNC needs sensors to collect data about the tool and the working area. In addition, actuators, for example, cooling aggregates, have to be controlled. On these grounds, a common CNC is a good choice.Generally, the process of FLM is not restricted to specific machine kinematics. Unusual kinematics is as suitable as trivial three-axis kinematics for tool and workpiece positioning. The focus is on simple three-axis kinematics, because it is often used for both kinds of processes.


## 5.2. Differences

The subtractive process needs a clamping device to withstand the mechanical load occurring during manufacturing. Such a clamping device is not intended for FLM. Experiments at the Institut für Maschinen und Anlagenbau in Emden and recommendations of the RepRap project indicate that a heating bed improves the FLM process. Therefore, a heated clamping device as a combination of both is needed. This could be achieved with a heated vacuum clamp. The challenge of engineering such a heated vacuum clamp is to prevent the additive manufactured parts from absorbing and deforming while clamping.In addition, a special extrusion tool is required. In contrast to milling and threading, a further axis is needed inside the tool for accurately defined motions of the filament for predefined deposing. This tool has to be compatible with existing tool holder and tool changer systems.Furthermore, the process-specific M-codes of additive manufacturing are completely different from M-codes for subtractive manufacturing. These M-codes have to be integrated into the CNC to make additive manufacturing possible. The challenge is to make a minimum of modifications and protect the integrity of existing M-codes.


## 6. Approach

This approach is based on a fully assembled CNC machine, or, more precisely, a three-axis CNC milling machine. The process of fused layer modeling is integrated into the existing CNC architecture.


### 6.1. CNC Architecture for FLM

For this approach, a CNC with a customizable architecture is required. The CNC has to offer possibilities for the integration of new hardware, additional M-codes, and self-developed (sub)programs. Furthermore, a programmable logical controller (PLC) is required, because it is an essential component of the CNC architecture. For this approach, an internal PLC is used which is integrated into the CNC software.Figure7 shows a CNC architecture for FLM. Several components are integrated into the previously existing CNC architecture for enabling FLM. All components are interconnected by a common interface: the hardware abstraction layer. The CNC core, the PLC, and the human machine interface (HMI) are standard components of a CNC [2]. Therefore, the previously existing CNC architecture offers these components although they are modified. The modifications are outlined later in this paper. Furthermore, the fully assembled CNC machine offers a motion controller with its sensors and actuators for three axes, which are used for positioning the FLM tool. A further axis is required for filament transport. Its integration is outlined later in this paper. But the temperature controller is not a CNC standard component. The integration of the temperature controller with its sensors and actuators is a major part of this approach. These hardware components of the temperature control are controlled by a software component called microcontroller interface (μCI). The modification of the previously existing CNC components and the integration of the new components are outlined in this paper.Figure 7
The extended CNC architecture for fused layer modeling.


### 6.2. G-Codes and M-Codes

As described above, the manufacturing process is specified with NC programs. There are three basic standards for NC programs: RS-274-D [15] (Extended Gerber RS-274X [16]); DIN 66025 [17, 18]; and ISO 6983 [19]. But no NC program standard defines M-codes for the fused layer modeling. Therefore, particular M-codes, which are defined by the RepRap project (http://www.reprap.org/wiki/G-code) (see Table 1), are used in this paper. These M-codes are accepted by a wide range of CAM software programs (slicers), developers, and users. The CNC-Core’s interpreter needs to know these M-codes and their meaning. The M-codes M104, M140, M141, M109, M190, and M191 are designed for setting process-specific temperatures. The M-codes M109, M190, and M191 have the additional function of waiting until the temperature has been reached. The functionality can be implemented with (sub)programs. Each M-code calls up a (sub)program with well-defined functions regarding temperature control.Table 1
M-codes needed for fused layer modeling (FLM).
Command Meaning M104 Pvalue Set hot-end temperature tovalue  M106 Pvalue Set speed of hot-end cooling fan tovalue  M107 Set hot-end cooling fan off  M109 Pvalue Set hot-end temperature tovalue and wait  M140 Pvalue Set heating bed temperature tovalue  M141 Pvalue Set work space temperature tovalue  M190 Pvalue Set heating bed temperature tovalue and wait  M191 Pvalue Set work space temperature tovalue and wait


## 6.1. CNC Architecture for FLM

For this approach, a CNC with a customizable architecture is required. The CNC has to offer possibilities for the integration of new hardware, additional M-codes, and self-developed (sub)programs. Furthermore, a programmable logical controller (PLC) is required, because it is an essential component of the CNC architecture. For this approach, an internal PLC is used which is integrated into the CNC software.Figure7 shows a CNC architecture for FLM. Several components are integrated into the previously existing CNC architecture for enabling FLM. All components are interconnected by a common interface: the hardware abstraction layer. The CNC core, the PLC, and the human machine interface (HMI) are standard components of a CNC [2]. Therefore, the previously existing CNC architecture offers these components although they are modified. The modifications are outlined later in this paper. Furthermore, the fully assembled CNC machine offers a motion controller with its sensors and actuators for three axes, which are used for positioning the FLM tool. A further axis is required for filament transport. Its integration is outlined later in this paper. But the temperature controller is not a CNC standard component. The integration of the temperature controller with its sensors and actuators is a major part of this approach. These hardware components of the temperature control are controlled by a software component called microcontroller interface (μCI). The modification of the previously existing CNC components and the integration of the new components are outlined in this paper.Figure 7
The extended CNC architecture for fused layer modeling.


## 6.2. G-Codes and M-Codes

As described above, the manufacturing process is specified with NC programs. There are three basic standards for NC programs: RS-274-D [15] (Extended Gerber RS-274X [16]); DIN 66025 [17, 18]; and ISO 6983 [19]. But no NC program standard defines M-codes for the fused layer modeling. Therefore, particular M-codes, which are defined by the RepRap project (http://www.reprap.org/wiki/G-code) (see Table 1), are used in this paper. These M-codes are accepted by a wide range of CAM software programs (slicers), developers, and users. The CNC-Core’s interpreter needs to know these M-codes and their meaning. The M-codes M104, M140, M141, M109, M190, and M191 are designed for setting process-specific temperatures. The M-codes M109, M190, and M191 have the additional function of waiting until the temperature has been reached. The functionality can be implemented with (sub)programs. Each M-code calls up a (sub)program with well-defined functions regarding temperature control.Table 1
M-codes needed for fused layer modeling (FLM).
Command Meaning M104 Pvalue Set hot-end temperature tovalue  M106 Pvalue Set speed of hot-end cooling fan tovalue  M107 Set hot-end cooling fan off  M109 Pvalue Set hot-end temperature tovalue and wait  M140 Pvalue Set heating bed temperature tovalue  M141 Pvalue Set work space temperature tovalue  M190 Pvalue Set heating bed temperature tovalue and wait  M191 Pvalue Set work space temperature tovalue and wait


## 7. Temperature Control

A temperature control is required for the extrusion process at the hot-end (nozzle). A heating bed temperature control can optimize the process during manufacturing the first layers. Furthermore, a working space temperature control and a cooling fan can optimize the process. A distributed microcontroller-based closed-loop temperature control can offer the functionalities of temperature control. Therefore, the microcontroller (μC) controls three systems: hot-end temperature, working space temperature, and cooling fan speed. A heating bed is not considered because its effect is restricted to the first layers, while a whole working space temperature control offers also effects in further layers. The principle of the three temperature control systems is similar; therefore, only the hot-end temperature control is outlined.


### 7.1. Hot-End Temperature Control

The microcontroller receives the set temperatureTset from the CNC and controls the temperature independently from the CNC with a proportional-plus-integral-plus-derivative (PID) controller algorithm. Any other control algorithm is also applicable but the PID controller algorithm is well documented in literature and easily adaptable to occurring system changes. The temperature controller needs feedback; therefore, a temperature sensor converts the actual hot-end temperature Tact to the feedback signal Tact∗. This can be done, for example, using a thermistor with negative temperature coefficient (NTC), or PT100.


### 7.2. Hot-End Closed-Loop Control

The control loop (see Figure8) focuses on hot-end temperature control. During manufacturing, the cold filament is melted inside the hot-end. Therefore, a process-related rate of heat flow Q˙1 is required to heat the filament. Q˙1 and disturbances Q˙z cause the error Te, because they are dissipating heat flows. The rate of heat flow is defined in (1), where Q is the thermal energy of the heat flow. The dissipating heat flows are detailed in Section 7.3.(1)E˙i=Q˙i=dQidt.Te is the difference between the set temperature Tset and the actual temperature Tact. But the extrusion process requires a constant temperature to manufacture parts with a constant quality. Variations in the filament’s feed rate have to be considered, because a lower feed rate requires a lower rate of heat flow Q˙1. Therefore, Te is counterbalanced by the temperature controller. The controller output TRk is calculated using (2) to eliminate the occurring error. KP, KI, and KD are the PID parameters, which designate the controller’s performance. As described in [20], this algorithm is referred to as the stand (position) algorithm because TRk is calculated for every value of the sampled data period TA. This algorithm is optimal for temperature control using a large TA. The signal TR is detailed in Section 7.4.(2)TRk=KP·Tek+KI·TA·∑i=1kTei+KD·Tek-Tek-1TA.From the point of view of the controller, THot-end=constant, or, more precisely, Tact=Tset is the objective. The heat flow rates have to be balanced for a constant hot-end temperature (see (3)). Therefore, the dissipating heat flows are explained.(3)∑i=0nQ˙i=0.Figure 8
Hot-end closed-loop temperature control.


### 7.3. Hot-End Heat Dissipation

There are two different dissipating heat flows. On the one hand, the process requires a heat flow for heating and melting the filament. This heat flow is process-related and volitional. It is described by its rate of heat flow:Q˙1. On the other hand, disturbances cause further dissipating heat flows. These are described by a common rate of heat flow: Q˙z. It is useful to separate Q˙1 and Q˙z for the process of energy optimization. Disturbances are, for example, dissipating heat flows, which are caused by thermal convection, thermal radiation, and thermal conduction. Thermal convection is caused by the cooling fan. Thermal conduction is caused by the temperature differences between, for example, the work space and the hot-end as well as the hot-end and a thermal isolator. These dissipating heat flows are summarized in (4) and Figure 9:(4)Q˙z=∑i=2nQ˙i.For practical applications, it is not necessary to determine each effect separately. Instead of considering particular Q˙i, an overall Q˙z is considered with an efficiency factor ηz. This is useful because each extrusion tool has individual disturbances. Its efficiency depends on hot-end composition, for example, the size and position of the heating resistor. The system is therefore characterized by (5). The parameter ηz characterizes the system with a minimum of expense, because Q˙0 is quantifiable by measuring the supplied electrical energy and Q˙1 is quantifiable using the filament data and the elected process parameters. Furthermore, the parameter ηz is useful for verifications of system optimizations with a minimum of expense. The greater ηz(0⋯1) the lower the disturbance.(5)Q˙0=Q˙1ηz.The fan, which is mounted near the hot-end (see Figure 9), cools the deposited filament. The microcontroller receives the set velocity vset from the CNC and controls the fan speed with an open-loop fan control (see Figure 10). vR is the amplified control signal, which controls fan speed. Z3 is the parameter which causes Q˙3 as a secondary effect during cooling of the depositing filament. The process of energy optimization and a detailed thermal analysis are beyond the scope of this paper. Firstly, they are separate issues that could fill many papers (see [21]); and secondly, it is not necessary to determine any rate of heat flow, because the controller needs only the temperature difference which is caused by the heat flows [22].Figure 9
Heat flows which are introduced and dissipated during FLM.Figure 10
Cooling fan open-loop speed control.


### 7.4. Hot-End Heat Supply

As described above, the PID algorithm calculatesTRk for compensation. TRk is modulated by the microcontroller’s pulse-width modulation (PWM) generator. The PWM signal is amplified (see Figure 11) by a metal-oxide-semiconductor field-effect transistor (MOSFET). The amplified control signal is called TR. The heating unit (see Figure 8) is the actuator. It is a heating resistor, which converts the electrical energy from the amplified signal TR into the thermal energy Q0 for heating the hot-end. The resulting rate of heat flow is called Q˙0 and counterbalances the dissipating heat flows. Q˙0 depends on the rate of electrical energy E˙el. It is roughly approximated by (6), where U is the electrical voltage; I is the electrical current; and D is the duty cycle which is caused by the PWM. The duty cycle is defined in (7), where TP is the total period of the signal and TH is the time during which the signal is active [23]. (6)Q˙0=E˙el=Pel=U·I·D,(7)D=THTP.Figure 11
Distributed microcontroller-based temperature control.


## 7.1. Hot-End Temperature Control

The microcontroller receives the set temperatureTset from the CNC and controls the temperature independently from the CNC with a proportional-plus-integral-plus-derivative (PID) controller algorithm. Any other control algorithm is also applicable but the PID controller algorithm is well documented in literature and easily adaptable to occurring system changes. The temperature controller needs feedback; therefore, a temperature sensor converts the actual hot-end temperature Tact to the feedback signal Tact∗. This can be done, for example, using a thermistor with negative temperature coefficient (NTC), or PT100.


## 7.2. Hot-End Closed-Loop Control

The control loop (see Figure8) focuses on hot-end temperature control. During manufacturing, the cold filament is melted inside the hot-end. Therefore, a process-related rate of heat flow Q˙1 is required to heat the filament. Q˙1 and disturbances Q˙z cause the error Te, because they are dissipating heat flows. The rate of heat flow is defined in (1), where Q is the thermal energy of the heat flow. The dissipating heat flows are detailed in Section 7.3.(1)E˙i=Q˙i=dQidt.Te is the difference between the set temperature Tset and the actual temperature Tact. But the extrusion process requires a constant temperature to manufacture parts with a constant quality. Variations in the filament’s feed rate have to be considered, because a lower feed rate requires a lower rate of heat flow Q˙1. Therefore, Te is counterbalanced by the temperature controller. The controller output TRk is calculated using (2) to eliminate the occurring error. KP, KI, and KD are the PID parameters, which designate the controller’s performance. As described in [20], this algorithm is referred to as the stand (position) algorithm because TRk is calculated for every value of the sampled data period TA. This algorithm is optimal for temperature control using a large TA. The signal TR is detailed in Section 7.4.(2)TRk=KP·Tek+KI·TA·∑i=1kTei+KD·Tek-Tek-1TA.From the point of view of the controller, THot-end=constant, or, more precisely, Tact=Tset is the objective. The heat flow rates have to be balanced for a constant hot-end temperature (see (3)). Therefore, the dissipating heat flows are explained.(3)∑i=0nQ˙i=0.Figure 8
Hot-end closed-loop temperature control.


## 7.3. Hot-End Heat Dissipation

There are two different dissipating heat flows. On the one hand, the process requires a heat flow for heating and melting the filament. This heat flow is process-related and volitional. It is described by its rate of heat flow:Q˙1. On the other hand, disturbances cause further dissipating heat flows. These are described by a common rate of heat flow: Q˙z. It is useful to separate Q˙1 and Q˙z for the process of energy optimization. Disturbances are, for example, dissipating heat flows, which are caused by thermal convection, thermal radiation, and thermal conduction. Thermal convection is caused by the cooling fan. Thermal conduction is caused by the temperature differences between, for example, the work space and the hot-end as well as the hot-end and a thermal isolator. These dissipating heat flows are summarized in (4) and Figure 9:(4)Q˙z=∑i=2nQ˙i.For practical applications, it is not necessary to determine each effect separately. Instead of considering particular Q˙i, an overall Q˙z is considered with an efficiency factor ηz. This is useful because each extrusion tool has individual disturbances. Its efficiency depends on hot-end composition, for example, the size and position of the heating resistor. The system is therefore characterized by (5). The parameter ηz characterizes the system with a minimum of expense, because Q˙0 is quantifiable by measuring the supplied electrical energy and Q˙1 is quantifiable using the filament data and the elected process parameters. Furthermore, the parameter ηz is useful for verifications of system optimizations with a minimum of expense. The greater ηz(0⋯1) the lower the disturbance.(5)Q˙0=Q˙1ηz.The fan, which is mounted near the hot-end (see Figure 9), cools the deposited filament. The microcontroller receives the set velocity vset from the CNC and controls the fan speed with an open-loop fan control (see Figure 10). vR is the amplified control signal, which controls fan speed. Z3 is the parameter which causes Q˙3 as a secondary effect during cooling of the depositing filament. The process of energy optimization and a detailed thermal analysis are beyond the scope of this paper. Firstly, they are separate issues that could fill many papers (see [21]); and secondly, it is not necessary to determine any rate of heat flow, because the controller needs only the temperature difference which is caused by the heat flows [22].Figure 9
Heat flows which are introduced and dissipated during FLM.Figure 10
Cooling fan open-loop speed control.


## 7.4. Hot-End Heat Supply

As described above, the PID algorithm calculatesTRk for compensation. TRk is modulated by the microcontroller’s pulse-width modulation (PWM) generator. The PWM signal is amplified (see Figure 11) by a metal-oxide-semiconductor field-effect transistor (MOSFET). The amplified control signal is called TR. The heating unit (see Figure 8) is the actuator. It is a heating resistor, which converts the electrical energy from the amplified signal TR into the thermal energy Q0 for heating the hot-end. The resulting rate of heat flow is called Q˙0 and counterbalances the dissipating heat flows. Q˙0 depends on the rate of electrical energy E˙el. It is roughly approximated by (6), where U is the electrical voltage; I is the electrical current; and D is the duty cycle which is caused by the PWM. The duty cycle is defined in (7), where TP is the total period of the signal and TH is the time during which the signal is active [23]. (6)Q˙0=E˙el=Pel=U·I·D,(7)D=THTP.Figure 11
Distributed microcontroller-based temperature control.


## 8. Temperature Measurement

As described above, a temperature sensor is needed. In this paper, an NTC thermistor is used because of its small costs. It is a resistor whose resistance significantly varies with temperature. Temperature measurement is made according to Figure12, where U0 is the voltage source; R1 is series resistant; RT is the resistant of the NTC; and UT is the voltage across the NTC. UT is the measuring signal. The resistant RT is calculated according to (8):(8)RT=UT·R1U0-UT.The NTC’s resistance/temperature characteristic (curve) is required to determine the temperature. It can be described by three variants: a lookup table, the Steinhart-Hart equation (see (9)) [24], or the B (or β) parameter equation (see (10)) [25].Figure 12
Voltage divider for temperature measurement.A lookup table describes the resistance/temperature characteristic in steps: a specific resistance is assigned to a specific temperature; for example,RT=550Ω⇒T=200∘C; RT=500Ω⇒T=205∘C. Values between the steps can be found by interpolation. The implementation of the lookup table can be done using an array to store the values. A lookup table prevents the microcontroller from having to make complex calculations, but it needs a great deal of memory for storing accurate values(9)T-1=A+B·ln⁡RT+C·ln⁡RT3.T is the Kelvin temperature and RT is the NTC resistance. A, B, and C are the thermistor’s constants, which may be offered by the NTC manufacturer.(10)T=B·TRln⁡RT/RR·TR+B.As previously described, RT is the NTC resistance at the temperature T in Kelvin. RR is the resistance at the rated temperature TR (e.g., 298.15 K). The B (or β) parameter is a material-specific constant of the NTC thermistor which may be offered by the NTC manufacturer.If no constants are offered or a higher accuracy is required, the constants can be found by calibration. See [26] for further information about thermistor calibration.As previously described,UT is the measuring signal which represents the analog voltage across the NTC. The analog-to-digital converter (ADC) converts the analog measuring signal into a digital value Z, which is available in the microcontroller (see Figure 11). The digital measuring signal Z is calculated with (11). Its accuracy depends on the converter’s resolution, which is limited to N bits. The accuracy of the measuring signal is limited to the converter’s resolution, because the conversion involves quantization of the input. Furthermore, the least significant bit (LSB) voltage ULSB has to be considered. It is determined according to (12) [23]: (11)Z=UT-UminUmax-Umin·2N-1,(12)ULSB=Umax-Umin2N-1.


## 9. Physical Computing

Physical computing describes the interaction of the virtual world (software system) with the real world (physical system). This requires communication hardware and software with a well-defined interface.


### 9.1. Communication Hardware

Several wired and wireless options exist to connect the CNC with the temperature controller. Criteria for choosing the best options are, for example, costs, data rates, distances, hardware support, environmental conditions, and the requirement for real-time. Bluetooth and Wireless LAN are two frequently used wireless options, but with a focus on security and reliability, a wired option is advised. Common wired interfaces are, for example, RS-232 and (real-time) Ethernet, but the CNC can restrict the options when it does not support all interfaces. In this paper, a serial communication is used with the universal asynchronous receiver/transmitter (UART) and the universal serial bus (USB) physic. This enables compatibility with a wide range of computer-based CNC.The interaction between the CNC and the temperature-related sensors/actors is shown in Figure13. The microcontroller’s functionality (software system) is highlighted. Figure 14 shows the steps required to calculate the temperature from increments to degrees Celsius and vice versa.Figure 13
Physical computing for temperature control.Figure 14
Calculation order to determine the temperature from increments to degrees Celsius and vice versa.


### 9.2. Communication Protocol

A protocol is required for the communication between the CNC and the microcontroller. The developed protocol supports request-response in plain text. The information is represented in a human-readable format to enable human parsing and interpretation. This supports intuitive use of commands for maintenance and debugging via a command-line interface (CLI), for example, the terminal emulation PuTTY (http://www.putty.org/). The implemented commands are shown in Table 2 for requests and Table 3 for responses. Commands are separated from parameters by the equal sign (=), while parameters are separated from each other by a comma. An escape sequence is used to indicate the input end. After the input end, input is parsed and interpreted by the microcontroller. Unknown commands cause an error message while correct commands are executed. Figure 15 shows requests and responses between the CNC and the microcontroller. On the left side of Figure 15, the set temperature is set for the hot-end by the CNC. The microcontroller confirms the input. On the right side of Figure 15, the actual temperature is requested by the CNC. The microcontroller sends the actual temperature to the CNC. Figure 16 shows requests and responses between a maintenance PC and the microcontroller. On the left side of Figure 16, the PID parameters are set for hot-end temperature control by the PC. The microcontroller confirms the input. On the right side of Figure 16, the actual PID parameters for the hot-end temperature control are requested by the PC. The microcontroller sends the actual PID parameters for hot-end temperature control to the PC. The parser and interpreter are used by both microcontroller and CNC. A state machine is implemented in the CNC to frequently check temperatures and set new set temperatures, when changes occur. If no human-readable format is required, a hexadecimal-based format is an alternative to reduce data size.Table 2
Protocol for requests to microcontroller.
Command Meaning sht =value Set hot-end temperature tovalue  ght Get hot-end temperature  sbt =value Set heating bed temperature tovalue  gbt Get heating bed temperature  swt =value Set work space temperature tovalue  gwt Get work space temperature  shp =KP, KI, KD Set PID control parameters for hot-end toKP, KI, KD  ghp Get PID control parameters for hot-end  sbp =KP, KI, KD Set PID control parameters for heating bed toKP, KI, KD  gbp Get PID control parameters for heating bed  swp =KP, KI, KD Set PID control parameters for work space toKP, KI, KD  gwp Get PID control parameters for work spaceTable 3
Protocol for responses from microcontroller.
Command Meaning hts =value Hot-end temperature is set tovalue  ht =value Hot-end temperature isvalue  bts =value Heating bed temperature is set tovalue  bt =value Heating bed temperature isvalue  wts =value Work space temperature is set tovalue  wt =value Work space temperature isvalue  hps =KP, KI, KD PID control parameters for hot-end are set toKP, KI, KD  hp =KP, KI, KD PID control parameters for hot-end areKP, KI, KD  bps =KP, KI, KD PID control parameters for heating bed are set toKP, KI, KD  bp =KP, KI, KD PID control parameters for heating bed areKP, KI, KD  wps =KP, KI, KD PID control parameters for work space are set toKP, KI, KD  wp =KP, KI, KD PID control parameters for work space areKP, KI, KDFigure 15
Requests from CNC and responses from microcontroller.Figure 16
Requests from PC and responses from microcontroller.


### 9.3. CNC Temperature Control

The M-codes M104, M140, M141, M109, M190, and M191 are designed for setting process-specific temperatures. These M-codes are not reserved for other processes [18]. Both M104 and M109 are used to set the hot-end temperature. M104 sets the temperature and continues the process directly, regardless of whether the desired temperature is reached or not. This is good for small changes during the process, but the hot-end needs to be heated before the process starts because a cold hot-end is not useful. Therefore, M109 is used. M109 pauses the process and continues the process when the desired temperature is reached. This is signaled with an enable signal.


#### 9.3.1. Enable Signal

The enable signal is generated by the CNC’s PLC. It depends on comparing conditions (see Section9.3.2). The enable signal could also be generated by the microcontroller, but this has two disadvantages. First and foremost, further information is transmitted, which is redundant, because all required information is already available in the CNC. Second, when comparing conditions are changed, recompilation of the microcontroller program is required. The comparing conditions are therefore included in a PLC program, so that changes can be made without recompilation.


#### 9.3.2. Comparing Conditions

The enable signal signals true when the comparing conditions become true. The simplest condition is shown in(13)Tset-Tact=0.Without further conditions, small variations are not tolerated; small variations should be tolerated with a range of tolerance, because the process can accept small variations. Therefore, (14) is a better comparing condition where TT is the accepted tolerance: (14)Tset-Tact≤TT.The step response Tact(t) in Figure 17 shows that the process can immediately start after t1, although the temperature Tact(t) is overshooting. This is not practical, because the process needs a constant temperature. Therefore, a further condition is used for checking whether the temperature is settled. ATimer-ON-Delay (TON), which is a standard component of a PLC, is used for checking whether the temperature is constant for a specific time t3.Figure 17
Step response from temperature controller.Currently, the CNC notices deviations of the temperature and prohibits manufacturing before the temperature is settled. No temperature error management is implemented for manufacturing; however, an error management system is required to protect parts and the machine when the difference between the actual temperature and the set temperature becomes too large during manufacturing. This is important to guarantee manufacturing with a consistent quality. A temperature error management system will be outlined in a future paper.


## 9.1. Communication Hardware

Several wired and wireless options exist to connect the CNC with the temperature controller. Criteria for choosing the best options are, for example, costs, data rates, distances, hardware support, environmental conditions, and the requirement for real-time. Bluetooth and Wireless LAN are two frequently used wireless options, but with a focus on security and reliability, a wired option is advised. Common wired interfaces are, for example, RS-232 and (real-time) Ethernet, but the CNC can restrict the options when it does not support all interfaces. In this paper, a serial communication is used with the universal asynchronous receiver/transmitter (UART) and the universal serial bus (USB) physic. This enables compatibility with a wide range of computer-based CNC.The interaction between the CNC and the temperature-related sensors/actors is shown in Figure13. The microcontroller’s functionality (software system) is highlighted. Figure 14 shows the steps required to calculate the temperature from increments to degrees Celsius and vice versa.Figure 13
Physical computing for temperature control.Figure 14
Calculation order to determine the temperature from increments to degrees Celsius and vice versa.


## 9.2. Communication Protocol

A protocol is required for the communication between the CNC and the microcontroller. The developed protocol supports request-response in plain text. The information is represented in a human-readable format to enable human parsing and interpretation. This supports intuitive use of commands for maintenance and debugging via a command-line interface (CLI), for example, the terminal emulation PuTTY (http://www.putty.org/). The implemented commands are shown in Table 2 for requests and Table 3 for responses. Commands are separated from parameters by the equal sign (=), while parameters are separated from each other by a comma. An escape sequence is used to indicate the input end. After the input end, input is parsed and interpreted by the microcontroller. Unknown commands cause an error message while correct commands are executed. Figure 15 shows requests and responses between the CNC and the microcontroller. On the left side of Figure 15, the set temperature is set for the hot-end by the CNC. The microcontroller confirms the input. On the right side of Figure 15, the actual temperature is requested by the CNC. The microcontroller sends the actual temperature to the CNC. Figure 16 shows requests and responses between a maintenance PC and the microcontroller. On the left side of Figure 16, the PID parameters are set for hot-end temperature control by the PC. The microcontroller confirms the input. On the right side of Figure 16, the actual PID parameters for the hot-end temperature control are requested by the PC. The microcontroller sends the actual PID parameters for hot-end temperature control to the PC. The parser and interpreter are used by both microcontroller and CNC. A state machine is implemented in the CNC to frequently check temperatures and set new set temperatures, when changes occur. If no human-readable format is required, a hexadecimal-based format is an alternative to reduce data size.Table 2
Protocol for requests to microcontroller.
Command Meaning sht =value Set hot-end temperature tovalue  ght Get hot-end temperature  sbt =value Set heating bed temperature tovalue  gbt Get heating bed temperature  swt =value Set work space temperature tovalue  gwt Get work space temperature  shp =KP, KI, KD Set PID control parameters for hot-end toKP, KI, KD  ghp Get PID control parameters for hot-end  sbp =KP, KI, KD Set PID control parameters for heating bed toKP, KI, KD  gbp Get PID control parameters for heating bed  swp =KP, KI, KD Set PID control parameters for work space toKP, KI, KD  gwp Get PID control parameters for work spaceTable 3
Protocol for responses from microcontroller.
Command Meaning hts =value Hot-end temperature is set tovalue  ht =value Hot-end temperature isvalue  bts =value Heating bed temperature is set tovalue  bt =value Heating bed temperature isvalue  wts =value Work space temperature is set tovalue  wt =value Work space temperature isvalue  hps =KP, KI, KD PID control parameters for hot-end are set toKP, KI, KD  hp =KP, KI, KD PID control parameters for hot-end areKP, KI, KD  bps =KP, KI, KD PID control parameters for heating bed are set toKP, KI, KD  bp =KP, KI, KD PID control parameters for heating bed areKP, KI, KD  wps =KP, KI, KD PID control parameters for work space are set toKP, KI, KD  wp =KP, KI, KD PID control parameters for work space areKP, KI, KDFigure 15
Requests from CNC and responses from microcontroller.Figure 16
Requests from PC and responses from microcontroller.


## 9.3. CNC Temperature Control

The M-codes M104, M140, M141, M109, M190, and M191 are designed for setting process-specific temperatures. These M-codes are not reserved for other processes [18]. Both M104 and M109 are used to set the hot-end temperature. M104 sets the temperature and continues the process directly, regardless of whether the desired temperature is reached or not. This is good for small changes during the process, but the hot-end needs to be heated before the process starts because a cold hot-end is not useful. Therefore, M109 is used. M109 pauses the process and continues the process when the desired temperature is reached. This is signaled with an enable signal.


### 9.3.1. Enable Signal

The enable signal is generated by the CNC’s PLC. It depends on comparing conditions (see Section9.3.2). The enable signal could also be generated by the microcontroller, but this has two disadvantages. First and foremost, further information is transmitted, which is redundant, because all required information is already available in the CNC. Second, when comparing conditions are changed, recompilation of the microcontroller program is required. The comparing conditions are therefore included in a PLC program, so that changes can be made without recompilation.


### 9.3.2. Comparing Conditions

The enable signal signals true when the comparing conditions become true. The simplest condition is shown in(13)Tset-Tact=0.Without further conditions, small variations are not tolerated; small variations should be tolerated with a range of tolerance, because the process can accept small variations. Therefore, (14) is a better comparing condition where TT is the accepted tolerance: (14)Tset-Tact≤TT.The step response Tact(t) in Figure 17 shows that the process can immediately start after t1, although the temperature Tact(t) is overshooting. This is not practical, because the process needs a constant temperature. Therefore, a further condition is used for checking whether the temperature is settled. ATimer-ON-Delay (TON), which is a standard component of a PLC, is used for checking whether the temperature is constant for a specific time t3.Figure 17
Step response from temperature controller.Currently, the CNC notices deviations of the temperature and prohibits manufacturing before the temperature is settled. No temperature error management is implemented for manufacturing; however, an error management system is required to protect parts and the machine when the difference between the actual temperature and the set temperature becomes too large during manufacturing. This is important to guarantee manufacturing with a consistent quality. A temperature error management system will be outlined in a future paper.


## 9.3.1. Enable Signal

The enable signal is generated by the CNC’s PLC. It depends on comparing conditions (see Section9.3.2). The enable signal could also be generated by the microcontroller, but this has two disadvantages. First and foremost, further information is transmitted, which is redundant, because all required information is already available in the CNC. Second, when comparing conditions are changed, recompilation of the microcontroller program is required. The comparing conditions are therefore included in a PLC program, so that changes can be made without recompilation.


## 9.3.2. Comparing Conditions

The enable signal signals true when the comparing conditions become true. The simplest condition is shown in(13)Tset-Tact=0.Without further conditions, small variations are not tolerated; small variations should be tolerated with a range of tolerance, because the process can accept small variations. Therefore, (14) is a better comparing condition where TT is the accepted tolerance: (14)Tset-Tact≤TT.The step response Tact(t) in Figure 17 shows that the process can immediately start after t1, although the temperature Tact(t) is overshooting. This is not practical, because the process needs a constant temperature. Therefore, a further condition is used for checking whether the temperature is settled. ATimer-ON-Delay (TON), which is a standard component of a PLC, is used for checking whether the temperature is constant for a specific time t3.Figure 17
Step response from temperature controller.Currently, the CNC notices deviations of the temperature and prohibits manufacturing before the temperature is settled. No temperature error management is implemented for manufacturing; however, an error management system is required to protect parts and the machine when the difference between the actual temperature and the set temperature becomes too large during manufacturing. This is important to guarantee manufacturing with a consistent quality. A temperature error management system will be outlined in a future paper.


## 10. Motion Control

As described above, this approach is based on an existing fully assembled three-axis CNC milling machine. Therefore, this paper does not cover the positioning of the tool. The FLM tool (extruder) by itself needs an extruder axis for extruding the filament. The name of the axis depends on the existing CNC platform, for example,E-axis. For convenience, a rotatory motor is used. Inside the extruder, the rotatory motion is transferred into a linear motion. TheE-axis is integrated into the CNC as a linear axis. The trajectory of the extruder’s nozzle is analyzed in [27].


## 11. Operation Principle

All required components are described for extending the CNC architecture for FLM, which is technically designated for subtractive manufacturing. This section describes the line of action to set the hot-end temperature for manufacturing.(1)
The NC program is parsed and the NC program codes (G-codes and M-codes) are executed.(2)
When the M-code M109 (see Table1) is reached, the interpreter calls up the appropriate program called M109. The NC program parsing pause during M109 is executed.(3)
The program M109 gets the set temperature by command call (M109 Pvalue) and commits the value to the PLC (see Figure 18).(4)
The PLC commits the value to the microcontroller interface (μCI).(5)
TheμCI commits the value from the PLC to the temperature controller (μC) and frequently requests the actual temperature from μC. The μCI commits the actual temperature from μC to the PLC.(6)
The PLC checks the comparing conditions while the temperature controller controls the temperature.(7)
The PLC sets the enable signal when the comparing condition becomes true and the temperature is settled.(8)
When the program M109 gets the enable signal, M109 is terminated and the NC program parsing is continuous.This line of action is similarly applicable for M190 and M191. The programs M104, M140, and M141 are immediately terminated after setting the new set temperature. The NC program parsing is not paused.Figure 18
Involved components of the CNC architecture for handling hot-end temperature.A software-based CNC with PLC, a microcontroller board with ATmega328, an EPCOS 100k thermistor, an IRFZ44N MOSFET, and a heating resistor are used for the implementation of the CNC architecture presented. The line of action described was followed to set the hot-end temperature to 200∘C. The actual value of the hot-end temperature was logged by the PLC and is shown in Figure 19 to demonstrate the functionality of the CNC architecture.Figure 19
Visualization of hot-end temperature.


## 12. Conclusion

The approach presented describes the integration of the fused layer modeling process into a CNC architecture which is designated for subtractive manufacturing (milling) but without referring to any specific CNC. This permits engineering of hybrid manufacturing centers which offer FLM with postprocessing in one machine. The benefits are a minimum quantity of clamping, more accurate parts, and less production time. Furthermore, the integration offers another significant advantage over previous approaches because only one hybrid CNC architecture is needed for offering many processes. The same CNC can be used for additive manufacturing with subtractive manufacturing, only additive manufacturing, and only subtractive manufacturing. This prevents customers from assembling individual CNC systems for FLM and milling machines. Machine customers and machine operators do not need knowledge in different CNC systems because the new process (FLM) is integrable in the familiar CNC system. This is economical for developers, customers, and users, regardless of whether they need hybrid manufacturing or not.The approach presented focuses only on fused layer modeling (FLM). Other additive manufacturing processes need also postprocessing. Therefore, the idea of hybrid manufacturing is also applicable to processes other than fused layer modeling.As described in Section5.2, further work is necessary for using the CNC architecture for hybrid manufacturing. Firstly, a clamping device is required which supports additive and subtractive manufacturing. Secondly, an extrusion tool is required which is compatible with the existing tool changer of the CNC machine. Thirdly, an extended CAM system is required which supports additive and subtractive manufacturing at the same time. Therefore, at the time of submitting this paper, the CNC architecture presented was not applied to a real hybrid manufacturing process, but it has been successfully implemented.



---

*Source: 8609108-2016-10-09.xml*