Beruflich Dokumente
Kultur Dokumente
CHAPTER 1:
PERSPECTIVES
1.1. Introduction...........................................................................................................................3
1.2. Description............................................................................................................................3
1.3. Uses of CNC.........................................................................................................................4
Mills..........................................................................................................................................4
Lathes.......................................................................................................................................4
CNC Plasma Cutting Machine.................................................................................................4
1.4. Perspectives into the Modern History...................................................................................4
1.5. Building and Mini CNC and Our Perspective......................................................................5
CHAPTER 2:
PARAPHERNALIA 6
2.1. Electrical Equipments...........................................................................................................6
Arduino Uno.............................................................................................................................6
Bread Board..............................................................................................................................7
DVD Writer (ASUS 24D3ST)..................................................................................................7
Jumper Wire.............................................................................................................................8
Servo Motor..............................................................................................................................8
Lithium Polymer battery..........................................................................................................9
Motor driver (l293D)................................................................................................................9
2.2. Mechanical Parts.................................................................................................................10
L shaped base..........................................................................................................................10
Pen holder assembly...............................................................................................................11
Y Axis.....................................................................................................................................11
X Axis.....................................................................................................................................12
Nuts and Bolts........................................................................................................................12
Z Axis.....................................................................................................................................13
CHAPTER 3:
SYSTEM DYNAMICS
14
3.1. Mechanism..........................................................................................................................14
The CNC Controller or Drive control....................................................................................14
3.2. Circuit Design and Integration............................................................................................15
3.3. Software Components.........................................................................................................16
Arduino IDE...........................................................................................................................16
Processing...............................................................................................................................17
Inkscape..................................................................................................................................18
INDEX
19
Arduino Program........................................................................................................................19
Processing Program (gtcrl.pde) App..........................................................................................29
CHAPTER-1
PERSPECTIVES
1.1. Introduction:
Numerical control (NC) is the automation of machine tools that are operated by precisely
programmed commands encoded on a storage medium, as opposed to controlled manually by
hand wheels or levers, or mechanically automated by cams alone. Most NC today is computer
(or computerized) numerical control (CNC), in which computers play an integral part of the
control.
1.2. Description:
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 as long as the forces are kept small enough
and speeds are not too great. On commercial metalworking machines, closed loop controls are
standard and required in order to provide the accuracy, speed, and repeatability demanded.
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 fiber placement, routing, picking and placing, and sawing.
project, or EMC2, was a project to implement an Open Source CNC controller that was started
by NIST, the National Institute of Standards and Technology as a demonstration.
CHAPTER-2
PARAPHERNALIA
Based on the miscellaneous equipments we used to build the mini CNC, there are mainly two
groups of equipments-1) Electrical equipments and 2) Mechanical parts. We tried our best to
build the project from scratch and not to use custom built parts.
Bread Board:
A breadboard is a construction base for prototyping of electronics. Originally it was literally a
bread board, a polished piece of wood used for slicing bread. In the 1970s the solderless
breadboard (AKA plugboard, a terminal array board) became available and nowadays the term
"breadboard" is commonly used to refer to these.
combo (CD-RW/DVD-ROM) drive. As of 2015, DVD writer drive is the most common for
desktop PCs and laptops. There are also DVD-ROM drive, BD-ROM drive, Blu-ray Disc combo
drive, and Blu-ray Disc writer drive which are not so much demand in the market.
We used ASUS DRW-24D3ST. SUS DRW-24D3ST is a powerful 24X
DVDR/12X DVDR(DL)/8X DVD+RW/6X DVD-RW/16X DVD-ROM/12X DVDRAM/ 48X
CD-R/32X CD-RW/48X CD-ROM for a seamless function of flexibility, high quality and
Jumper Wire:
A jump wire, is a short electrical wire with a solid tip at each end (or sometimes without
them, simply "tinned"), which is normally used to interconnect the components in a breadboard.
PE: among others, they are used to transfer electrical signals from anywhere on the breadboard to
the input/output pins of a microcontroller.
Fig2.6.LIPO battery
motor with left H-bridge you need to enable pin 1 to high. And for right H-Bridge you need to
make the pin 9 to high. If anyone of the either pin1 or pin9 goes low then the motor in the
corresponding section will suspend working. Its like a switch
The pen holder is made of wooden block of 10x5 cm . a hole through the block is made to hold
the pen which is tapped to be tightened by a screw. The hole is of 1 cm bore . the screw is of 5
mm bore .The screw passes through a tapped front hole in the block .The block has another hole
of 5 mm bore in the back whole throuh,throuh which a 5.5 mm bore steel rod of 7 cm length
slides.The rod is smoothly machined to slide freely throuh the hole or minimize the friction,as
more friction would mean more power loss for the servo motor .The rod is hold to the main
platform of X axis throuh two partial holes of two wooden blocks .these two small wooden
blocks of 3x2 cm is glued to the main X axis base.To guide the return motion of the pen there are
spring tappings to
Limit the stroke .And there is a spring with a good restoration force and small elasticity to give
the return stroke restoration force after compression to push it downwards.the whole pen up and
down mechanism is based on this .
Y Axis:
The Y axis is made to accommodate one of the dvd writers which is used for guiding the x
co-ordinate motion of the mechanism .basically its a wooden pad to hold a piece of paper on it
.the wooden pad is about 7x7 cm beneath which there is a wooden support to increase the height
to reach the pen tip.the axis is mounted on the horizontal plane of the L shaped base.the pad
which is glued on the dvd writer with the whole assembly is mounted through couple of nuts and
bolts which also give it a desired height to meet the pen tip.
Figure.2.10: Y axis.
X Axis:
The X axis accommodates the whole pen holder assembly and guides the motion of the x
ordinate of the whole mechanism .the pen holder assembly is glued to it with the help of strong
glue.and the whole axis is mounted on the vertical plane of the L shaped base.It is also
heightened by using several nuts through bolts which again serves the purpose of mounting it .
Fig.2.11. X axis
The bolts have been used for several mountings such as the x axis and y axis,also to heighten the
axes to give them the desired location upto their limited stroke.
Z Axis:
The Z axis is simply a servo which is mounted to the verical base of the L shaped frame.The
servo is mounted by a mounting which is made of sheet metal and is of L shape of .Which has
several holes through it to screw it by nuts.The Z axis guides the motion of the z coordinate of
the mechanism .Which is basically the up and down motion of the pen.
The Z axis has a very little stroke though the measurement is really important as it will make the
pen contact with the writing paper.
CHAPTER- 3
SYSTEM DYNAMICS
As far any CNC this plotter pretty much depends on computer coltrol and precise depiction of
motion.to depict each and every step as for mathematics coordinates are always used.Machines
can be driven to such points with precision .To guide the pen to write something there are some
important things that we did. The DVD writers were dismantled to use the stepper motor with its
rail . basically two stepper with their rails and a servo motor to control the up and down motion
make up the total mechanism .
3.1. Mechanism:
The total mechanisms can be divide into three axes The X ,Y,Z axes.The X axis is as mentioned
above a stepper motor derived from one of the dvd writers.This stepper motor has a rail,which
like any shaft rotates as the motor turns.But the rail is threaded and there is small plastic surface
attached to it.When the motor truns at a particular speed the plastic surface with the help of the
rail moves along the X axis (left to right or right to left).This axis controls the movement of the
pen along left to right.
The Y is also controlled by a stepper which has a rail attached to it.This rail also has a plastic
surface attached to it.this surface moves back and forth to guide the movement of the writing
platform along the y axis .
For any 2-D object there are only two dimensions and coordinates.Basically any position at a
certain time can be depicted by two numbers or co-ordinates.so these two axes depict the
motions of the writing paper and the pen.And during the working stroke tip of the pen and the
writing paper merges together to write someething.But when a certain letter is done then it needs
to move towards another one,so certainly the pen is to uprise and go to its new loctaion.This is
pretty much done with the Z axis .the srvo blade only has a 180 degree motion .That means the
servo can turn its blade to a certain position then again move back to its old position.A servo can
be controlled to give much smaller angle rotation and the rotations are pretty much precise.
signals into mechanical motion through motor output. There are several components that make
up a controller and each component works in unison to produce the desired motor movement.
The word controller is a generic term that may refer to one of several devices, but usually
refers to the complete machine control system. This system may include the protection circuitry,
stepper or servo motor drivers, power source, limit switch interfaces, power controls, and other
peripherals. Owners, operators, designers, and builders of CNC devices should understand the
tasks performed by these components and how they affect machine performance.
The following sections will discuss the primary task of each component in the controller and
how they work together to create a complete CNC system.
sketch consist of two functions that are compiled and linked with a program stub main() into an
executable cyclic executive program:
setup(): a function that runs once at the start of a program and that can initialize settings.
loop(): a function called repeatedly until the board powers off.
After compilation and linking with the GNU toolchain, also including with the IDE distribution,
the Arduino IDE employs the program avrdude to convert the executable code into a text file in
hexadecimal coding that is loaded into the Arduino board by a loader program in the board's
firmware.
Fig.3.3 Arduino
Processing:
Processing is an open source programming language and integrated development environment
(IDE) built for the electronic arts, new media art, and visual design communities with the
purpose of teaching the fundamentals of computer programming in a visual context, and to serve
as the foundation for electronic sketchbooks. The project was initiated in 2001 by Casey Reas
and Benjamin Fry, both formerly of the Aesthetics and Computation Group at the MIT Media
Lab.
One of the stated aims of Processing is to act as a tool to get non-programmers started with
programming, through the instant gratification of visual feedback. The language builds on the
Java language, but uses a simplified syntax and graphics programming model. In 2012, they
started the Processing Foundation along with Daniel Shiffman, who formally joined as a third
project lead.
Processing includes a sketchbook, a minimal alternative to an integrated development
environment (IDE) for organizing projects.
Every Processing sketch is actually a subclass of the PApplet Java class which implements most
of the Processing language's features.
When programming in Processing, all additional classes defined will be treated as inner classes
when the code is translated into pure Java before compiling. This means that the use of static
variables and methods in classes is prohibited unless you explicitly tell Processing that you want
to code in pure Java mode.
Processing also allows for users to create their own classes within the PApplet sketch. This
allows for complex data types that can include any number of arguments and avoids the
limitations of solely using standard data types such as: int (integer), char (character), float (real
number), and color (RGB, ARGB, hex).
Fig.3.3.Processing
Inkscape:
With Inkscape an artist can create most of the same illustrations that can be made with Adobe
Illustrator. However, many of the functions and tools that the two applications share are used in
different ways, with different names, shortcuts, and approaches. Please add to this document any
relevant information on Inkscape/Illustrator parallels, constrasts, hits, and misses.
Illustrator can import Inkscape SVG and export SVG which Inkscape usually opens without
problems (there's one issue to be aware of). Conversely, Inkscape opens Adobe's AI (since
version 9) and PDF files (with some limitations: gradient meshes are approximated by lattices of
small paths, and transparency modes don't work). Inkscape can also export its documents as
PDF.
But we used it to create G-codes to give instruction to the gtcrl.pde application.
Anchor Points: in Inkscape, anchor points are known as "Nodes"
Palettes: in Inkscape, "palettes" are called "dialogs", such as the Fill and Stroke dialog.
Marquee: this is called "the rubberband" when selecting
Tools: see AdobeToolMap for complete tool equivalency reference.
Fig.3.4.inkscape
INDEX
Arduino Program:
#include <Servo.h>
#include <Stepper.h>
#define LINE_BUFFER_LENGTH 512
const int stepsPerRevolution = 20;
Servo penServo;
Stepper myStepperY(stepsPerRevolution, 2,3,4,5);
Stepper myStepperX(stepsPerRevolution, 8,9,10,11);
struct point {
float x;
float y;
float z;
};
float StepInc = 1;
int StepDelay = 0;
int LineDelay = 50;
int penDelay = 50;
float Xmin = 0;
float Xmax = 40;
float Ymin = 0;
float Ymax = 40;
float Zmin = 0;
float Zmax = 1;
float Xpos = Xmin;
float Ypos = Ymin;
lineIndex = 0;
lineSemiColon = false;
lineIsComment = false;
while (1) {
while ( Serial.available()>0 ) {
c = Serial.read();
if (( c == '\n') || (c == '\r') ) {
if ( lineIndex > 0 ) {
line[ lineIndex ] = '\0';
if (verbose) {
Serial.print( "Received : ");
Serial.println( line );
}
processIncomingLine( line, lineIndex );
lineIndex = 0;
}
else {
}
lineIsComment = false;
lineSemiColon = false;
Serial.println("ok");
}
else {
if ( (lineIsComment) || (lineSemiColon) ) {
if ( c == ')' ) lineIsComment = false;
else {
if ( c <= ' ' ) {
}
else if ( c == '/' ) {
}
else if ( c == '(' ) {
lineIsComment = true;
}
else if ( c == ';' ) {
lineSemiColon = true;
}
else if ( lineIndex >= LINE_BUFFER_LENGTH-1 ) {
Serial.println( "ERROR - lineBuffer overflow" );
lineIsComment = false;
lineSemiColon = false;
}
else if ( c >= 'a' && c <= 'z' ) {
// Upcase lowercase
char buffer[ 64 ];
struct point newPos;
newPos.x = 0.0;
newPos.y = 0.0;
while( currentIndex < charNB ) {
switch ( line[ currentIndex++ ] ) {
case 'U':
penUp();
break;
case 'D':
penDown();
break;
case 'G':
buffer[0] = line[ currentIndex++ ];
buffer[1] = '\0';
switch ( atoi( buffer ) ){
case 0:
Case 1:
char* indexX = strchr( line+currentIndex, 'X' );
char* indexY = strchr( line+currentIndex, 'Y' );
if ( indexY <= 0 ) {
newPos.x = atof( indexX + 1);
newPos.y = actuatorPos.y;
}
else if ( indexX <= 0 ) {
newPos.y = atof( indexY + 1);
newPos.x = actuatorPos.x;
}
else {
newPos.y = atof( indexY + 1);
indexY = '\0';
newPos.x = atof( indexX + 1);
}
drawLine(newPos.x, newPos.y );
//
Serial.println("ok");
actuatorPos.x = newPos.x;
actuatorPos.y = newPos.y;
break;
}
break;
case 'M':
buffer[0] = line[ currentIndex++ ];
buffer[1] = line[ currentIndex++ ];
buffer[2] = line[ currentIndex++ ];
buffer[3] = '\0';
switch ( atoi( buffer ) ){
case 300:
{
char* indexS = strchr( line+currentIndex, 'S' );
float Spos = atof( indexS + 1);
//
Serial.println("ok");
if (Spos == 30) {
penDown();
}
if (Spos == 50) {
penUp();
}
break;
}
case 114:
Serial.print( "Absolute position : X = " );
Serial.print( actuatorPos.x );
Serial.print( " - Y = " );
Serial.println( actuatorPos.y );
break;
default:
Serial.print( "Command not recognized : M");
Serial.println( buffer );
}
}
}
}
void drawLine(float x1, float y1) {
if (verbose)
{
Serial.print("fx1, fy1: ");
Serial.print(x1);
Serial.print(",");
Serial.print(y1);
Serial.println("");
}
}
x1 = (int)(x1*StepsPerMillimeterX);
y1 = (int)(y1*StepsPerMillimeterY);
float x0 = Xpos;
float y0 = Ypos;
long dx = abs(x1-x0);
long dy = abs(y1-y0);
int sx = x0<x1 ? StepInc : -StepInc;
int sy = y0<y1 ? StepInc : -StepInc;
long i;
long over = 0;
if (dx > dy) {
for (i=0; i<dx; ++i) {
myStepperX.step(sx);
over+=dy;
if (over>=dx) {
over-=dx;
myStepperY.step(sy);
}
delay(StepDelay);
}
}
else {
for (i=0; i<dy; ++i) {
myStepperY.step(sy);
over+=dx;
if (over>=dy) {
over-=dy;
myStepperX.step(sx);
}
delay(StepDelay);
}
}
if (verbose)
{
Serial.print("dx, dy:");
Serial.print(dx);
Serial.print(",");
Serial.print(dy);
Serial.println("");
}
if (verbose)
{
Serial.print("Going to (");
Serial.print(x0);
Serial.print(",");
Serial.print(y0);
Serial.println(")");
}
delay(LineDelay);
Xpos = x1;
Ypos = y1;
}
void penUp() {
penServo.write(penZUp);
delay(LineDelay);
Zpos=Zmax;
if (verbose) {
Serial.println("Pen up!");
}
}
void penDown() {
penServo.write(penZDown);
delay(LineDelay);
Zpos=Zmin;
if (verbose) {
Serial.println("Pen down.");
}
}
void openSerialPort()
{
if (portname == null) return;
if (port != null) port.stop();
port = new Serial(this, portname, 9600);
port.bufferUntil('\n');
}
void selectSerialPort()
{
String result = (String) JOptionPane.showInputDialog(frame,
"Select the serial port that corresponds to your Arduino board.",
"Select serial port",
JOptionPane.QUESTION_MESSAGE,
null,
Serial.list(),
0);
if (result != null) {
portname = result;
openSerialPort();
}
}
void setup()
{
size(500, 250);
openSerialPort();
}
void draw()
{
background(0);
fill(255);
int y = 24, dy = 12;
text("INSTRUCTIONS", 12, y); y += dy;
text("p: select serial port", 12, y); y += dy;
text("1: set speed to 0.001 inches (1 mil) per jog", 12, y); y += dy;
text("2: set speed to 0.010 inches (10 mil) per jog", 12, y); y += dy;
text("3: set speed to 0.100 inches (100 mil) per jog", 12, y); y += dy;
text("arrow keys: jog in x-y plane", 12, y); y += dy;
text("page up & page down: jog in z axis", 12, y); y += dy;
text("$: display grbl settings", 12, y); y+= dy;
text("h: go home", 12, y); y += dy;
text("0: zero machine (set home to the current location)", 12, y); y += dy;
text("g: stream a g-code file", 12, y); y += dy;
text("x: stop streaming g-code (this is NOT immediate)", 12, y); y += dy;
y = height - dy;
text("current jog speed: " + speed + " inches per step", 12, y); y -= dy;
text("current serial port: " + portname, 12, y); y -= dy;
}
void keyPressed()
{
if (key == '1') speed = 0.001;
if (key == '2') speed = 0.01;
if (key == '3') speed = 0.1;
if (!streaming) {
if (keyCode == LEFT) port.write("G91\nG20\nG00 X-" + speed + " Y0.000 Z0.000\n");
if (s.trim().startsWith("error")) stream();
}
After running the code it shows a message like this:
Fig.3.5.gtcrl.pde
G-code:
G-code (also RS-274), which has many variants, is the common name for the most widely
used numerical control (NC) programming language. It is used mainly in computer-aided
manufacturing to control automated machine tools. G-code is sometimes called G programming
language.G-code is a language in which people tell computerized machine tools how to make
something. The "how" is defined by instructions on where to move, how fast to move, and what
path to move. The most common situation is that, within a machine tool, a cutting tool is moved
according to these instructions through a toolpath and cuts away material to leave only the
finished workpiece. The same concept also extends to noncutting tools such as forming or
burnishing tools, photoplotting, additive methods such as 3D printing, and measuring
instruments.
G-codes are also called preparatory codes, and are any word in a CNC program that
begins with the letter G. Generally it is a code telling the machine tool what type of action to
perform, such as:
1)Rapid movement (transport the tool as quickly as possible through space to the location where
it will cut)
2)Controlled feed in a straight line or arc
3)Series of controlled feed movements that would result in a hole being bored, a workpiece cut
(routed) to a specific dimension, or a profile (contour) shape added to the edge of a workpiece
4)Set tool information such as offset
5)Switch coordinate systems
6)There are other codes; the type codes can be thought of like registers in a computer.
Students and hobbyists have pointed out over the years that the term "G-code" is imprecise. It
comes from the literal sense of the term, referring to one letter address and to the specific codes
that can be formed with it (for example, G00, G01, G28). But every letter of the English alphabet
is used somewhere in the language. Nevertheless, "G-code" is established as the common name
of the language.
Fig.3.6.Gcode
CHAPTER -4
Future modifications
Pushing the desired alphabet or number key the desired g-code is selected ,the cnc will function
almost like a printer .here are some modes of input and control that are suggested-
Though these mode switch positions have substantial differences, we consider them together for
two reasons. First, both mode switch positions involve entering data through the keyboard. With
the edit position of the mode switch, a program is entered or modified. With the MDI position of
the mode switch CNC commands are entered and executed.
Second, both provide manual capabilities that can also be done in a more automatic way. In edit
mode, an operator can enter CNC programs into the control memory. This can also be
accomplished by loading the program from some outside device, such as a computer or tape
reader. In MDI mode, CNC commands are entered through the keyboard and display screen
manually and can be executed once. If the command must be executed a second time, the
operator must enter the MDI command a second time. However, if the same command is
included in a program, it can be executed automatically, over and over without having to be retyped.
4.1.2)Edit Mode:
If the user has ever worked with a word processor, they will find the use of the edit mode
of a CNC control familiar and easy to work with. In this mode, the operator is allowed to do two
basic things. He can enter CNC programs into the control memory and modify current programs.
Almost all CNC controls allow the operator to store multiple programs. Programs are typically
organized by program number (commonly the O word). The operator will be allowed to call up
the desired program from within the control's memory, making it the active program.
All true CNC controls give the user the ability to do at least three basic things in the edit mode.
The operator can insert new information into the program, alter the current information in the
program, and delete information from the program. Some CNC controls also allow the operator
to do global editing, meaning they can cut and paste, and find and replace data.
Along with these basic features, the operator will be allowed to search or scan the program for
key information. For example, the control can quickly search to the next occurrence of any
programming word. If the programmer used sequence numbers (N words) the operator could use
the sequence number of an incorrect command as the word used to search.