development of a computer numerically controlled...

6
Development of a Computer Numerically Controlled Router Machine With 4 Degrees of Freedom Using an Open Architecture Leonardo Romero Mu˜ noz Facultad de Ingenier´ ıa El´ ectrica UMSNH Morelia, Mich., Mexico Email: [email protected] Moises Garc´ ıa Villanueva Facultad de Ingenier´ ıa El´ ectrica UMSNH Morelia, Mich., Mexico Email: moises@correo.fie.umich.mx Mario Santana G´ omez Facultad de Ingenier´ ıa El´ ectrica UMSNH Morelia, Mich., Mexico Email: msantana@correo.fie.umich.mx Abstract—A CNC router machine, of low cost, medium preci- sion, using an open architecture, with four degrees of freedom, is presented. It is described its hardware and software components. Also some applications to do simple tasks are presented. I. I NTRODUCTION Industrial robots have been used with success to do multi- ple tasks including: automotive industry, electrical/electronic industry, metal products and many others (see Figure 1). 0 5,000 10,000 15,000 20,000 25,000 30,000 35,000 Unspecified Others Medical, precision & optical instruments Glass, ceramics Consumer, domestic appliances Communication Industrial machinery Food Metal products Chemical, rubber and plastics Automotive parts Motor vehicles Electrical/electronics* units Estimated worldwide annual supply of industrial robots at year-end by industries 2009 - 2011 2011 2010 2009 Source: IFR Statistical Department *incl. computers Fig. 1. Estimated worldwide annual supply of industrial robots at year-end by industries 20092011 [9]. Table I shows how the shipments of industrial robots are distributed over countries. Most of them are used in Asia (in particular China, Japan and Korea) and Europe. These countries are taking advantage of the benefits of using robots in their industries. Unfortunately, industrial robots are expensive and many small and medium size companies in Mexico can not afford to buy and use industrial robots. In the Michoacana University we are developing a CNC router table with medium precision, suitable to do tasks over soft materials like wood, plastic or aluminum. In particular, we TABLE I ESTIMATED ANNUAL SHIPMENTS OF INDUSTRIAL ROBOTS IN SELECTED COUNTRIES [9]. * 5 1 0 2 * 2 1 0 2 1 1 0 2 0 1 0 2 y r t n u o C 0 0 1 , 5 3 0 0 6 , 0 3 7 2 2 , 6 2 4 1 1 , 7 1 a c i r e m A North America (Canada, Mexico, USA) 16,356 24,341 28,000 31,000 0 0 1 , 4 0 0 6 , 2 6 8 8 , 1 8 5 7 a c i r e m A h t u o S d n a l a r t n e C 0 0 7 , 6 1 1 0 0 9 , 8 9 8 9 6 , 8 8 3 3 8 , 9 6 a i l a r t s u A / a i s A 0 0 0 , 5 3 0 0 0 , 6 2 7 7 5 , 2 2 8 7 9 , 4 1 a n i h C 0 0 5 , 3 0 0 0 , 2 7 4 5 , 1 6 7 7 a i d n I 0 0 0 , 5 3 0 0 0 , 1 3 4 9 8 , 7 2 3 0 9 , 1 2 n a p a J 0 0 0 , 5 2 0 0 8 , 6 2 6 3 5 , 5 2 8 0 5 , 3 2 a e r o K f o c i l b u p e R 0 0 5 , 5 0 0 4 , 4 8 8 6 , 3 0 9 2 , 3 n a w i a T 0 0 0 , 7 0 0 1 , 4 3 5 4 , 3 0 5 4 , 2 d n a l i a h T 0 0 7 , 5 0 0 6 , 4 3 8 4 , 0 2 8 2 9 , 2 a i l a r t s u A / a i s A r e h t O 0 0 2 , 7 4 0 0 1 , 4 4 6 2 8 , 3 4 3 8 4 , 0 2 e p o r u E 0 0 0 , 3 0 0 0 , 2 8 1 6 , 1 2 0 4 . p e R h c e z C 0 0 5 , 3 0 0 3 , 3 8 5 0 , 3 9 4 0 , 2 e c n a r F 0 0 0 , 0 2 0 0 0 , 9 1 3 3 5 , 9 1 1 6 0 , 4 1 y n a m r e G 0 0 9 , 4 0 0 6 , 4 1 9 0 , 5 7 1 5 , 4 y l a t I 0 0 0 , 3 0 0 5 , 2 1 9 0 , 3 7 9 8 , 1 n i a p S 0 0 2 , 2 0 0 0 , 2 4 1 5 , 1 8 7 8 m o d g n i K d e t i n U 0 0 6 , 0 1 0 0 1 , 1 1 1 2 9 , 9 7 3 9 , 6 e p o r u E r e h t o 0 0 5 0 5 3 3 2 3 9 5 2 a c i r f A 0 0 5 , 7 0 2 0 5 9 , 0 8 1 8 2 0 , 6 6 1 5 8 5 , 0 2 1 * * l a t o T **including sales which are not specified by countries Sources: IFR, national robot associations. *forecast are interested in helping the small guitars factories in Paracho, Michoacan, Mexico, to improve their competitiveness against factories in other countries that already use robots. We are taking into account developing a machine with low cost, open and easy to use (hardware and software). An Open Architecture should have the capacity to integrate pieces of equipment from several different manufacturers and to obtain control solutions with several programmable application interfaces, maintaining the same performance at lower costs. While there are some efforts to define a Open Architecture, for this project we follows the OSEC (Open System Environment for Controller) Architecture which is based on a standard personal microcomputer IBM-PC to control manufacturing equipment [2]. The cost of the machine developed is less than half the cost of a commercial CNC machine with similar characteristics. This paper shows the hardware and software components of the CNC router developed as well as some applications. The 978-1-4799-2370-0/13/$31.00 ©2013 IEEE

Upload: dinhliem

Post on 12-Apr-2018

216 views

Category:

Documents


2 download

TRANSCRIPT

Development of a Computer NumericallyControlled Router Machine With 4 Degrees of

Freedom Using an Open ArchitectureLeonardo Romero Munoz

Facultad de Ingenierıa ElectricaUMSNH

Morelia, Mich., MexicoEmail: [email protected]

Moises Garcıa VillanuevaFacultad de Ingenierıa Electrica

UMSNHMorelia, Mich., Mexico

Email: [email protected]

Mario Santana GomezFacultad de Ingenierıa Electrica

UMSNHMorelia, Mich., Mexico

Email: [email protected]

Abstract—A CNC router machine, of low cost, medium preci-sion, using an open architecture, with four degrees of freedom, ispresented. It is described its hardware and software components.Also some applications to do simple tasks are presented.

I. INTRODUCTION

Industrial robots have been used with success to do multi-ple tasks including: automotive industry, electrical/electronicindustry, metal products and many others (see Figure 1).

0 5,000 10,000 15,000 20,000 25,000 30,000 35,000

Unspecified

Others

Medical, precision & optical instruments

Glass, ceramics

Consumer, domestic appliances

Communication

Industrial machinery

Food

Metal products

Chemical, rubber and plastics

Automotive parts

Motor vehicles

Electrical/electronics*

units

Estimated worldwide annual supply of industrial robots at year-end by industries 2009 - 2011

2011

2010

2009

Source: IFR Statistical Department*incl. computers

Fig. 1. Estimated worldwide annual supply of industrial robots at year-endby industries 20092011 [9].

Table I shows how the shipments of industrial robots aredistributed over countries. Most of them are used in Asia(in particular China, Japan and Korea) and Europe. Thesecountries are taking advantage of the benefits of using robotsin their industries.

Unfortunately, industrial robots are expensive and manysmall and medium size companies in Mexico can not affordto buy and use industrial robots.

In the Michoacana University we are developing a CNCrouter table with medium precision, suitable to do tasks oversoft materials like wood, plastic or aluminum. In particular, we

TABLE IESTIMATED ANNUAL SHIPMENTS OF INDUSTRIAL ROBOTS IN SELECTED

COUNTRIES [9].

*5102*210211020102yrtnuoC001,53006,03722,62411,71aciremA

North America (Canada, Mexico, USA) 16,356 24,341 28,000 31,000001,4006,2688,1857aciremA htuoS dna lartneC

007,611009,89896,88338,96ailartsuA/aisA000,53000,62775,22879,41anihC005,3000,2745,1677aidnI000,53000,13498,72309,12 napaJ000,52008,62635,52805,32aeroK fo cilbupeR005,5004,4886,3092,3 nawiaT000,7001,4354,3054,2dnaliahT007,5006,4384,02829,2 ailartsuA/aisA rehtO

002,74001,44628,34384,02eporuE000,3000,2816,1204.peR hcezC005,3003,3850,3940,2ecnarF000,02000,91335,91160,41ynamreG009,4006,4190,5715,4ylatI000,3005,2190,3798,1niapS002,2000,2415,1878modgniK detinU006,01001,11129,9739,6eporuE rehto

005053323952acirfA005,702059,081820,661585,021**latoT

**including sales which are not specified by countries

Sources: IFR, national robot associations.

*forecast

are interested in helping the small guitars factories in Paracho,Michoacan, Mexico, to improve their competitiveness againstfactories in other countries that already use robots.

We are taking into account developing a machine withlow cost, open and easy to use (hardware and software). AnOpen Architecture should have the capacity to integrate piecesof equipment from several different manufacturers and toobtain control solutions with several programmable applicationinterfaces, maintaining the same performance at lower costs.While there are some efforts to define a Open Architecture, forthis project we follows the OSEC (Open System Environmentfor Controller) Architecture which is based on a standardpersonal microcomputer IBM-PC to control manufacturingequipment [2]. The cost of the machine developed is lessthan half the cost of a commercial CNC machine with similarcharacteristics.

This paper shows the hardware and software components ofthe CNC router developed as well as some applications. The

978-1-4799-2370-0/13/$31.00 ©2013 IEEE

rest of the paper is organized as follows: Section II describesthe general characteristics of the machine developed. SectionIII presents the control software and some applications in 2D.Section IV describes how to post-process Gcode files in orderto optimize execution time. Finally, Section V presents theconclusions and future work.

II. THE CNC ROUTER MACHINE

Figure 2 shows the machine developed, an XY ZA CNCrouter table, using a Dewalt DWP611 router. Additionally itincludes a commercial vacuum cleaner to absorb the materialsarising from the workpiece when the router is operating. Thevacuum cleaner is under the router table and its hose is locatednext to the Dewalt router.

Fig. 2. The CNC router developed.

The router can move in the X , Y and Z directions, and theworkpiece can be rotated around the X axis, using the motorA, as shown in Figure 3 (a) and (b). The characteristics of themachine are shown in Table II.

TABLE IIMACHINE SPECIFICATIONS

Travel distance Resolution SpeedX-axis 16” 0.0005” 1”/sY-axis 8” 0.0005” 1”/sZ-axis 2.5” 0.0005” 1”/sA-axis − 0.45o 1800o/s

A. Hardware components

The CNC router machine has a solid frame of steel andaluminum. The axis X , Y , and Z use lead screws and

A

X

Z

Y

motor Zmotor Y

motor A

motor X

(a) The four degrees of freedom

(b) Rotation around the X axis

Fig. 3. The CNC router table.

precision nuts (5 turns per inch). Each axis uses a Nema 23stepper motor, model 23HS9430 from Longs Motor [8], 425oz-in, 3 A, 30 V and 1.8 deg/step.

Figure 4 shows the box with four stepper motor driverDM542A, 1850 VDC, peak 4.2A; the Power supply S-350-24 of 350Watts (24VDC/14.6A); and the Breakout board (allfrom Longs Motor). The DM542A applies a PWM (PulseWidth Modulation) current control scheme to move the steppermotor. The stepper motor is controlled by two signals, a Pulsesignal (or Step signal) to move the motor a single step, and aDirection signal to indicate the direction of the movement.

The parallel port from the breakout board is used to connectto a Personal Computer (PC). The parallel port outputs areused to control the four stepper motors and the parallel portinputs receive the status of limit switches for axis X , Y andZ, and the status of an emergency button (a red button used tostop the machine in an emergency situation). The 5 V supplyrequired by the breakout board is supplied by a USB cablefrom the PC. Figure 5 shows the connexions between thedifferent components of the CNC router machine.

All these components make up a robust CNC router machinecontrolled by the parallel port of a PC.

(a) Driver box (b) DM542A

(c) Breakout board

Fig. 4. The motor driver box.

Fig. 5. Connexions between different components.

III. SOFTWARE COMPONENTS

We select a realtime version of Linux operating system onthe Personal Computer to control the CNC router machine.This environment is called LinuxCNC [7].

A. LinuxCNC

LinuxCNC is a software system for computer control ofmachines such as milling machines, lathes, plasma cutters,cutting machines, robots, hexapods, etc. LinuxCNC is Freesoftware released under the terms of the GNU GPLv2.

LinuxCNC is a descendent of the Enhanced Machine Con-troller (EMC) created by the National Institute of Standardsand Technology (NIST), which is an agency of the CommerceDepartment of the United States government (see [1] for asurvey in 1995 of the NIST realtime control system).

NIST first became interested in writing a motion controlpackage as a test platform for concepts and standards. Earlysponsorship from General Motors resulted in an adaptation ofthe fledgling version of EMC using PMAC intelligent controlboards running under a ”real time” version of Windows NTand controlling a large milling machine. Early considerationsfocused on replacing the expensive and temperamental ”realtime” Windows NT system. It was proposed that a relativelynew (at the time) real time extension of the Linux operatingsystem be tried. This idea was pursued with success. NISTset up a mailing list for people interested in EMC. As timewent on, others outside NIST became interested in improvingEMC. Many people requested or coded small improvements tothe code. As this community became larger, the EMC mailinglist and code archives were moved to the SourceForge and theLinuxCNC web site was established.

LinuxCNC has many features and brings a lot of function-ality (a flexible and powerful Hardware Abstraction Layer thatallows you to adapt it to many kinds of machinery, a softwarePLC controller, easier installation, a new trajectory planner,and more). LinuxCNC also has a Simulator version, withoutusing realtime, that works on standard Linux systems [6].

LinuxCNC is precompiled with Ubuntu LTS (long termsupport) versions for ease of installation and longevity. Weuse the version of Ubuntu 10.04 LTS in a Personal Computer.Figures 6 and 7 show the parallel port setup and the X axisconfiguration, respectively. Configurations for axis Y , Z andA are similar.

Fig. 6. LinuxCNC Parallel Port Setup

The linuxcnc program executes CNC machine programs inthe G Code format. The LinuxCNC G Code language is basedon the NIST RS274/NGC language.

B. Making simple drawings

Here we review four programs for Linux related to the taskof making simple drawings: xfig, potrace, pstoedit and image–

Fig. 7. LinuxCNC X Axis Configuration.

to–gcode.1) xfig program: Xfig is a freeware interactive vectorial

drawing tool which runs under X Window System on mostUNIX-compatible platforms. There is a version of xfig toexport drawings to the G Code format [4]. For instance, Figure8 shows the xfig interface, Figure 9 shows the Linuxcncinterface associated with the file generated by xfig (hello.ngc),and Figure 10 shows the final result executing hello.ngc.

Fig. 8. Xfig interface.

2) potrace program: Potrace transforms bitmaps into vectorgraphics [11]. Potrace is a free software tool for tracing abitmap, which means, transforming a bitmap into a smooth,scalable image. The input is a bitmap (PBM, PGM, PPM,or BMP format), and the default output is an encapsulatedPostScript file (EPS). A typical use is to create EPS filesfrom scanned data, such as company or university logos,handwritten notes, etc. The resulting image is softer than theoriginal bitmap and it can then be rendered at any resolution.Potrace can currently produce the following output formats:EPS, PostScript, PDF, SVG (scalable vector graphics), DXF,GeoJSON, PGM (for easy antialiasing of pixel-based images),

Fig. 9. LinuxCNC interface.

Fig. 10. Final workpiece

Gimppath, and Xfig. We only found this free program, otherssimilars are comercial programs.

3) pstoedit program: pstoedit translates PostScript and PDFgraphics into other vector formats, including the G Codeformat [12].

4) image–to–gcode: The program image–to–gcode [13] isintegrated to the LinuxCNC program and it transforms agreyscale image into a milling depth map (a G Code file).A depth map is a greyscale image where the brightness ofeach pixel corresponds to the depth (or height) of the objectat each point.

C. Making more complex drawings

As we can see, Figure 8 shows the letters filled with a blackcolor, but the G Code program follows only the contours, asshown in Figure 10. The same result is obtained using thepstoedit program.

We write a program called fill image, to generate paths tothe router inside the black filled areas, in order to get the samedepth in the border and in the interior of the black areas. Theinput to fill image is an image like the one shown in Figure11.

The program fill image uses the OpenCV Software Library(see [5] for a good introduction to Computer Vision usingthe OpenCV library) and it follows Algorithm 1. It computesthe image contours using the Canny operator, where contours

Fig. 11. A black & white butterfly

are represented by non-zero pixels (white pixels over a blackbackground). To Dilate an image, a morphological filter isused.

Algorithm 1 Finding contoursINPUT: I , a binary imageOUTPUT: R, a binary image with contours

R← BlackImage() // All pixels equal to zerowhile hasBlackP ixels(I) doC ← CannyOperator(I) // Compute contours of IR← Add(R,C)D ← Dilate(C)I ← Add(D, I)

end whilereturn R

The output of the program fill image with the image ofFigure 11 as input, is shown in Figure 12. It can be notedthat black areas in the input image are replaced by interiorcontours that follow the same shape like the exterior contours.We can use the pstoedit program to convert this new image(or its inverted one) to a G Code program and finally we getthe desired result on the CNC machine.

Another alternative to get a similar result is using the image-to–gcode program, but in that case the CNC router followspaths from left to right, and from top to bottom, similar to theoperation of an ink printer (and hence it takes a lot more timeto finish the task). The result using the fill image program issimilar to the operation of a plotter.

D. Creating Printed Circuit Boards (PCB)

For this task we use the program Eagle and the UserLanguage Program (ULP) PCB-Gcode.

1) Eagle program: Eagle is a powerful and flexible PCBdesign software offering high level functionality [3]. It hasalgorithms of autorouter the vias and tools that supports inmanual routing. Allows feature enhancement through UserLanguage Programs (ULP) which are partly integrated. Eaglecan generate data for mounting machines, test equipments,milling machines or any other data format. Figure 13 showsan example of the Board Editor interface of Eagle.

Fig. 12. The output of program fill image

Fig. 13. Eagle Board Editor Interface.

2) PCB-Gcode ULP: Pcb-Gcode allows use milling ma-chine, router, engraver, etc. to make printed circuit boardswithout using toxic chemicals. Machine cuts around the tracesfor the circuits. PCB-Gcode also creates drill files to drillholes, mill files to cut the board out, or make cutouts in theboard [10].

As a test, we create a simple design with Eagle, then usePCB-Gcode to create the associated G-code file. Figure 14shows the final result.

Fig. 14. A PCB made with the CNC router machine.

IV. POST-PROCESSING THE GCODE FILE

The file generated by pstoedit does not start with strokesfrom the CNC machine origin, instead it starts on the imageorigin (near to the top left corner of the image) continuingwith the next point located to the right and then it repeats theleft–right search from top to bottom. In this way the strokessequence makes unnecessary movements.

We write a program called fast gcode to improve the timerequired to do the sequence of movements on the CNCmachine. The input to this program is a g–code file, and itsoutput is a g–code file where the strokes has been orderedto minimize the movement (and hence the time) of the CNCmachine between successive strokes. The first stroke selectedhas its start point closest to the origin position of CNCmachine.

We implement the Algorithm 2 to obtain the sequence ofstrokes that improve the time to develop the task of CNCmachine.

Some results of this program are shown in Table III (strokesare done using a constant feed rate of 10in/min).

TABLE IIITIME IMPROVED WHEN STROKES ARE OPTIMIZED TO MAKE THE CNC

MACHINE TASK.

Strokes pstoedit (min) Our Algorithm (min) Images

49 9:58 9:00

272 23:30 21:50

280 27:42 26:30

316 45:20 40:07

32 1:30 1:25

V. CONCLUSION AND FUTURE WORK

We have presented a low cost and open CNC router machinewith 4 degrees of freedom, using stepper motors and theparallel port interface of a PC. The PC runs LinuxCNC, areal–time version of the Linux operating system. Also we havedescribe some programs in the Linux environment to makesimple tasks.

In the near future we planned to apply this CNC routermachine as a test bed to do some tasks in the guitars factoriesin Paracho, Michoacan, Mexico, looking to improve theirprocesses. We also plan to develop open software easy to useto do special tasks over wood in those factories.

Algorithm 2 Optimize the sequence of strokesINPUT: T , sequence of strokesOUTPUT: Tn, a new sequence of strokesxs ← 0ys ← 0while T 6= NULL doti ← SearchClosestStroke(T,< xs, ys >)// ti starts in point < xs, ys > and ends in < xe, ye >Tn ← add(ti)< xo, yo >←< xe, ye >Delete ti from T

end whilereturn Tn

Also we plan to review programs that convert 3D modelsfrom Autocad (or similar programs like blender) to Gcode andadd two cameras to the CNC router machine to form a stereovision system. The idea is to get a 3D model from severalviews of an object and to reproduce the object using the CNCrouter machine.

ACKNOWLEDGMENT

The authors would like to thank to the Michoacana Univer-sity to finance a research project to develop the CNC routermachine presented in this paper.

REFERENCES

[1] James S Albus et al. The nist real-time control system (rcs): Anapplication survey. In Proceedings of the AAAI 1995 Spring symposiumSeries, pages 27–29, 1995.

[2] O. L. Asato, E. R. R. Kato, R. Y Inamasu, and A. J. V. Porto. Analysisof open cnc architecture for machine tools. J. Braz. Soc. Mech. Sci.,24(3):208–212, 2002.

[3] CadSoft. Eagle PCB design software, October 2013. http://www.cadsoftusa.com/.

[4] Till Harbaum. EMC - machining under linux, October 2013. http://www.harbaum.org/till/cnc/index.shtml.

[5] Robert Laganiere. OpenCV 2 Computer Vision Application Program-ming Cookbook. Packt Publishing, 2011.

[6] LinuxCNC.org. Linuxcnc: Pure simulator, October 2013. http://wiki.linuxcnc.org/cgi-bin/wiki.pl?LinuxCNC Pure Simulator.

[7] LinuxCNC.org. Linuxcnc: Software for realtime control, October 2013.http://www.linuxcnc.org/.

[8] Longs Motor. 23HS stepper motor, October 2013. http://www.longs-motor.com/productinfo/detail 12 25 114.aspx.

[9] International Federation of Robotics. Industrial robot statistics, June2001. http://www.ifr.org/industrial-robots/statistics/.

[10] PCB-Gcode. Use your milling machine, router, engraver, etc. to makepcb, June 2013. http://www.pcbgcode.org/.

[11] Potrace. Transforming bitmaps into vector graphics, October 2013. http://potrace.sourceforge.net/.

[12] Pstoedit.net. Translates postscript and pdf graphics into other vectorformats, October 2013. http://www.pstoedit.net/.

[13] Image to gcode. Milling “depth maps”, October 2013. http://www.linuxcnc.org/docs/2.4/html/gui image-to-gcode.html.