Approximation in 2D CNC Motion

17
Term Project Report Industrial Building & Automation Systems (Fall 2016-2017) Approximation in 2D CNC Motion Prepared by: Subkhiddin Mukhidinov Department of Mechanical Engineering Piraeus University of Applied Sciences Athens, January 2017

Transcript of Approximation in 2D CNC Motion

Page 1: Approximation in 2D CNC Motion

Term Project Report

Industrial Building & Automation Systems

(Fall 2016-2017)

Approximation in 2D CNC Motion

Prepared by:

Subkhiddin Mukhidinov

Department of Mechanical Engineering

Piraeus University of Applied Sciences Athens, January 2017

Page 2: Approximation in 2D CNC Motion

Table of Contents

Introduction

History

Basic Components of NC Machines

Computer Numerical Controlled Machines

Lathe

Mill

3D Printer

2D (x-y) Motion

Stepper Motor

Algorithm to Approximate

Linear Interpolation

Circular Interpolation

Examples

References

Page 3: Approximation in 2D CNC Motion

INTRODUCTION

Numerical control can be defined as a technique of controlling a machine

tool by the direct insertion of numerical data at some point of the system. The

functions that are controlled on the machine tool are displacement of the slide

members, spindle speeds, tool selection etc. At first, the numerical control was

used to produce geocentrically complex parts but later used for added efficiency

in medium batch production of turned and milled parts presently, Numerical

control is employed in all sectors of production.

Rapid development in the field of electronics such as integrated circuit, large scale

integrated circuits and development of minicomputer lead to the development of

minicomputers based CNC systems. Further development and the electronic

“chip” revolution have ushered in the current generation “compact and powerful”

Microprocessor based CNC systems.

Development of computer numerically controlled (CNC) machines is an

outstanding contribution to the manufacturing industries. It has made possible the

automation of the machining process with flexibility to handle small to medium

batch of quantities in part production.

Initially, the CNC technology was applied on basic metal cutting machine like

lathes, milling machines, etc. Later, to increase the flexibility of the machines in

handling a variety of components and to finish them in a single setup on the same

machine, CNC machines capable of performing multiple operations were

developed. To start with, this concept was applied to develop a CNC machining

centre for machining prismatic components combining operations like milling,

drilling, boring and taping. Further, the concept of multi-operations was also

extended for machining cylindrical components, which led to the development of

turning centres.

Computer Numerical Control (CNC) is a specialized and versatile form of Soft

Automation and its applications cover many kinds, although it was initially

developed to control the motion and operation of machine tools.

Computer Numerical Control may be considered to be a means of operating a

machine through the use of discrete numerical values fed into the machine, where

the required 'input' technical information is stored on a kind of input media such

as floppy disk, hard disk, CD ROM, DVD, USB flash drive, or RAM card etc.

The machine follows a predetermined sequence of machining operations at the

predetermined speeds necessary to produce a workpiece of the right shape and

Page 4: Approximation in 2D CNC Motion

size and thus according to completely predictable results. A different product can

be produced through reprogramming and a low-quantity production run of

different products is justified.

History

The development of numerical control owes much to the United States air

force, which recognized the need to develop more efficient manufacturing

methods for modern aircraft. Following World War II, the components used to

fabricate jet aircraft became more complex and required more machining. Most

of the machining involved milling operations, so the Air Force sponsored

a research project at Massachusetts Institute of Technology to develop a prototype

NC milling machine. This prototype was produced by retrofitting a conventional

tracer mill with numerical control servomechanisms for the three axes of the

machine. In March 1952, the MIT Labs held the first demonstration of the NC

machine. The machine tool builders gradually began developing their

own projects to introduce commercial NC units. Also, certain industry users,

especially airframe builders, worked to devise numerical control machines to

satisfy their own particular production needs. The Air force continued its

encouragement of NC development by sponsoring additional research at MIT to

design a part programming language that could be used in controlling N.C.

machines.

Page 5: Approximation in 2D CNC Motion

Basic Components of NC System

An operational numerical control system consists of the following three basic

components:

1. Program of instructions.

2. Controller unit, also called machine tool unit.

3. Machine tool or other controlled process.

The program of instructions serves as input to the controller unit, which in turn

commands the machine tool or other process to be controlled

Program of Instructions

The program of instructions is the detailed step by step set of instructions

which tell the machine what to do. It is coded in numerical or symbolic form on

some type of input medium that can be interpreted by the controller unit. The

most common one is the 1-inch-wide punched tape. Over the years, other forms

of input media have been used, including punched cards, magnetic tape, and

even 35mm motion picture film.

There are two other methods of input to the NC system which should be

mentioned. The first is by manual entry of instructional data to the controller

unit. This is time consuming and is rarely used

except as an auxiliary means of control or when one or a very limited no. of

parts to be made. The second method of input is by means of a direct link with

the computer. This is called direct numerical

control, or DNC.

Page 6: Approximation in 2D CNC Motion

Controller Unit

The second basic component of NC system is the controller unit. This

consists of electronics and hardware that read and interpret the program of

instructions and convert it to mechanical actions of the machine tool. The typical

elements of the controller unit include the tape reader, a data buffer, signal

output channels to the machine tool, and the sequence controls to coordinate the

overall operation of the foregoing elements.

The tape reader is an electrical-mechanical device for the winding and reading

the punched tape containing the program of instructions. The signal output

channels are connected to the servomotors and other controls in machine tools.

Most N.C. tools today are provided with positive feedback controls for this

purpose and are referred as closed loop systems. However there has been growth

in the open loop systems which do not make use of feedback signals to the

controller unit. The advocates of the open loop concept claim that the reliability

of the system is great enough that the feedback controls are not needed.

Machine Tool

The third basic component of an NC system is the machine tool or other

controlled process. It is part of the NC system which performs useful work. In

the most common example of an NC system, one designed to perform

machining operations. The machine tool consists of the worktable and spindle as

well as the motors and controls necessary to drive them. It also includes the

cutting tools, work fixtures and other auxiliary equipment needed in machining

operation.

Page 7: Approximation in 2D CNC Motion

Description of NC Machines

Motion is controlled along multiple axes, normally at least two (X and

Y), and a tool spindle that moves in the Z (depth). The position of the tool is

driven by direct-drive stepper motor or servo motors in order to provide highly

accurate movements, or in older designs, motors through a series of step down

gears. Open-loop control works if the forces are kept small enough and speeds

are not too great. On commercial metalworking machines, closed loop controls

are standard and required to provide the accuracy, speed,

and repeatability demanded.

As the controller hardware evolved, the mills themselves also evolved.

One change has been to enclose the entire mechanism in a large box as a safety

measure, often with additional safety interlocks to ensure the operator is far

enough from the working piece for safe operation. Most new CNC systems built

today are 100% electronically controlled.

CNC-like systems are now used for any process that can be described as a

series of movements and operations. These include laser cutting, welding,

friction stir welding, ultrasonic welding, flame and plasma cutting, bending,

spinning, hole-punching, pinning, gluing, fabric cutting, sewing, tape and fibre

placement, routing, picking and placing, and sawing.

Mills

CNC milling is a specific form of computer numerical controlled (CNC)

machining. Milling itself is a machining process similar to both drilling and

cutting, and able to achieve many of the operations performed by cutting and

drilling machines. Like drilling, milling uses a rotating cylindrical cutting tool.

However, the cutter in a milling machine is able to move along multiple axes,

and can create a variety of shapes, slots and holes. In addition, the work-piece is

often moved across the milling tool in different directions, unlike the single axis

motion of a drill.

CNC milling devices are the most widely used type of CNC machine.

Typically, they are grouped by the number of axes on which they operate, which

are labelled with various letters. X and Y designate horizontal movement of the

work-piece (forward-and-back and side-to-side on a flat plane). Z represents

vertical, or up-and-down, movement, while W represents diagonal movement

across a vertical plane. Most machines offer from 3 to 5 axes, providing

performance along at least the X, Y and Z axes. Advanced machines, such as 5-

Page 8: Approximation in 2D CNC Motion

axis milling centres, require CAM programming for optimal performance due to

the incredibly complex geometries involved in the machining process. These

devices are extremely useful because they are able to produce shapes that would

be nearly impossible using manual tooling methods. Most CNC milling

machines also integrate a device for pumping cutting fluid to the cutting tool

during machining.

Lathes

A metal lathe or metalworking lathe is a large class of lathes designed for

precisely machining relatively hard materials. They were originally designed to

machine metals; however, with the advent of plastics and other materials, and

with their inherent versatility, they are used in a wide range of applications, and

a broad range of materials. In machining jargon, where the larger context is

already understood, they are usually simply called lathes, or else referred to by

more-specific subtype names (toolroom lathe, turret lathe, etc.). These

rigid machine tools remove material from a rotating workpiece via the

(typically linear) movements of various cutting tools, such as tool bits and drill

bits.

Page 9: Approximation in 2D CNC Motion

The design of lathes can vary greatly depending on the intended

application; however, basic features are common to most types. These machines

consist of (at the least) a headstock, bed, carriage, and tailstock. Better machines

are solidly constructed with broad bearing surfaces (slide-ways) for stability,

and manufactured with great precision. This helps ensure the components

manufactured on the machines can meet the required tolerances and

repeatability.

3D Printers

3D Printing is an additive manufacturing process that creates a physical

object from a digital design. There are different 3D printing technologies and

materials you can print with, but all are based on the same principle: a digital

model is turned into a solid three-dimensional physical object by adding material

layer by layer.

Every 3D print starts as a digital 3D design file – like a blueprint – for a

physical object. Trying to print without a design file is like trying to print a

document on a sheet of paper without a text file. This design file is sliced into thin

layers which is then sent to the 3D printer. From here on the printing process

varies by technology, starting from desktop printers that melt a plastic material

and lay it down onto a print platform to large industrial machines that use a laser

Page 10: Approximation in 2D CNC Motion

to selectively melt metal powder at high temperatures. The printing can take hours

to complete depending on the size, and the printed objects are often post-

processed to reach the desired finish.

Available materials also vary by printer type, ranging from plastics to rubber,

sandstone, metals and alloys - with more and more materials appearing on the market every year.

Although 3D printing is commonly thought of as a new ‘futuristic’ concept, it has

actually been around for more than 30 years. Chuck Hull invented the first 3D

printing process called ‘stereo lithography’ in 1983. In a patent, he defined stereo

lithography as ‘a method and apparatus for making solid objects by successively

“printing” thin layers of the ultraviolet curable material one on top of the other’.

This patent only focuses on ‘printing’ with a light curable liquid, but after Hull

founded the company ‘3D Systems’, he soon realized his technique was not

limited to only liquids, expanding the definition to ‘any material capable of

solidification or capable of altering its physical state’. With this, he built the

foundation of what we now know today as additive manufacturing (AM) – or 3D

printing.

Page 11: Approximation in 2D CNC Motion

X-Y Motions

A microcomputer can be used to control the motion of numerical control

machines. This article describes a straightforward method for approximating

diagonal lines and circular motion on an XY plane.

Many numerical control machines are powered by stepping motors. When

a pulse is sent to a stepping motor, the stepping motor alters its position by a

unit step. Two motors can be used to control the XY movements of an arm or

tool over a working plane.

If the pulses are generated by a device which can remember or generate a

specified train of pulses, repetitive operations such as grinding, painting, or

cutting can be performed hundreds of times with virtually no variation. A

microcomputer is an obvious choice to generate and remember the pulses.

Since stepper motors can move only in discrete steps, we must

approximate the actual curve by a series of small XY motions. Many algorithms

rely upon parametric functions such as sine and cosine to perform the necessary

calculations. Parametric functions, however, typically require a high degree of

numeric precision. Calculating sine and cosine values with a microcomputer can

be too time-consuming to be useful in a real-time application.

The following two algorithms require no parametric functions. This

makes them ideally suited to the computation and memory capacities Kenneth

and Melvin Goldberg 3913 Pine Street, Apt. F Philadelphia, Pennsylvania 19104

of microcomputers. Since these algorithms do not require a large amount of

complex mathematical calculation, they are fast enough to be used in real-time

applications. The program shown in listing 1 is written in C for fast execution,

portability, and ease of modification. The program, as shown, does not actually

control any stepping motors; rather, it provides a screen display consisting of +1,

-1, and 0. In an actual control situation, these values would be transferred to

stepper motors or a graphic display.

Page 12: Approximation in 2D CNC Motion

Stepper Motor

A stepper motor or step motor or stepping motor is a brushless DC electric

motor that divides a full rotation into a number of equal steps. The motor's position

can then be commanded to move and hold at one of these steps without any

feedback sensor (an open-loop controller), as long as the motor is carefully sized

to the application in respect to torque and speed.

Stepper motors effectively have multiple "toothed" electromagnets

arranged around a central gear-shaped piece of iron. The electromagnets are

energized by an external driver circuit or a micro controller. To make the motor

shaft turn, first, one electromagnet is given power, which magnetically attracts the

gear's teeth. When the gear's teeth are aligned to the first electromagnet, they are

slightly offset from the next electromagnet. This means that when the next

electromagnet is turned on and the first is turned off, the gear rotates slightly to

align with the next one. From there the process is repeated. Each of those rotations

is called a "step", with an integer number of steps making a full rotation. In that

way, the motor can be turned by a precise angle.

Types

There are three main types of stepper motors:

1. Permanent magnet stepper

2. Hybrid synchronous stepper

3. Variable reluctance stepper

Permanent magnet motors use a permanent magnet (PM) in the rotor and operate on the attraction or repulsion between the rotor PM and the stator electromagnets.

Variable reluctance (VR) motors have a plain iron rotor and operate based on the principle that minimum reluctance occurs with minimum gap, hence the rotor

points are attracted toward the stator magnet poles.

Page 13: Approximation in 2D CNC Motion

System

A stepper motor system consists of three basic elements, often combined with some type of user interface (host computer, PLC or dumb terminal):

Indexers

The indexer (or controller) is a microprocessor capable of generating step pulses and direction signals for the driver. In addition, the indexer is typically

required to perform many other sophisticated command functions.

Drivers

The driver (or amplifier) converts the indexer command signals into the power

necessary to energize the motor windings. There are numerous types of drivers,

with different voltage and current ratings and construction technology. Not all drivers are suitable to run all motors, so when designing a motion control system,

the driver selection process is critical.

Stepper motor

The stepper motor is an electromagnetic device that converts digital pulses

into mechanical shaft rotation. Advantages of step motors are low cost, high reliability, high torque at low speeds and a simple, rugged construction that

operates in almost any environment. The main disadvantages in using a stepper motor is the resonance effect often exhibited at low speeds and decreasing torque

with increasing speed.

Page 14: Approximation in 2D CNC Motion

Linear Interpolation

Approximating diagonal lines with unit steps in two dimensions can be

accomplished with the following algorithm. 1. Define the starting position (Xl,

Y1) and ending position (X3, Y3). Define the feed rate (f). Feed rate is the speed

at which the tool being controlled moves. The Electronic Industries Association

(EIA) recommends the following notation for linear interpolation:

G01 (X1, Y1, X3, Y3) f

where

Xl, Y1 is starting position

X3, Y3 is ending position

f is feed rate

2. Initialize variables. Set the current relative position (X2, Y2) of the tool to (0,0).

This effectively sets the current tool position to the starting point. Set the step

count number to zero.

3. Calculate the direction in which to move the tool. When following a straight

line from one point to another, all X motion is in the same direction, as is all Y

motion. The direction is determined by the sign of the difference (DX and DY)

between the ending and the starting positions. DX=X3-Yl. DY=Y3-Yl.

4. Calculate the difference between the absolute values of DX and DY. This

determines FXY, a variable which is used to control the movements along the X

and Y axes. FXY=DX-DY.

5. Generate output pulses to move the tool until the endpoint is reached. This is

the heart of the program. The proportionate stream of XY pulses is generated by

manipulating variable FXY. Each time a step is taken in the X direction, the

absolute value of DY is subtracted from FXY. When FXY becomes negative, a

step is taken in the Y direction, and the absolute value of DX is added to FXY.

The sign of FXY determines the appropriate step needed to approximate a straight

line.

6. A delay loop controls the feed rate. This loop may include extra delay for the

initial steps. "Ramping up" the feed rate in this manner is useful in real-world

situations where the inertia of a machine may have a significant effect on the

Page 15: Approximation in 2D CNC Motion

system. Table 1 shows the output generated when a starting point of (0,0), an

ending point of (3, -7), and a feed rate of 300 are given to the program shown in

listing 1.

Circular Interpolation

A conceptually similar nonparametric algorithm can provide the necessary

XY steps for approximating a circular path. The equation for a circle is:

FXY = X2 + Y2 – R2

FXY = positive when (X, Y) is outside circle

0 when (X, Y) is on circumference

negative when (X, Y) is inside circle

DX = 2X

DY = 2Y

The variable FXY determines the direction in which the tool is moved at

each point on the circle. The motion is always perpendicular to the instantaneous

circular radius. The tangent to a circle is always perpendicular to the radius. The

X and Y components of the radius are defined by the partial derivatives of FXY.

We propose to step the machine tool around the circle by comparing the

current tool position to the ideal radius. We perform this comparison by tracking

the value of FXY. We know that the tool has crossed the circumference and must

Page 16: Approximation in 2D CNC Motion

be corrected when the sign of FXY changes. The appropriate correction (±X, ±Y)

depends on the quadrant in which the tool is located.

This algorithm's simplicity lies in the fact that the only information required

to determine the proper output is the sign of FXY, its derivatives, and the direction

of rotation. (0= clockwise, 1= counter clockwise). If we denote positive by 1 and

negative by 0, then we can organize the 16 possible combinations of values as

shown in table 2. Table 3 shows the output generated for a typical circular

approximation.

Figure 1 demonstrates the raggedness found in part of an enlarged path of

a typical circle. The raggedness is greatly decreased in large diameter circles.

With a radius of 1000 steps, a circle will appear smooth to the naked eye.

Page 17: Approximation in 2D CNC Motion

REFERENCES

1. Introduction to Numerical Control Machining http://www.mfg.mtu.edu/cyberman/machtool/auto/nc/intro.html

2. Numerical Control

https://en.wikipedia.org/wiki/Numerical_control#History

3. 3D Printers

https://www.3dhubs.com/what-is-3d-printing

4. XY Interpolation Algorithms – UC Berkeley

http://goldberg.berkeley.edu/pubs/XY-Interpolation-Algorithms

5. Stepper Motors

https://en.wikipedia.org/wiki/Stepper_motor#Types