Development and Implementation of a Control System for a Retrofitted CNC Machine by Using Arduino

This paper deals with the development of an open-loop controller implemented in the Arduino platform in order to reuse an existing CNC machine for performing simple manufacturing operations. The CNC machine considered in this study is an Objet Quadra Tempo 3D printer. The goal of this work is, therefore, to convert the machine, considered obsolete due to high maintenance costs, by using low-cost off-the-shelf components and by using open source software in order to reduce the amount of electronic and industrial wastes by means of simple retrofitting operations. To control the drivers of the stepper motors of the machine, an ArduinoMega 2560 microcontroller was used. The Arduino micro– controller allows for controlling analog and digital devices in a straightforward manner. All retrofitting operations were conducted in order to carry out additive manufacturing and subtractive manufacturing operations. For the activity reported in this paper, an electro-spindle for machining products in wood and polycarbonate was installed. The use of low-cost components allowed the transformation of the 3D printer into a CNC milling machine capable of working materials such as wood and polycarbonate.


INTRODUCTION
In engineering applications, the design of complex mechanical systems is a challenging process which requires nonconventional methodologies for the analysis and the development of a general design solution [1][2][3][4][5][6][7][8][9][10].In recent years, there has been a growing awareness of the impact of our lifestyle on the environment and there is an increasing awareness of the real need for a change of paradigm.This problem is particulary important in the electronic industry, where the life of a specific technological product appears to be suprisingly short, due to the speed of innovation and the consequent disposal of fully functional devices which are too quickly considered obsolete.In fact, the electronic industry is the sector that has the highest growth rate.In Europe such growth is around 5%, and involves the production of about 6.5 million tons of electronic waste to be disposed per year.The majority of such waste, almost completely recyclable, ends up in landfills leading to a constant demand for new sites, which results in a reduction of agricultural land with the pollution risk of groundwater contamination.For example, the production of waste of the United States in 2012 is divided in the following way: 12% was incinerated with energy recovery, 35% was recycled and 54% of municipal waste was discarded in landfills.However, the actual impact of reuse on the environment has been neglected and is still unknown.On the contrary, it is well known the weight of the demand for goods of the global market that affect global flows, and that accounts for more than a fifth of global CO2 emissions.These general considerations, together with other engineering factors, suggested us to explore the field of retrofitting existing machines by using low-cost off-the-shelf components and developing simple control strategies.
The focus of this paper is the development of an open-loop controller implemented in the Arduino platform in order to reuse an existing machine for performing simple manufacturing operations.Specifically, the goal is to use low costs hardware components and open source software for controlling the machine that is an obsolete 3D printer.The main idea is to build a small Computer Numerical Control machine (CNC) capable of machining parts to precise sizes and shapes.
We organized the paper in the following way: in section 2, we reported the description of the printer and the subsequent retrofitting operation conducted on the machine.In section 3, we reported the configuration of Marlin firmware used by the microcontroller and the subsequent test phase for controlling the actuators.In section 4, we reported the substractive manufacturing activity conducted by installing an electro-spindle on the tool holder.In section 5, we describe the subtractive manufacturing activity.And finally, section 6 reports our conclusions.

THE RETROFITTED MACHINE
The machine that we chose for our study is an Objet Quadra Tempo, a 3D printer produced by Objet Geometries in 2002, shown in figure 1.The 3D printing technology is similar to inkjet printing but instead of jetting drops of ink onto paper PolyJet 3D Printers jet layers of curable liquid photopolymer are used to build tray.All of the machine electronic and motoring parts are fully functional but it was considered obsolete because of its high maintenance costs.In general, retrofitting is a way to add new technologies and functionality to improve performance and security of an obsolete system.This allows for significant cost reduction associated with purchasing a new machine, such as, for example, delivery, training costs, and disposal costs for the old machine.The cost of a new professional printer is about 4000-5000€, while the cost of this retrofitting is about 200-300€.A simple cost analysis, including other management costs, shows how retrofitting can be an economically advantageous solution.
The Objet Quadra Tempo printer, is equipped with 3 stepper motors, the board XILINX, an AC/DC converter, an air filtration system, a lock security system and one computer to communicate with the machine.The stepper motors are brushless DC electric motors that need three drivers that translate the PWM signal of the controller into an angular rotation of the motors.The X axis is actuated by a MAE HN200 Stepper motor that works at 70V, while the Y and Z axes are actuated by a MAE HS200 Stepper motor that works at 42V.The drives that control the three motors are the IM805 drive, reported in figure 3, and two IB463 drive, respectively for the X axis and for the Y and Z axes.In order to control the three stepper motors in a simple way, we decided to replace the original control board of the machine with a cheaper prototyping board that is easily programmable in C language.Therefore, in the place of the XILINX board, we installed an ArduinoMega2560 controller, capable of handling analog, digital and pulse-width modulation signals.The motion is transmitted using belts and pulleys for X and Y axes and a leadscrew for the vertical axis.The choice of using low cost components is matched by the use of open-source software.Marlin firmware is the sketch used for the Arduino Microcontroller while Repetier Host allows the communication between the Arduino board and the operator's PC.The first step is to define the geometry by using a CAD software which must be subsequently sent to a CAM software in order to generate the toolpath.In order to simplify the machine management, we decided not to use the original optical endstops for the home setting of the machine, but to install three mechanical stops.

OPEN LOOP CONTROL LAW FOR STEPPER MOTOR
Stepper motors are brushless DC electric motors that divide a full axis rotation into a number of equal steps.
The rotation is continuous when we apply a train of square wave pulses where for each pulse the motor moves the shaft through a fixed angle.Such motors have become popular in motion control due to their reliability for precise positioning operations.Stepper motors can be controlled by using open-loop control laws or closed loop control algorithms.In fact, for low speed operating conditions with stable load torques, no encoder is required and open-loop control algorithms are preferred due to a simpler control architecture.In this case, the performance of the open loop controller is crucial.There are two approaches to control the drives of a stepper motor: the first approach consists in modulating the duty cycle of the pulsing signal by using a DAC device, digital to analog converter with an analog comparator, [11][12][13] while the second one consists in using an ADC, analog to digital converter with a regular sample to adjust the duty cycle of the pulsing signal.[14,15].The required torque T M is the function of the load to actuate and of the acceleration needed as reported in the next relation: where T L , load torque, is evaluated in the following way: with d is the pulley diameter, η is the efficiency of the transmission and i is the gear ratio.The force of moving direction is evaluable by using the following equation: ( ) where µ is the friction coefficient of the sliding surface, α angle of inclination, F A potential external force, and the acceleration torque T A given by: ( ) where I 0 is the inertia of the rotors and I L is the inertia of the translating mass, θ s is the step angle and f is the operating pulse speed in Hz.In figure 6, we reported the stepper motor model that we developed in SimElectronics, the electric environment of Simulink software for evaluating the behaviour of the stepper motor under the current load.1.

CONFIGURATION AND TESTING OF THE RETROFITTED MACHINE
The application reported in this paper was implemented installing a Proxxon Micromot 50/E for subtractive manufacturing operation.To avoid the risk of damage of the heated surface of the machine, required for 3D printing applications, we fitted a wooden board that can be easily removed.The first step is to verify the correct operation of the printer.The machine was equipped with ArduinoUno and GRBL library for motor control.The aim of this phase is to verify the open loop relation between PWM signal and motor step.Finally, we connected each driver to the ArduinoMega controller, as reported in figure 7, and installed the Marlin firmware.We installed the PROXXON MICROMOT 50/E electro-spindle for subtractive manufacturing operations.In the laboratory of Applied Mechanics of the Department of Industrial Engineering of the University of Salerno, we built a suitable aluminium support to fix the electro-spindle on the tool holder.
The parameters that must be set within the Marlin firmware are the baud-rate, the end-stop position, home position, dimensions of the working area, logic of the end-stop device, direction and the step/mm of the motors.The Baud-rate is an important value that defines the data transmission velocity between PC and Arduino.Regarding the motors, Arduino requires to know motor's direction (we can invert direction, changing Boolean values) and step/mm for each motor to determinate the number of steps to walk one mm.This value can be calculated by the following relation:

steps motor steps per rev driver microstep mm beltpitch pulley number of teeth
In table 1, we reported the connections used for actuating the drives of the Stepper motors and mechanical end-stops.With STEP we indicate the input to run motor, with DIR we control the direction of rotation of the motors, with EN we indicate an enable signal that keeps the position of the motor if the pin is high or low, depending on the type of motor and finally with SIG we indicated the signal that informs the ArduinoMega controller, when to stop the motors.

SUBSTRACTIVE MANUFACTURING ACTIVITY
The software used for this experimental activity is Repetier Host that offers an interface between the retrofitted machine and the operator.The aim of this experimental activity is to build a polycarbonate support for the ultrasonic sensor SRF05.For this purpose, the first step concerns the design of the support by using the solid modeling computer-aided design Solidworks software.The 3D geometry must be subsequently converted into G-CODE, the most widely used numerical control programming language used in computer-aided manufacturing.We software use for the CAM activity is CamBam software.Finally the file is ready to be used by Repetier Host.In figure 8, we reported the Repetier Host interface where it is possible to follow the manufacturing progress on the PC monitor.Finally, in figure 9 we reported the milling operation conducted by the retrofitted machine on the polycarbonate.

SUMMARY AND CONCLUSIONS
The research areas of interest for the authors are multibody dynamics [16][17][18][19][20], system identification [21][22][23][24][25], and optimal control [26][27][28][29][30]. Therefore, the main research efforts of the authors are devoted to the development of new methods for performing accurate analytic modelling [31][32][33][34][35], numerical parameter identification using experimental data [36][37][38][39][40], and optimal control optimization for dynamic models of multibody mechanical systems [41][42][43][44][45][46].In particular, this paper is focused on the development of a control scheme by using the Arduino platform in order to convert a machine for performing simple manufacturing operations.In the context of waste reduction by reusing machines considered obsolete, we decided to retrofit an Objet Quadra Tempo by using low-cost off-the-shelf components and OpenSource software.After a first assessment of the condition of the original CNC machine, we proceeded to cleaning up and removing all the parts not necessary for its new life.Subsequently, we decided to simplify the CNC machine control system by replacing the original control board with a microcontroller ArduinoMega2560.Such low-cost controller allowed us to control the actuators and sensors installed on the machine in a simple way.The CNC machine has three brushless DC electric stepper motors that control the three axes of the machine.Considering the engine parameters and operating conditions, we developed a control system of the actuators using open-loop control laws.In the control strategy developed in this work, the communication takes place in one direction only: from the controller to the motor.In order to carry out the manufacturing operations, the control system needs to know a reference point called work zero or home position.To make this possible, we decided not to use the original optical hard-stop sensor of the machine and to install mechanical hard-stops.The use of low-cost off-the-shelf devices is combined by the use of open source software for creating toolpath based on the 3D model developed with the use of the SolidWorks CAD software.For this purpose, the CamBam application is employed.The CamBam is an application to create G-code from CAD source files mainly used for subtractive manufacturing operations.The Repetier Host program, on the other hand, is mainly used for additive manufacturing.To test the retrofitted CNC machine, we chose to build the polycarbonate supports for the SRF05 ultrasonic sensors by using subtractive manufacturing techniques.The use of low cost components allowed us to transform in a simple way the 3D printer into a CNC milling machine capable of working materials such as wood and polycarbonate.Additional possible modifications that can be made to increase quality and machining time are the installation of a more powerful electrospindle and an aspiration system for chip removal.The application of the idea presented in this work has confirmed the feasibility of reconverting a CNC machine considered obsolete by means of retrofitting techniques.The methodology developed in this work for converting an old machine into a valuable resource can be employed in developing countries for improving the quality of the industrial base.

Figure 5 :
Figure 5: Motor and Belt Drive Scheme

Figure 6 :
Figure 6: Matlab Stepper Motor Model The numerical simulations conducted on the model, have confirmed the use of open loop control laws for controlling the stepper motors.The characteristics used for the stepper model are reported in table 1.