Você está na página 1de 84

(CNC MODEL)

MAIN PROJECT REPORT

Submitted By

NAMES

DR/ Ahmed El-Deeb

Eng/ Anderw Sameh


ABSTRACT

2D Robotic Plotter is an embedded system that works based on the principle Computer
Numerical Control.Robotic 2D Plotter basically works with two stepper motors and a servo
motor, wherein the robot plots the input given from the computer on the drawing board
using ATMEGA 328p microcontroller on a open-source physical computing platform
Arduino. The Robotic 2D plotter has a two axis control and a special mechanism to raise
and lower the pen. Each axis is powered and driven by using an Arduino compactable
driver L293D. Pen control is achieved using a servo.The X and Y axis mainly consists of
step-per motors taken from CD-drives.The software used for programming the Arduino
board are namely Inkscape(0.48.5),Processing (3.0.2),CAMOTICS,Arduino IDE.The
correct and e cient arrangement and proper use of the programs along with the circuit
makes up an e cient 2D Robotic Plotter (CNC).
5
Table Of Contents

1 Introduction
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Computer Numerical Control (CNC) . . . . . . . . . . . . . . . . . . . .
1.3 2D Robotic Plotter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.4 Aim of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.5 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.6 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.7 Organisation of the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 Project Description
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.4 Industrial Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


2.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 Software
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Inkscape (0.48.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1 Scalar Vector Graphics(SVG) . . . . . . . . . . . . . . . . . . . . . . . .
3.2.2 Inkscape Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.3 Inkscape Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.4 Generating gcode les using inkscape . . . . . . . . . . . . . . . . . . . .

3.3 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.4 Processing 3.0.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.5 with Processing . . . . . . . . . . . . . . . . . . . . . . . . . .

3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 Hardware
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Arduino NANO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Adafruit L298D Motor Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1 Working principle of Servo Motors. . . . . . . . . . . . . . . . . . . . . .
4.4.2 Controlling Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Stepper Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5 Industrial Design
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 X-Y Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Stand holding the whole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 Pen Setup (Z-axis) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 Final Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6 Overall View and Setup of the Project


6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Steps Involved in the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3 Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7 Applications

8 Conclusion and Future Aspects


7
List of Figures

1.1 Intersecting lines form right angles and establish the zero point (Allen-Bradley)
1.2 The three-dimensional coordinate planes (axes) used in CNC. (The Superior
Electric Company) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 The quadrants formed when the X and Y axes cross are used to accurately located 11

3.1 Inkscape Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


3.2 Processing Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.1 Arduino NANO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


4.2 Adafruit L298D Motor Shield . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Controlling of Servo Motor (PWM) . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Stepper Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5.1 Lens Frame in CD Drive (Containing Stepper Motor) . . . . . . . . . . . . . . .


5.2 CD Drive Cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Pensetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 View 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 View 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6.1 Main Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


6.2 Plotted Output Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.31 Pin Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


.32 Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.33 Electrical Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
Chapter 1

Introduction

1.1 Introduction
CNC stands for Computer Numeric Control and typically refers to a machine whose operation
is controlled by a computer. The most common usage of CNC, and the one relevant to us, is
the name given to devices that, under computer control are able to cut, etch, mill, engrave,
build, turn and otherwise perform manufacturing operations on various materials. Typically, a
CNC machine has the ability to move a cutting or 3D printing head in 2 to 6 axes, meaning
that it can position that tool head at a precise point in or on the material to create the cut or
operation desired at that point. By moving the head through multiple points, the cutting head
can cut or sculpt the design represented by a data stream of positioning points being sent by
the PC. By controlling a CNC machine through a PC it is possible for the user to design a
product on-screen, convert it to CNC-readable code and then send that data to the CNC
machine for it to produce a physical copy of the item designed.

1.2 Computer Numerical Control (CNC)


The term numerical control is a widely accepted and commonly used term in the machine
tool industry. Numerical control (NC) enables an operator to communicate with machine
tools through a series of numbers and symbols.

NC which quickly became Computer Numerical Control (CNC) has brought tremendous
changes to the metalworking industry. New machine tools in CNC have enabled industry to
consis-tently produce parts to accuracies undreamed of only a few years ago. The same
part can be reproduced to the same degree of accuracy any number of times if the CNC
program has been properly prepared and the computer properly programmed.

The operating commands which control the machine tool are executed automatically with
9
Figure 1.1: Intersecting lines form right Figure 1.2: The three-dimensional
an-gles and establish the zero point coordi-nate planes (axes) used in CNC.
(Allen-Bradley) (The Su-perior Electric Company)

amazing speed, accuracy, e ciency, and repeatability. The ever-increasing use of CNC in
in-dustry has created a need for personnel who are knowledgeable about and capable of
preparing the programs which guide the machine tools to produce parts to the required
shape and accu-racy.

Cartesian Coordinate System


Almost everything that can be produced on a conventional machine tool can be produced
on a computer numerical control machine tool, with its many advantages. The machine
tool movements used in producing a product are of two basic types: pointto- point
(straight-line movements) and continuous path (contouring movements).

The Cartesian, or rectangular, coordinate system was devised by the French


mathematician and philosopher Rene' Descartes. With this system, any speci c point can
be described in mathematical terms from any other point along three perpendicular axes.
This concept ts machine tools perfectly since their construction is generally based on
three axes of motion (X, Y, Z) plus an axis of rotation. On a plain vertical milling machine,
the X axis is the horizontal movement (right or left) of the table, the Y axis is the table
cross movement (toward or away from the column), and the Z axis is the vertical
movement of the knee or the spindle. CNC systems rely heavily on the use of rectangular
coordinates because the programmer can locate every point on a job precisely.

The three-dimensional coordinate planes are shown in Fig. 1.2. The X and Y planes (axes)
are horizontal and represent horizontal machine table motions. The Z plane or axis represents
10
the vertical tool motion. The plus (+) and minus (-) signs indicate the direction from the zero
point (origin) along the axis of movement. The four quadrants formed when the XY axes cross
are numbered in a counterclockwise direction (Fig. 1.3). All positions located in quadrant 1
would be positive (X+) and positive (Y+). In the second quadrant, all positions would be
negative X (X-) and positive (Y+). In the third quadrant, all locations would be negative X (X-)
and negative (Y-). In the fourth quadrant, all locations would be positive X (X+) and negative Y
(Y-). In Fig. 1.3 , point A would be 2 units to the right of the Y axis and 2 units

Figure 1.3: The quadrants formed when the X and Y axes cross are used to accurately located

above the X axis. Assume that each unit equals 1.000. The location of point A would be X
+ 2.000 and Y + 2.000. For point B, the location would be X + 1.000 and Y - 2.000. In CNC
programming it is not necessary to indicate plus (+) values since these are assumed.
However, the minus (-) values must be indicated. For example, the locations of both A and
B would be indicated as follows:

A X2.000 Y2.000
B X1.000 Y-2.000
11
1.3 2D Robotic Plotter
Robotics is the branch of technology that deals with the design, construction, operation,
and application of robots, as well as computer systems for their control, sensory feedback,
and information processing. The design of a given robotic system will often incorporate
principles of mechanical engineering, electronic engineering and computer science
(particularly arti cial intelligence).The term 'robotics' was coined by Isaac Asimov in his
science ction short story called 'Liar'. Robot is an electro-mechanical machine which is
guided by a electronic circuitry or computer program to perform various tasks. A robotic
arm is a robotic manipulator, usually programmable, with functions similar to that of human
arm. Robotic 2D Plotter is a plotter that o ers the fastest way to e ciently produce very
large drawings. Pen plotters will be able to print by moving a pen or other writing device
across the surface of a piece of paper. This means that plotters are vector graphics
devices, rather than raster graphics. Pen plotters can draw complex line art, including text,
but do so slowly because of the mechanical movement of the writing device such as pen.

1.4 Aim of the Thesis


Aim of the thesis is to set up a 2D Robotic Plotter for the following constraints:

A general idea of CNC Models.

Generating GCODE. Integrating the diffrent softwares along with the hardware setup.
12
1.6 Motivation
Computer Numeric Control (CNC) refers to a wide variety of machines which are controlled
electronically and have many uses, including milling, drawing, extruding, cutting, and lathing.
CNC machines are really expensive. They are widely used in the fabrication of both electronic
and mechanical parts of large machines .So our group has decided to do a model to know
about theoretical and practical knowledge about this concept [2D Robotic Plotter].

1.7 Organisation of the Project


The report is organised as follows:
Abstract
Table of Contents
List of Figures
Chapter 1 : Introduction
Chapter 2 : Project Description
Chapter 3 : Software Description
Chapter 4 : Hardware Description
Chapter 5 : Mechanical Setup
Chapter 6 : Conclusion
References
Appendix

1.8 Conclusion
In this chapter,brief introduction of the project,literature review, motivation and
organization of the project has been prensented.
14
Chapter 2

Project Description

2.1 Introduction
The three main sections of Robotic 2D Plotter:

Hardware

Software

Industrial Design

2.2 Hardware
Electronic hardware consists of interconnected electronic components which perform
analog or logic operations on received and locally stored information to produce as output
or store resulting new information or to provide control for output actuator mechanisms.
Electronic hardware can range from individual chips/circuits to distributed information
processing sys-tems. Well designed electronic hardware is composed of hierarchies of
functional modules which inter-communicate via precisely de ned interfaces The XY-plotter
consists of two axes operating orthogonally to each other. Each axis includes a CD drive
system that is driven by an appropriate means. Additionally, a third axis, with limited
motion capability is used to actuate the write head.

2.3 Software
Computer software, or simply software, is that part of a computer system that consists of encoded
information or computer instructions, in contrast to the physical hardware from which the system is
built.The softwares used in this project comes under open source.Open-source software (OSS) is
computer software with its source code made available with a license in which the copyright holder
provides the rights to study, change, and distribute the software to anyone
15
and for any purpose. Open-source software may be developed in a collaborative public
manner. Open-source software is the most prominent example of open-source development.

2.4 Industrial Design


Industrial design is a process of design applied to products that are to be manufactured
through techniques of mass production. Its key characteristic is that design is separated
from manu-facture: the creative act of determining and de ning a product's form takes
place in advance of the physical act of making a product, which consists purely of
repeated, often automated, replication.The mechanical part is taken fully from CD-drive.

2.5 Conclusion
In this chapter a brief idea of the main three sections,software,hardware and industrial
design are discussed.
16
Chapter 3

Software

3.1 Introduction
Engineering as a discipline often requires more integration than large amounts of original devel-
opment. In a typical project, writing new code presents signifcant challenges, and the number of
features shared between projects means that it is possible to create shared components which
implement common features. A library or an existing module allows the use of a well developed
and tested component, which saves signifcant resources in the implementation of the project. The
drawback of components is the need to integrate various potentially con icting interfaces, and the
need to understand a complex system in order to efectively use the component.

Components can be purchased, or may be freely available, as in the case of Open Source soft-
ware. The programs and tools we chose for this project are all open source, and use international
standards, which allowed to rapidly develop the features needed.

The project software system consists of:

1. Inkscape (Version 0.48.5).

2. Arduino IDE.

3. Processing 3.0.2.

3.2 Inkscape (0.48.5)


There are two basic types of graphic images: bitmap (or raster) images and vector images. In
the first case, the image is defined in terms of rows and columns of individual pixels, each with
its own color. In the second case, the image is defined in terms of lines, both straight and
17
curved. A single straight line is described in terms of its two end points.

The difference in these types of graphic images becomes readily apparent when a
drawing is enlarged. The same line is shown on the left and right. On the left it is displayed
as a bitmap image, while on the right it is displayed as a vector. In both cases, the line has
been scaled up by a factor of four from its nominal size.

When the bitmap resolution of a drawing matches the display resolution, the objects in the
drawing look smooth. The same drawing, but defined as a bitmap image on the left and a
vector image on the right. If the output device has the same resolution as the bitmap
image, there is little difference between the appearance of the two images.

If the bitmap resolution is signifcantly less than the display resolution, the display will show
jagged lines. The head of the gentleman in the above drawings has been scaled up by a
factor of ve. Now one can see a difference in the quality of the bitmap drawing (left) and
the vector drawing (right). Note that the bitmap image uses anti-aliasing, a method of
using grayscale to attempt to smooth the drawing.

All output devices, with few exceptions, use a raster or bitmap image to display graphics.
The real di erence between drawing with bitmap graphics and vector graphics is the point
at which the image is converted into a bitmap. In the case of vector graphics, this
conversion is done at the very last step before display, ensuring that the nal image
matches exactly the resolution of the output device.
18
.

3.2.1 Inkscape Window


Start by opening Inkscape.This window contains several major areas, many containing clickable
icons or pull-down menus. The following gure shows this window and labels key parts.

The Command Bar, Snap Bar, Tool Controls, and Tool Box are detachable by dragging on
the handles (highlighted in blue) at the far left or top. They can be returned to their normal
place by dragging them back. New in v0.48: Some of the bars change position depending
on which option is selected at the bottom of the View menu. When Default is selected, the
Command Bar is on the top while the Snap Bar is on the right. When Custom is selected,
the Command Bar and the Snap Bar are both on the top. When Wide is selected, the
Command Bar and the Snap Bar are both on the right. By default, Default is used if you
are not using a \Wide Screen" display while Wide is used if you are. A width to height
aspect ratio of greater than 1.65 is de ned to be wide. These bars, as well as the Palette
and Status Bar, can be hidden using the View Show/Hide submenu.

As Inkscape has grown more complex, the area required to include icons and entry boxes
for all the various items has also grown leading to problems when Inkscape is used on
small screens. The Command Bar, Snap Bar, Tool Controls, and Tool Box have variable
widths or heights. If there are too many items to be shown in the width (height) of the
Inkscape window, a small down arrow will appear on the right side or bottom of the bars.
Clicking on this arrow will open a drop-down menu with access to the missing items.
20
Figure 3.1: Inkscape Window

3.2.2 Inkscape Program


Inkscape has its roots in the program Gill (GNOME Illustrator application) created by Raph
Levian [http:// www.levien.com/] of Ghostscript fame. This project was expanded on by the
Sodipodi [http://sourceforge.net/projects/ sodipodi] program. A di erent set of goals led to
the split-o of the current Inkscape development e ort.

The goal of the writers of Inkscape is to produce a program that can take full advantage of
the SVG standard. This is not a small task. A link to the road map for future development
can be found on the Inkscape website [http:// www.inkscape.org/].

Instructions on installing Inkscape can be found on the Inkscape website. Full functionality
of Inkscape requires additional helper programs to be installed, especially for importing
and exporting les in di erent graphic formats.

In this project the use of inkscape is to convert any image(formats) into graphics code
usually known as GCODE. .GCODE formats are generated by integrating inkscape with
necessary extension les.

3.2.3 Generating gcode files using inkscape


1. Download and install Inkscape 0.48.5 version.

2. Install an Add-on that enables the export images to gcode files.

3. Open the Inkscape, go to File menu and click "Document Properties".

4. Change the custom size.


21
5. Now close this window.

6. Open the required image.

7. Re-size the image to fit our printing area.

8. Click Path from menu and "Trace Bitmap".Make required changes.

9. Click ok and close the window.

10. Now, move the gray scale image, and delete the color one behind it. Move the grey
image to the correct place again and click from Path menu "Object to path".

11. Final, go to le menu, click save as and select .gcode. Click ok on next window.

GCode Tools: Gcodetools is an open source Inkscape extension, to export gcode for use
with a CNC machine, written in the Python programming language. Inkscape extensions work
in the standard Unix IO model, taking SVG on standard input, and output transformed SVG on
standard output. The Gcodetools extension generates G-Code from the SVG input and writes
it to a le as a side e ect of the SVG transformation. This python extension can be easily
downloaded as a .ZIP le from https://github.com/martymcguire/inkscape-unicorn

.
22
Features

Fast 3-axis cut-workpiece simulation with 3D visualization.

Simulates cylindrical, conical, ballnose, spheroid and snubnose tool

shapes. Tool path 3D visualization.

Multi-threaded rendering can take advantage of multi-processor

CPUs. GCode parsing, simulation, veri cation and annotation.

Supports LinuxCNC (AKA EMC2) O-

codes. Export cut workpiece to STL le.

Tool table editing.

Add height probing to 2D GCode les. Very useful for circuit board cutting and metal
engraving.

2D GCode path optimization.

Operates in Windows and Linux.

Released under the GPL v2+ license.

Limitations

Simulates only snapshots of the cutting

process. No 5-axis simulation.

No Lathe simulation.

No CAM facilities yet, e.g. 3D model to tool path conversion.

No CNC machine control, not a replacement for LinuxCNC or MACH3.

Does not yet detect over/under cutting, collisions with the tool shaft or xtures or rapid
moves in the material.

Not all of the LinuxCNC G-Code language is implemented, yet.


23
3.4 Arduino IDE
The Arduino project provides the Arduino integrated development environment (IDE), which is
a cross-platform application written in the programming language Java. It originated from the
IDE for the languages Processing and Wiring. It is designed to introduce programming to
artists and other newcomers unfamiliar with software development. It includes a code editor
with features such as syntax highlighting, brace matching, and automatic indentation, and
provides simple one-click mechanism to compile and load programs to an Arduino board. A
program written with the IDE for Arduino is called a "sketch".

The Arduino IDE supports the languages C and C++ using special rules to organize code.
The Arduino IDE supplies a software library called Wiring from the Wiring project, which
provides many common input and output procedures. A typical Arduino C/C++ sketch
consist of two functions that are compiled and linked with a program stub main() into an
executable cyclic executive program:[.2cm]

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 o .

After compiling and linking with the GNU toolchain, also included with the IDE distribution,
the Arduino IDE employs the program avrdude to convert the executable code into a text
le in hexadecimal coding that is loaded into the Arduino board by a loader program in the
board's rmware.

3.5 Processing 3.0.2


Processing is a simple programming environment that was created to make it easier to
develop visually oriented applications with an emphasis on animation and providing users
with instant feedback through interaction. The developers wanted a means to \sketch"
ideas in code. As its capabilities have expanded over the past decade, Processing has
come to be used for more advanced production-level work in addition to its sketching role.
Originally built as a domain-speci c extension to Java targeted towards artists and
designers, Processing has evolved into a full-blown design and prototyping tool used for
large-scale installation work, motion graphics, and complex data visualization.

Processing is based on Java, but because program elements in Processing are fairly
simple, you can learn to use it even if you don't know any Java. If you're familiar with Java,
it's best to forget that Processing has anything to do with Java for a while, until you get the
hang of how the API works. The latest version of Processing can be downloaded at
http://processing.org/download.
24
An important goal for the project was to make this type of programming accessible to a wider
audience. For this reason, Processing is free to download, free to use, and open source. But
projects developed using the Processing environment and core libraries can be used for any
purpose. This model is identical to GCC, the GNU Compiler Collection. GCC and its as-
sociated libraries (e.g. libc) are open source under the GNU Public License (GPL), which
stipulates that changes to the code must be made available. However, programs created with
GCC (examples too numerous to mention) are not themselves required to be open source.

Processing consists of:

The Processing Development Environment (PDE). This is the software that runs
when you double-click the Processing icon. The PDE is an Integrated Development
Envi-ronment (IDE) with a minimalist set of features designed as a simple
introduction to programming or for testing one-o ideas.

A collection of functions (also referred to as commands or methods) that make up


the \core" programming interface, or API, as well as several libraries that support
more ad-vanced features such as sending data over a network, reading live images
from a webcam, and saving complex imagery in PDF format.

A language syntax, identical to Java but with a few modi cations.

An active online community, based at http://processing.org.

3.5.1 Sketching with Processing


A Processing program is called a sketch. The idea is to make Java-style programming feel
more like scripting, and adopt the process of scripting to quickly write code. Sketches are
stored in the sketchbook, a folder that's used as the default location for saving all of your
projects. Sketches that are stored in the sketchbook can be accessed from File Sketchbook.
Alternatively, File Open... can be used to open a sketch from elsewhere on the system.

Advanced programmers need not use the PDE, and may instead choose to use its libraries
with the Java environment of choice. However, for a beginner, it's recommended to use the
PDE to gain familiarity with the way things are done. While Processing is based on Java, it
was never meant to be a Java IDE with training wheels. The conceptual model (how programs
work, how interfaces are built, and how les are handled) is somewhat di erent from Java.
25
Figure 3.2: Processing Window

3.6 Conclusion
In this chapter a brief introduction about the type of software used,theoretical and some
prac-tical idea about Inkscape, CAMotics, Arduino IDE and Processing are discussed.
26
Chapter 4

Hardware

4.1 Introduction
In this hardware system consists of a metallic frame, on which is mounted three axis of
motion in a standard Cartesian coordinate system. X and Y axis is driven by a stepper
motor driven by a adafruit L293D motor driver circuit. Z axis is driven by a servo motor.

The di erent included parts in the project are:

Arduino NANO.

ADAFRUIT:MOtor Driver Shield L298D.

Stepper Motors.

Servo Motor.

Difference between a microprocessor and a microcontroller


A microprocessor:
An IC with only the Central Processing Unit (CPU)
No RAM, ROM, or peripheral I/O on the chip.
(System designers must add these externally to make these
Function in Desktop PCs, Laptops, notepads, tablets, etc.
(Manufacturers include:
Intel's Pentium, core 2 duo, i3, i5, ARM, PowerPC, AMD, etc. )
A microcontroller:
An IC with CPU, I/O pins, a fixed amount of RAM,
ROM all embedded on a single, 'all in one' chip.
(Manufacturers include:
Microchip, ATMEL, TI, Freescale, Philips, Motorola)
The Arduino is a development platform using
microcontrollers from Atmel's ATmega series

Some key reasons given for its success:

Open Source hardware and software


Cross platform (Mac, Windows and Linux)
Support from huge non-condescending community

What is Open Source Hardware?


License
Schematics
PCB layout data
Bills of Sale (component distributors...)
Arduino is open source hardware: the Arduino hardware reference designs
are distributed under a Creative Commons Attribution Share-Alike 2.5 license,
available on the Arduino Web site.
Layout and production files for some versions are also available.
The source code for the IDE is available and released under the
GNU General Public License, version 2

Requirements for the microcontroller to make arduino :

1. Power
- It's an electrical component, so of course you have to
give it power. But like many ICs, the voltage used to
operate it needs to be controlled relatively precisely.
2. I/O
- Input and output, some way to communicate with the
chip. This is generally done through some kind of
connection to the chip's pins. Breadboards are handy.
3. Programming Interface
- Some way to write programs and download them to
the chip and run them.

1. Power:
There are three commonly used ways for controlling
the voltage supplied to microcontrollers:
I. A voltage regulator
II. A regulated power supply
III. Battery power

2. I/O:
I. Limited
II. shields
III. Roll your own.

2. Programming Interface (computer connection):

We will be using the same microcontroller used on the Arduino board, a


popular chip made by the Atmel corporation -the Atmega 168 or 328.
(These are 28 pin ICs with identical pin designations, but the 328 has more
memory.) The hardware interface we'll be using is perhaps the simplest (and
cheapest): connecting to it on a standard breadboard.

4.2 Arduino NANO

Types Of Arduino :
Arduino In Our Device Is 'Nano Arduino'

(Arduino Nano Front) (Arduino Nano Back)

fig () show Nano arduino


Overview:
The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328
(Arduino Nano 3.x) or ATmega168
(Arduino Nano 2.x). It has more or less the same functionality of the Arduino Duemilanove, but in a
different package. It lacks only a DC
power jack, and works with a Mini-B USB cable instead of a standard one. The Nano was designed
and is being produced by Gravitech.

Specifications:
-Microcontroller Atmel ATmega168 or ATmega328
-Operating Voltage (logic level) 5 V
-Input Voltage (recommended) 7-12 V
-Input Voltage (limits) 6-20 V
-Digital I/O Pins 14 (of which 6 provide PWM output)
-Analog Input Pins 8
-DC Current per I/O Pin 40 mA
-Flash Memory 16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader
-SRAM 1 KB (ATmega168) or 2 KB (ATmega328)
-EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)
-Clock Speed 16 MHz
-Dimensions 0.73" x 1.70"
-Length 45 mm
-Width 18 mm
-Weigth 5 g

Power:
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power
supply (pin 30), or 5V regulated
external power supply (pin 27). The power source is automatically selected to the highest voltage
source

Memory
The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the
bootloader); the ATmega328 has 32 KB, (also
with 2 KB used for the bootloader). The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM
- SRAM : memory for storing your data which are processed during the run time (including also the registers,
stack, etc.) - volatile memory
- FLASH : memory which your program stored - non volatile
- EEPROM : memory which can be used for storing non volatile data and changeable during run-time. (for
example: setting values, etc.)

Input and Output


Each of the 14 digital pins on the Nano can be used as an input or output,
using pinMode() to see example please visit ( www.arduino.cc/en/Reference/PinMode ),
digitalWrite() , to see example please visit (//www.arduino.cc/en/Reference/DigitalWrite)
digitalRead() , to see example please visit (//www.arduino.cc/en/Reference/DigitalRead)
functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an
internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have
specialized functions :

-Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are
connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.

-External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the attachInterrupt()
(//www.arduino.cc/en/Reference/AttachInterrupt) function for details.

- PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.

-SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which,
although provided by the underlyinghardware, is not currently included in the Arduino language.

-LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is
on, when the pin is LOW, it's off.

The Nano has 8 analog inputs, each of which provide 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the
analogReference() .

-I2C: A4 (SDA) and A5 (SCL). Support I2C (TWI) communication using the Wire library
(http://wiring.org.co/reference/libraries/Wire/index.html) (documentation on the Wiring website).

Programming
The Arduino Nano can be programmed with the Arduino software (download
(//www.arduino.cc/en/Main/Software)). Select "ArduinoDiecimila, Duemilanove, or Nano w/
ATmega168" or "Arduino Duemilanove or Nano w/ ATmega328" from the
4.3 Adafruit L298D Motor Shield

.
29
Figure 4.2: Adafruit L298D Motor Shield

4.4 Servo Motor


A servo motor is an electrical device which can push or rotate an object with great
precision. To rotate and object at some speci c angles or distance, servo motor is used. It
is just made up of simple motor which run through servo mechanism. If motor is used is
DC powered then it is called DC servo motor, and if it is AC powered motor then it is called
AC servo motor. We can get a very high torque servo motor in a small and light weight
packages. Doe to these features they are being used in many applications like toy car, RC
helicopters and planes, Robotics, CNC Machine etc. The position of a servo motor is
decided by electrical pulse and its circuitry is placed beside the motor.

4.4.1 Working principle of Servo Motors.


A servo consists of a Motor (DC or AC), a potentiometer, gear assembly and a controlling
circuit. First of all we use gear assembly to reduce RPM and to increase torque of motor. Say
at initial position of servo motor shaft, the position of the potentiometer knob is such that there
is no electrical signal generated at the output port of the potentiometer. Now an electrical
signal is given to another input terminal of the error detector ampli er. Now di erence between
these two signals, one comes from potentiometer and another comes from other source, will
be processed in feedback mechanism and output will be provided in term of error signal. This
error signal acts as the input for motor and motor starts rotating. Now motor shaft is connected
with potentiometer and as motor rotates so the potentiometer and it will generate a signal. So
as the potentiometer's angular position changes, its output feedback signal changes. After
sometime the position of potentiometer reaches at a position that the output of potentiometer
30
Figure 4.3: Servo Motor

is same as external signal provided. At this condition, there will be no output signal from
the ampli er to the motor input as there is no di erence between external applied signal
and the signal generated at potentiometer, and in this situation motor stops rotating.

4.4.2 Controlling Servo Motor


Servo motor is controlled by PWM (Pulse with Modulation) which is provided by the control
wires. There is a minimum pulse, a maximum pulse and a repetition rate. Servo motor can
turn 90 degree from either direction form its neutral position. The servo motor expects to
see a pulse every 20 milliseconds (ms) and the length of the pulse will determine how far
the motor turns. For example, a 1.5ms pulse will make the motor turn to the 90 position,
such as if pulse is shorter than 1.5ms shaft moves to 0 and if it is longer than 1.5ms than it
will turn the servo to 180.

Servo motor works on PWM (Pulse width modulation) principle, means its angle of rotation is
controlled by the duration of applied pulse to its Control PIN. Basically servo motor is made up
of DC motor which is controlled by a variable resistor (potentiometer) and some gears. High
speed force of DC motor is converted into torque by Gears. We know that WORK= FORCE X
DISTANCE, in DC motor Force is less and distance (speed) is high and in Servo, force is High
and distance is less. Potentiometer is connected to the output shaft of the Servo, to calculate
the angle and stop the DC motor on required angle. Servo motor can be rotated from 0 to 180
degree, but it can go up to 210 degree, depending on the manufacturing. This degree of
rotation can be controlled by applying the Electrical Pulse of proper width, to its Control pin.
31
Servo checks the pulse in every 20 milliseconds. Pulse of 1 ms (1 millisecond) width can
rotate servo to 0 degree, 1.5ms can rotate to 90 degree (neutral position) and 2 ms pulse
can rotate it to 180 degree.

Figure 4.4: Controlling of Servo Motor (PWM)

4.5 Stepper Motor


A stepper motor is a type of DC motor which has a full rotation divided in an equal number of
steps. It is a type of actuator highly compatible with numerical control means, as it is essentially an
electromechanical converter of digital impulses into proportional movement of its shaft, providing
precise speed, position and direction control in an open-loop fashion, without requiring encoders,
end-of-line switches or other types of sensors as conventional electric motors require. he steps of
a stepper motor represent discrete angular movements, that take place in a successive fashion
and are equal in displacement, when functioning correctly the number of steps performed must be
equal to the control impulses applied to the phases of the motor. The nal position of the rotor is
given by the total angular displacement resulting from the number of steps performed. This
position is kept until a new impulse, or sequence of impulses, is applied.
32
These properties make the stepper motor an excellent execution element of open-loop
control systems. A stepper motor does not lose steps, i.e. no slippage occurs, it remains
synchronous to control impulses even from standstill or when braked, thanks to this
characteristic a stepper motor can be started, stopped or reversed in a sudden fashion
without losing steps throughout its operation.

Figure 4.5: Stepper Motor

4.6 Conclusion
In this chapter all the details about the hardwares used such as Arduino UNO
board,Adafruit L293D Motor Shield,Stepper Motors and Servo Motors are discussed.
33
Chapter 5

Industrial Design

5.1 Introduction
The complete mechanical system was designed in the metallic CD drive
cover. The designs in the project are :

X-Y Direction.
Pen setup.

Stand holding the


Whole. Final Setup

Y-axis: basic axis carries X-axis move from front to back.


X-axis: carries Z-axis move from left to right.
Z-axis: carries pen part move up and down.

5.2 X-Y Direction


In computing, an optical disc drive (ODD) is a disk drive that uses laser light or
electromagnetic waves within or near the visible light spectrum as part of the process of
reading or writing data to or from optical discs. Some drives can only read from certain discs,
but recent drives can both read and record, also called burners or writers. Compact discs,
DVDs, and Blu-ray discs are common types of optical media which can be read and recorded
by such drives. Optical disc drives that are no longer in production include CD-ROM drive, CD
writer drive, and combo (CD-RW/DVD-ROM) drive. As of 2015, DVD writer drive is the most
common for desktop PCs and laptops. There are also the DVD-ROM drive, BD-ROM drive,
Blu-ray Disc combo (BD-ROM/DVDRW/CD-RW) drive, and Blu-ray Disc writer drive.

The stepper motor setup of CD drives are used in X-Y direction co-ordinate axis.
34
Figure 5.1: Lens Frame in CD Drive (Containing Stepper Motor)

5.3 Stand holding the whole


The stand holding all the parts are made by the outer metallic cover of the cd drive. Two
covers are welded together perpendicularly for holding the x and y axis.

Figure 5.2: CD Drive Cover

5.4 Pen Setup (Z-axis)


For pen setup (z axis) high-density berboard (HDF) is used. It is a type of berboard, which
is an petroleum by product. It is of light weight.Servomotor is adjusted inside the HDF to
get the up and movement required to plot the object.

5.5 Final Setup


All the sections are integrated together to get a good output.
35
Figure 5.3: Pensetup

Figure 5.4: View 1 Figure 5.5: View 2

5.6 Conclusion
In this chapter the design setup used in this project is discussed to give an idea on the
me-chanical section.
36
Chapter 6

Overall View and Setup of the Project

6.1 Introduction
The following steps shows the building stages of a low cost mini cnc plotter. For X and Y
axis, the stepper motors from CD drive is used. Servo motor is used for z
axis.Inkscape,Processing and Arduino IDE gives the command from the computer as
gcode to the arduino board to get the plotted output

Main Block Diagram

Figure 6.1: Main Block Diagram


37
6.2 Steps Involved in the Project
Step 1-Industrial Design

1. First step to start building this cnc machine is to disassemble two dvd/cd drives and
take o them the stepper motors. Use the screwdriver to open them and take o them
the rails.

2. The outer metallic cover of cd drive is welded perpendicularly to make the stand
holding the x and y axis.

3. Attach the cd drive stepper motor setup as x and y axis. And make sure that the Y
axis is straight to CNC base and the X axis vertically to it.

4. Z axis (pen setup) is attached to the x axis. The pen setup is made up of HDF, the servo
motor is attached to it and the pen is setup inside the ber using screw and spring.

5. A metallic base is attached to the Y axis for using as paper base. Then a paper is put
above it with the help some magnets.The printing area is 4x4cm.
Step 2-Arduino and Stepper Motor Setup

1. The adafruit L298D motor driver sheild compactible with the Arduino board is
mounted on it.
2. The Arduino is connected the computer port.
3. Check the stepper motors and the servo motor.
4. The stepper motors and the servo motor are connected to the motor shield.
5. The external power is connected. (Trainer Kit 12v,3A)

Step 3-Burning of Program and Gcode take in

1. The mini cnc plotting sketch is burned to the Arduino microprocessor (ATmega 328)
by using Arduino IDE.
2. Gcode is made by Inkscape program.

3. Then use the gctrl.pde processing program. This program sends 'gcode' images to
the cnc plotter.
4. Plotting of the image is done.
38
6.3 Result
Integrating the software along with the hardware and mechanical systems makes up an e
ective 2D plotter.

Figure 6.2: Plotted Output Image

6.4 Conclusion
In this chapter the steps involved in setting-up the plotter and nal result are discussed.
39
Chapter 7

Applications

The main applications of CNC machines comes in industrial eld.Some of them are discussed
below:

Metal Removal Applications { CNC machines are extensively used in industries where
metal removal is required. The machines remove excess metal from raw materials to
create complex parts. A good example of this would be the automotive industries
where gears, shafts and other complex parts are carved from the raw material. CNC
machines are also used in the manufacturing industries for producing rectangular,
square, rounded and even threaded jobs. All processes, such as milling, grinding,
turning, boring, reaming, etc, can be controlled and carried out by these CNC
machines using speci c machine tools for each task.

Metal Fabrication Industry { Many industries require thin plates for di erent pur-poses.
These industries use CNC machines for a number of machining operations such as
plasma or ame cutting, laser cutting, shearing, forming and welding to create these
plates. CNC plasma or laser cutters are used for shaping metal, while CNC turret
presses are used for operations like punching holes. Other operations like bending
metal plates can also be carried out with very high precision using CNC press brakes.

Electrical Discharge Machining Applications { Electrical Discharge Machines, or EDMs as


they are also known, remove metal from the raw material by producing sparks that burn
away the excess metal. EDM machining through CNC automation is carried out in two di
erent ways; rst through Wire EDM and second through Vertical EDM. CNC automated
Wire EDM is used to punch and then die combinations for creating die sets used in the
fabrication industry. CNC automated Vertical EDM requires an electrode in the same size
and shape as the cavity that needs to be carved out.
40
43

Você também pode gostar