Development of a Computer Numerically Controlled Router Machine ...

7 downloads 13766 Views 3MB Size Report
Development of a Computer Numerically. Controlled Router Machine With 4 Degrees of. Freedom Using an Open Architecture. Leonardo Romero Mu˜noz.
Development of a Computer Numerically Controlled Router Machine With 4 Degrees of Freedom Using an Open Architecture Leonardo Romero Mu˜noz

Moises Garc´ıa Villanueva

Mario Santana G´omez

Facultad de Ingenier´ıa El´ectrica UMSNH Morelia, Mich., Mexico Email: [email protected]

Facultad de Ingenier´ıa El´ectrica UMSNH Morelia, Mich., Mexico Email: [email protected]

Facultad de Ingenier´ıa El´ectrica UMSNH Morelia, Mich., Mexico Email: [email protected]

Abstract—A CNC router machine, of low cost, medium precision, 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.

TABLE I E STIMATED ANNUAL SHIPMENTS OF INDUSTRIAL ROBOTS IN SELECTED COUNTRIES [9]. Country America

2010 17,114

North America (Canada, Mexico, USA)

I. I NTRODUCTION

16,356

Central and South America

Industrial robots have been used with success to do multiple tasks including: automotive industry, electrical/electronic industry, metal products and many others (see Figure 1). Estimated worldwide annual supply of industrial robots at year-end by industries 2009 - 2011

Asia/Australia

2,600

4,100

98,900

116,700

14,978

22,577

26,000

35,000

776

1,547

2,000

3,500

Japan

21,903

27,894

31,000

35,000

Republic of Korea

23,508

25,536

26,800

25,000

Taiwan

3,290

3,688

4,400

Thailand

2,450

3,453

4,100

7,000

Other Asia/Australia

2,928

20,483

4,600

5,700

20,483

43,826

44,100

47,200

2,049

3,058

3,300

3,500

19,000

20,000

402

Germany

2,000

3,000

14,061

19,533

4,517

5,091

4,600

4,900

Spain

1,897

3,091

2,500

3,000

878

1,514

2,000

2,200

6,937

9,921

11,100

10,600

259 120,585

323 166,028

350 180,950

500 207,500

other Europe

Metal products

1,618

5,500

Italy United Kingdom

Chemical, rubber and plastics

31,000

1,886

88,698

France

Automotive parts

28,000

2015* 35,100

758

India

Europe

Motor vehicles

24,341

2012* 30,600

69,833

China

Czech Rep.

Electrical/electronics*

2011 26,227

Africa Total**

Food

2011

Industrial machinery

2010

Sources: IFR, national robot associations.

Communication

2009

*forecast

**including sales which are not specified by countries

Consumer, domestic appliances Glass, ceramics Medical, precision & optical instruments Others Unspecified 0 *incl. computers

5,000

10,000

15,000

20,000 units

25,000

30,000

35,000

Source: IFR Statistical Department

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

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

rest of the paper is organized as follows: Section II describes the general characteristics of the machine developed. Section III presents the control software and some applications in 2D. Section IV describes how to post-process Gcode files in order to optimize execution time. Finally, Section V presents the conclusions and future work. II. T HE CNC ROUTER MACHINE

motor Z motor Y Z X

Y A

motor A

Figure 2 shows the machine developed, an XY ZA CNC router table, using a Dewalt DWP611 router. Additionally it includes a commercial vacuum cleaner to absorb the materials arising from the workpiece when the router is operating. The vacuum cleaner is under the router table and its hose is located next to the Dewalt router.

motor X (a) The four degrees of freedom

(b) Rotation around the X axis Fig. 3.

Fig. 2.

The CNC router developed.

The router can move in the X, Y and Z directions, and the workpiece can be rotated around the X axis, using the motor A, as shown in Figure 3 (a) and (b). The characteristics of the machine are shown in Table II. TABLE II M ACHINE SPECIFICATIONS

X-axis Y-axis Z-axis A-axis

Travel distance 16” 8” 2.5” −

Resolution 0.0005” 0.0005” 0.0005” 0.45o

Speed 1”/s 1”/s 1”/s 1800o /s

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

The CNC router table.

precision nuts (5 turns per inch). Each axis uses a Nema 23 stepper motor, model 23HS9430 from Longs Motor [8], 425 oz-in, 3 A, 30 V and 1.8 deg/step. Figure 4 shows the box with four stepper motor driver DM542A, 1850 VDC, peak 4.2A; the Power supply S-35024 of 350Watts (24VDC/14.6A); and the Breakout board (all from Longs Motor). The DM542A applies a PWM (Pulse Width Modulation) current control scheme to move the stepper motor. The stepper motor is controlled by two signals, a P ulse signal (or Step signal) to move the motor a single step, and a Direction signal to indicate the direction of the movement. The parallel port from the breakout board is used to connect to a Personal Computer (PC). The parallel port outputs are used to control the four stepper motors and the parallel port inputs receive the status of limit switches for axis X, Y and Z, and the status of an emergency button (a red button used to stop the machine in an emergency situation). The 5 V supply required by the breakout board is supplied by a USB cable from the PC. Figure 5 shows the connexions between the different components of the CNC router machine. All these components make up a robust CNC router machine controlled by the parallel port of a PC.

(a) Driver box

(b) DM542A

(c) Breakout board Fig. 4.

Fig. 5.

The motor driver box.

NIST first became interested in writing a motion control package as a test platform for concepts and standards. Early sponsorship from General Motors resulted in an adaptation of the fledgling version of EMC using PMAC intelligent control boards running under a ”real time” version of Windows NT and controlling a large milling machine. Early considerations focused on replacing the expensive and temperamental ”real time” Windows NT system. It was proposed that a relatively new (at the time) real time extension of the Linux operating system be tried. This idea was pursued with success. NIST set up a mailing list for people interested in EMC. As time went on, others outside NIST became interested in improving EMC. Many people requested or coded small improvements to the code. As this community became larger, the EMC mailing list and code archives were moved to the SourceForge and the LinuxCNC web site was established. LinuxCNC has many features and brings a lot of functionality (a flexible and powerful Hardware Abstraction Layer that allows you to adapt it to many kinds of machinery, a software PLC controller, easier installation, a new trajectory planner, and more). LinuxCNC also has a Simulator version, without using realtime, that works on standard Linux systems [6]. LinuxCNC is precompiled with Ubuntu LTS (long term support) versions for ease of installation and longevity. We use the version of Ubuntu 10.04 LTS in a Personal Computer. Figures 6 and 7 show the parallel port setup and the X axis configuration, respectively. Configurations for axis Y , Z and A are similar.

Connexions between different components.

III. S OFTWARE COMPONENTS We select a realtime version of Linux operating system on the Personal Computer to control the CNC router machine. This environment is called LinuxCNC [7]. A. LinuxCNC LinuxCNC is a software system for computer control of machines such as milling machines, lathes, plasma cutters, cutting machines, robots, hexapods, etc. LinuxCNC is Free software released under the terms of the GNU GPLv2. LinuxCNC is a descendent of the Enhanced Machine Controller (EMC) created by the National Institute of Standards and Technology (NIST), which is an agency of the Commerce Department of the United States government (see [1] for a survey in 1995 of the NIST realtime control system).

Fig. 6.

LinuxCNC Parallel Port Setup

The linuxcnc program executes CNC machine programs in the G Code format. The LinuxCNC G Code language is based on the NIST RS274/NGC language. B. Making simple drawings Here we review four programs for Linux related to the task of making simple drawings: xfig, potrace, pstoedit and image–

Fig. 9.

Fig. 7.

LinuxCNC interface.

LinuxCNC X Axis Configuration.

to–gcode. 1) xfig program: Xfig is a freeware interactive vectorial drawing tool which runs under X Window System on most UNIX-compatible platforms. There is a version of xfig to export drawings to the G Code format [4]. For instance, Figure 8 shows the xfig interface, Figure 9 shows the Linuxcnc interface associated with the file generated by xfig (hello.ngc), and Figure 10 shows the final result executing hello.ngc.

Fig. 10.

Final workpiece

Gimppath, and Xfig. We only found this free program, others similars are comercial programs. 3) pstoedit program: pstoedit translates PostScript and PDF graphics into other vector formats, including the G Code format [12]. 4) image–to–gcode: The program image–to–gcode [13] is integrated to the LinuxCNC program and it transforms a greyscale image into a milling depth map (a G Code file). A depth map is a greyscale image where the brightness of each pixel corresponds to the depth (or height) of the object at each point. Fig. 8.

Xfig interface.

2) potrace program: Potrace transforms bitmaps into vector graphics [11]. Potrace is a free software tool for tracing a bitmap, 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 encapsulated PostScript file (EPS). A typical use is to create EPS files from scanned data, such as company or university logos, handwritten notes, etc. The resulting image is softer than the original 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),

C. Making more complex drawings As we can see, Figure 8 shows the letters filled with a black color, but the G Code program follows only the contours, as shown in Figure 10. The same result is obtained using the pstoedit program. We write a program called fill image, to generate paths to the router inside the black filled areas, in order to get the same depth in the border and in the interior of the black areas. The input to fill image is an image like the one shown in Figure 11. The program fill image uses the OpenCV Software Library (see [5] for a good introduction to Computer Vision using the OpenCV library) and it follows Algorithm 1. It computes the image contours using the Canny operator, where contours

Fig. 11.

A black & white butterfly

Fig. 12.

The output of program fill image

are represented by non-zero pixels (white pixels over a black background). To Dilate an image, a morphological filter is used. Algorithm 1 Finding contours INPUT: I, a binary image OUTPUT: R, a binary image with contours R ← BlackImage() // All pixels equal to zero while hasBlackP ixels(I) do C ← CannyOperator(I) // Compute contours of I R ← Add(R, C) D ← Dilate(C) I ← Add(D, I) end while return R The output of the program fill image with the image of Figure 11 as input, is shown in Figure 12. It can be noted that black areas in the input image are replaced by interior contours 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 get the desired result on the CNC machine. Another alternative to get a similar result is using the imageto–gcode program, but in that case the CNC router follows paths from left to right, and from top to bottom, similar to the operation of an ink printer (and hence it takes a lot more time to finish the task). The result using the fill image program is similar to the operation of a plotter. D. Creating Printed Circuit Boards (PCB) For this task we use the program Eagle and the User Language Program (ULP) PCB-Gcode. 1) Eagle program: Eagle is a powerful and flexible PCB design software offering high level functionality [3]. It has algorithms of autorouter the vias and tools that supports in manual routing. Allows feature enhancement through User Language Programs (ULP) which are partly integrated. Eagle can generate data for mounting machines, test equipments, milling machines or any other data format. Figure 13 shows an example of the Board Editor interface of Eagle.

Fig. 13.

Eagle Board Editor Interface.

2) PCB-Gcode ULP: Pcb-Gcode allows use milling machine, router, engraver, etc. to make printed circuit boards without using toxic chemicals. Machine cuts around the traces for the circuits. PCB-Gcode also creates drill files to drill holes, mill files to cut the board out, or make cutouts in the board [10]. As a test, we create a simple design with Eagle, then use PCB-Gcode to create the associated G-code file. Figure 14 shows the final result.

Fig. 14.

A PCB made with the CNC router machine.

IV. P OST- PROCESSING THE GCODE FILE The file generated by pstoedit does not start with strokes from the CNC machine origin, instead it starts on the image origin (near to the top left corner of the image) continuing with the next point located to the right and then it repeats the left–right search from top to bottom. In this way the strokes sequence makes unnecessary movements. We write a program called fast gcode to improve the time required to do the sequence of movements on the CNC machine. The input to this program is a g–code file, and its output is a g–code file where the strokes has been ordered to minimize the movement (and hence the time) of the CNC machine between successive strokes. The first stroke selected has its start point closest to the origin position of CNC machine. We implement the Algorithm 2 to obtain the sequence of strokes that improve the time to develop the task of CNC machine. Some results of this program are shown in Table III (strokes are done using a constant feed rate of 10in/min). TABLE III T IME IMPROVED WHEN STROKES ARE OPTIMIZED TO MAKE THE CNC MACHINE TASK . Strokes

pstoedit (min)

Our Algorithm (min)

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

Images

V. C ONCLUSION AND F UTURE W ORK We have presented a low cost and open CNC router machine with 4 degrees of freedom, using stepper motors and the parallel port interface of a PC. The PC runs LinuxCNC, a real–time version of the Linux operating system. Also we have describe some programs in the Linux environment to make simple tasks. In the near future we planned to apply this CNC router machine as a test bed to do some tasks in the guitars factories in Paracho, Michoacan, Mexico, looking to improve their processes. We also plan to develop open software easy to use to do special tasks over wood in those factories.

Algorithm 2 Optimize the sequence of strokes INPUT: T , sequence of strokes OUTPUT: Tn , a new sequence of strokes xs ← 0 ys ← 0 while T 6= N U LL do ti ← 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 while return Tn

Also we plan to review programs that convert 3D models from Autocad (or similar programs like blender) to Gcode and add two cameras to the CNC router machine to form a stereo vision system. The idea is to get a 3D model from several views of an object and to reproduce the object using the CNC router machine. ACKNOWLEDGMENT The authors would like to thank to the Michoacana University to finance a research project to develop the CNC router machine presented in this paper. R EFERENCES [1] James S Albus et al. The nist real-time control system (rcs): An application survey. In Proceedings of the AAAI 1995 Spring symposium Series, pages 27–29, 1995. [2] O. L. Asato, E. R. R. Kato, R. Y Inamasu, and A. J. V. Porto. Analysis of 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 Programming 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, June 2001. http://www.ifr.org/industrial-robots/statistics/. [10] PCB-Gcode. Use your milling machine, router, engraver, etc. to make pcb, 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 vector formats, 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.

Suggest Documents