Arduino Finel2

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 71

CNC Sketch/Drawing Machine

By
Muhammad Irfan

2015-GCUF-S011755
Sumair Ikram

2015-GCUF-020401

Project submitted in partial fulfillment of


the requirements for the degree of

BACHELOR OF SCIENCE
IN
COMPUTER SCIENCE

DEPARTMENT OF COMPUTER SCIENCE

GOVERNMENT COLLEGE UNIVERSITY FAISALABAD

June, 2019
DECLARATION
This project work, is carried out by Muhammad Irfan and Sumair Ikram under
the supervision of Sir Nafees Ayub (Computer Science Department) and Sir
Rao Sohail (Lecturer, Computer Science Department) Govt. College University,
Faisalabad, Pakistan. We feel please to declare that the “CNC Drawing
Machine” and contents of this project is the productive result of our
hardworking, studies and research and no part of this is copied from any
published source. This work has been conducted under the practical
atmosphere of our studies not for the award of any other degree / diploma. The
University may take action if the information provided is found guilty at any
stage.

Signatures of Students

Muhammad Irfan…………………

2015-GCUF-S011755

Sumair Ikram…………………..…

2015-GCUF-020401
ACKNOWLEDGEMENTS
Bowing our head to almighty ALLAH, who is the most merciful and giving all
honor to the HOLY Prophet (PBUH) as the model and beacon light for all the
mankind. Prior to anyone Else, all gratitude and praises are due to the almighty
Allah, who gave us health and capacitance to achieve this goal.

We would like to express our deepest appreciation to our Supervisor, Mr.


Nafees Ayub, Lecturer, Department of Computer Science, GCUF , who
always guided us and gave us moral support in every step of our degree
program as well as our project.

We would also like to thank Sir Rao Sohail (Lecturer, Department of


Computer Science, Govt. College University Faisalabad),for his constant
scholarly guidance, skillful advice and untiring zeal, which were of immense
value for the conduction of this research work. His careful attitude and warm
encouragement always inspired us to work hard to achieve goal of obtaining
degree.

We would not be doing justice without acknowledging the invaluable moral


support and constant encouragement provided to us by our affectionate
parents.

Finally, we hope that inadvertent errors will be forgiven by readers.

Muhammad Irfan
Roll No: 2175
Sumair Ikram
Roll No: 20401
Dedication
At this Moment of joy, we dedicate our hardworking to our beloved Parents, other family
members and friends who encourage us and give us timely support in different ways. We
further dedicate it to our honorable teachers, who played an important role in entire period
of learning in the College, especially to Sir Nafees Ayub and Mr. Rao Sohail, who
encourage us with their broadness in the field and gave us innovative ideas for successful
completion of our project.

Muhammad Irfan

2015-GCUF-S011755

Sumair Ikram

2015-GCUF-020401
CERTIFICATE BY THE PROJECT SUPERVISOR

We certify that the contents and form of thesis submitted by Mr. Irfan Khalid, Registration
No. 2015-GCUF-14528 and Miss Sana Shoukat, Registration No. 2015-GCUF-14537
has been found satisfactory and in accordance with the prescribed format. We
recommend it to be processed for the evaluation by the External Examiner for the award
of degree.

Internal Examiner

Name: _____________

Signature: _____________

External Examiner

Name: _____________

Signature: _____________

Chairperson
Department of Computer Science G.C University Faisalabad

Signature with Stamp……………………………


CHAPTER # 1
REQUIREMENT GATHERING
1 Introduction
The world has become a high technology with a lot of things becoming smaller and
thinner. The fast-growing development of technology and manufacturing, Industrial
requirement such as good and high precision quality has helped in developing the CNC
machine plotter all of those can be achieved through machines that can be controlled by
computers such as Computer Numerical Control (CNC) machine.To implement CNC plotter
machine, several concepts must be understood such as understanding fundamentals,
Machine Mechanical design, CNC machine hardware, software developing, test each one of
three axis stepper motors and connecting CNC Machine with the software tools and test it,
Figure 1 bellow shows the steps that has been used to implement this project. Three axes of
CNC plotter machine can do movement starting with three primary axes which are X, Y and Z
axis. The Z axis is being paralleled with the X-axis (Micheal W. Mattson, 2010). Figure 1
shows the steps to implement this paper must be understood fundamental of the plotter
machine, Machine design by solidwork software, implementation Machine hardware and
wiring connection, Development software, test each one of three axes stepper motors, finally
connect machine with Easel software tools and test Machine.

1.1 Background
The pen of the machine can be replaced by a laser to make it work like a laser engraving
or cutting machine. Engraving machine can be used on wood. The pen can also be replaced
with a powerful drill so that it can be used for both milling and drilling purposes. The servo can
be replaced with a stepper motor and the pen with a 3-D pen to make it a 3-D printer which
can print objects with dimensions. By extrapolation of the axes, the working area of the
machine can be extended keeping the algorithm unaltered.
1.2 The purpose of the Project
A CNC plotter is able to draw complex line drawings. The coordinates are uploaded to the
machine controller by a separate program. The image file is transformed into a G-code via
Software.Then the code is transferred to the micro controller by which the motor mechanism
is instructed to draw the image. In this project, we are going to present a simple design for a
CNC plotter. Our idea is an Arduino based design using ATMEGA 328P micro controller.The
machine will have three motors to implement the X, Y, and Z axis. A servo motor will be used
along the Z axis for positioning the pen which will go up for logic 0 and down for logic .
Drawing will be done on the X-Y plane where the positioning will be controlled by stepper
motors.System overview is provided in Block diagram of CNC Plotter.

1.3 The Scope of the product


Organization Management System takes great response because of its independency. It
is dynamic in nature and responds in run time format via web rather than desktop system.
This implies that people can register online via registration from. Admin of Organization
read their request and then they are further called in organization for their expertise. Its
homepage contains employee registration, employee login, Admin login, information about
the organization and much more. Employee registration requires necessary information like
name, email, phone number , address.The admin will respond the employee by assigning
login.Employee can check daily attendance, payment details, overtime details and admin will
manage them all.

1.4 Reason to Develop this Product


This is an Arduino CNC Machine . It can draw anything. We designed to this machine to
save a lot of time to drawing anything.This can easy to buy anyone. It is easy to use and
understand to each other. Drawing perfect sketch by hand can now be done by machines
too..This is an amazing machine I will show you how to easily build your own low cost
Arduino Mini Sketching Machine .It can draw any image uploaded from PC.It is very
amazing to see how this tiny machine draw images so nicely with a good accuracy.It is
mostly used in Industrial area,Offices,Assingment task…
1.5 Objective
Here we are using the acrylic sheet to make the frame for the CNC plotter.Connect the
Arduino board with PC through USB cable.Select correct port and board.Then upload the
CNC code.This program sends the 'gcode' images to the CNC plotter. we'll attach the sliding
rods to its frame attach sliding rods with X-axis frame.Use your screwdriver to mount the
stepper motor to X and Y Axis.we'll attach the Y-Axis on the top of X-Axis.Attach the Z-Axis to
Y-axis using superglue.

1.6 Mission
It is easy to use and understand to each other. Drawing perfect sketch by hand can now
be done by machines too..This is an amazing machine I will show you how to easily build
your own low cost Arduino Mini Sketching Machine .It can draw any image uploaded from
PC.It is very amazing to see how this tiny machine draw images so nicely with a good
accuracy.

CNC plotter
Machine

Mechanical Electronics system Computer


system and and

Figure 1.1. subsystem of CNC plotter Machine.

1.7 The Stakeholders

1.7.1 The Client


Every Body who have PC are a client of this project. They are satisfied with
our performance of our team.
1.7.2 The Customer
Student, lecturers and every CNC user are our customers. They are
ultimately responsible to buy this product. When any person forgets check any
notification on personal websites and messages and fo rget
.
1.7.3 Other Stakeholder
The role and name of people and organizations who are affected by the
product, or whose input is needed to build the product are given below. These
stakeholders will work for our organization.
The Name of Organization is “UF Machi ne devolpers ”
All stakeholders work as Requirement Engineering. Their name is given below:
 Muhammad Umer
 Faisal Muneer
Muhammad Umer is leading this Project and he is C.E.O of the Company UF
Machine Developer and Faisal Muneer is the marketing head is capture market as a whole All
the team gather requirements from customer and developed this application according to his
desire
1.8 Introduction about Arduino Uno
Arduino Uno is a microcontroller board developed by Arduino.cc which is an open-source electronics
platform mainly based on AVR microcontroller Atmega328.
First Arduino project was started in Interaction Design Institute Ivrea in 2003 by David Cuartielles and
Massimo Banzi with the intention of providing a cheap and flexible way to students and professional
for controlling a number of devices in the real world.
The current version of Arduino Uno comes with USB interface, 6 analog input pins, 14 I/O digital
ports that are used to connect with external electronic circuits. Out of 14 I/O ports, 6 pins can be used
for PWM output.
It allows the designers to control and sense the external electronic devices in the real world.
Figure 1.2 Arduino UNO

This board comes with all the features required to run the controller and can be directly connected to
the computer through USB cable that is used to transfer the code to the controller using IDE
(Integrated Development Environment) software, mainly developed to program Arduino. IDE is
equally compatible with Windows, MAC or Linux Systems, however, Windows is preferable to use.
Programming languages like C and C++ are used in IDE.
Apart from USB, battery or AC to DC adopter can also be used to power the board.
Arduino Uno boards are quite similar to other boards in Arduino family in terms of use and
functionality, however, Uno boards don’t come with FTDI USB to Serial driver chip.
There are many versions of Uno boards available, however, Arduino Nano V3 and Arduino Uno are
the most official versions that come with Atmega328 8-bit AVR Atmel microcontroller where RAM
memory is 32KB.
When nature and functionality of the task go complex, Mirco SD card can be added in the boards to
make them store more information.
1.8.1 Features of Ardiuno UNO
 Arduino Uno comes with USB interface i.e. USB port is added on the board to develop serial
communication with the computer.
 Atmega328 microcontroller is placed on the board that comes with a number of features like
timers, counters, interrupts, PWM, CPU, I/O pins and based on a 16MHz clock that helps in
producing more frequency and number of instructions per cycle.

Figure 1.3 Atmega328 Micrcontroller

 It is an open source platform where anyone can modify and optimize the board based on the
number of instructions and task they want to achieve.
 This board comes with a built-in regulation feature which keeps the voltage under control
when the device is connected to the external device.
 Reset pin is added in the board that reset the whole board and takes the running program in the
initial stage. This pin is useful when board hangs up in the middle of the running program; pushing
this pin will clear everything up in the program and starts the program right from the beginning.
 There are 14 I/O digital and 6 analog pins incorporated in the board that allows the external
connection with any circuit with the board. These pins provide the flexibility and ease of use to the
external devices that can be connected through these pins. There is no hard and fast interface
required to connect the devices to the board. Simply plug the external device into the pins of the
board that are laid out on the board in the form of the header.
 The 6 analog pins are marked as A0 to A5 and come with a resolution of 10bits. These pins
measure from 0 to 5V, however, they can be configured to the high range using analogReference()
function and AREF pin.
 13KB of flash memory is used to store the number of instructions in the form of code.
 Only 5 V is required to turn the board on, which can be achieved directly using USB port or
external adopter, however, it can support external power source up to 12 V which can be regulated
and limit to 5 V or 3.3 V based on the requirement of the project.
1.8.2 Ardiuno UNO Pinout
Arduino Uno is based on AVR microcontroller called Atmega328. This controller comes with 2KB
SRAM, 32KB of flash memory, 1KB of EEPROM. Arduino Board comes with 14 digital pins and 6
analog pins. ON-chip ADC is used to sample these pins. A 16 MHz frequency crystal oscillator is
equipped on the board. Following figure shows the pinout of the Arduino Uno Board.

1.8.3 PIN Discription

There are several I/O digital and analog pins placed on the board which operates at 5V. These pins come
with standard operating ratings ranging between 20mA to 40mA. Internal pull-up resistors are used in
the board that limits the current exceeding from the given operating conditions. However, too much
increase in current makes these resisters useless and damages the device.

LED. Arduino Uno comes with built-in LED which is connected through pin 13. Providing HIGH value
to the pin will turn it ON and LOW will turn it OFF.

Vin. It is the input voltage provided to the Arduino Board. It is different than 5 V supplied through a
USB port. This pin is used to supply voltage. If a voltage is provided through power jack, it can be
accessed through this pin.

5V. This board comes with the ability to provide voltage regulation. 5V pin is used to provide
output regulated voltage. The board is powered up using three ways i.e. USB, Vin pin of the board or
DC power jack.

USB supports voltage around 5V while Vin and Power Jack support a voltage ranges between 7V to
20V. It is recommended to operate the board on 5V. It is important to note that, if a voltage is supplied
through 5V or 3.3V pins, they result in bypassing the voltage regulation that can damage the board if
voltage surpasses from its limit.

GND. These are ground pins. More than one ground pins are provided on the board which can be used
as per requirement.

Reset. This pin is incorporated on the board which resets the program running on the board. Instead of
physical reset on the board, IDE comes with a feature of resetting the board through programming.

IOREF. This pin is very useful for providing voltage reference to the board. A shield is used to read the
voltage across this pin which then select the proper power source.

PWM. PWM is provided by 3,5,6,9,10, 11pins. These pins are configured to provided 8-bit output
PWM.

SPI. It is known as Serial Peripheral Interface. Four pins 10(SS), 11(MOSI), 12(MISO), 13(SCK)
provide SPI communication with the help of SPI library.
AREF. It is called Analog Reference. This pin is used for providing a reference voltage to the analog
inputs.

TWI. It is called Two-wire Interface. TWI communication is accessed through Wire Library. A4 and
A5 pins are used for this purpose.

Serial Communication. Serial communication is carried out through two pins called Pin 0 (Rx) and Pin
1 (Tx).

Rx pin is used to receive data while Tx pin is used to transmit data.

External Interrupts. Pin 2 and 3 are used for providing external interrupts. An interrupt is called by
providing LOW or changing value.

Communication and Programming

Figure 1.4 Communication Programming

Arduino Uno comes with an ability of interfacing with other other Arduino boards, microcontrollers and
computer. The Atmega328 placed on the board provides serial communication using pins like Rx and
Tx.The Atmega16U2 incorporated on the board provides a pathway for serial communication using
USB com drivers. Serial monitor is provided on the IDE software which is used to send or receive text
data from the board. If LEDs placed on the Rx and Tx pins will flash, they indicate the transmission of
data.Arduino Uno is programmed using Arduino Software which is a cross-platform application called
IDE written in Java. The AVR microcontroller Atmega328 laid out on the base comes with builtin
bootloader that sets you free from using a separate burner to upload the program on the board.

1.8.4 Applications

Arduino Uno comes with a wide range of applications. A larger number of people are using Arduino
boards for developing sensors and instruments that are used in scientific research. Following are some
main applications of the board.

1.8.6 Arduino IDE


To edit, compile and upload software projects (sketches) from your computer, you need at least the
Arduino IDE. Two other peace’s of software are also recommended, i.e. Processing for the connection
between your Arduino projects and your computer and Fritzing to create drawings. This chapter
describes the Arduino IDE, Processing and Fritzing are described in the following chapters. 11.1.
Arduino IDE software With this Arduino Integrated Development Environment you can edit, compile
and upload Arduino sketches to the Arduino boards. In this document I refer to version 1.6.5,
available for Windows, OS X and Linux (and an older version for Raspberry Pi).

"The open-source Arduino Software (IDE) makes it easy to write code and upload it to the
board"(https://www.arduino.cc). It is simplified C/C++ functions language- based
programming can be download functionality with a rich set of library functions. After
download and install on pc can be write the program by C language and from tools and port
must be choose the port connection between computer and Arduino through USB. After this
step can be verify the program by error checking and the message is done compiling when it
finished and no error. After this step can be upload the program on the Arduino. Figure 9
shows Arduino software IDE.

Figure 1.5 Arduino Software (IDE).


Easel software

To make the CNC plotter machine plote and write needing a software tools to
design the graphs and then convert this graph to G-code because CNC
machine operate and understanding G language, this tools can be achieved by
easel software tools, this software must be setting material dimensions X is
235 mm, Y is 215 mm, Z is 1 mm and set Bit to 0.15 mm because Z axis is pen.
Through this software can be set positions of X, Y and Z axes, also can be
control on the speed of CNC machine mm/min from feed rate. Figure 10.
showing the tools of easel software.

Figure 1.6. Drawing pic

1.9 What is a servo motor?


A Servo motor (or servo) is a rotary actuator that allows for precise control of
angular position, velocity and acceleration. Servos are found in many places: from
toys to home electronics to cars and airplanes. If you have a radio-controlled model
car, airplane, or helicopter, you are using at least a few servos. Servos also appear
behind the scenes in devices we use every day. Electronic devices such as DVD and
Blu-ray DiscTM players use servos to extend or retract the disc trays.

EZ-Robots use servos which manage the movement of joints, pan & tilt, and
continuous rotational movement. The EZ-B v4, sends an electrical signal that tells the
servo what position to reach and how quickly to get there. Servos come in a variety of
shapes and sizes for different applications. You may want a large, powerful one for
moving the arm of a big robot, or a tiny one to make a robot's eyebrows go up and
down. By linking many of these servos together, you can very easily create robots that
perform complex real world operations. Our Revolution robots utilizes the two most
common sizes as shown below.
Servo vs PWM

PWM stands for Pulse Width Modulation. PWM is the process of turning ON and
OFF digital voltage quickly to simulate a range of voltage. For example... If the
digital output pin of a micro is 3.3v, and the PWM is set for a 50% duty cycle, the
output voltage would be approx 1.65v. This is because the microcontroller is turning
ON and OFF the digital 3.3v pin real quick, which is producing a simulated lower
voltage. You can use PWM to vary the brightness of an LED, for example.

A servo uses PWM as well. The "frame" of a servo PWM signal is 20ms. Many
controllers, such as Arduino libraries do not maintain the 20ms specification defined
for servos. Because of this, challenges have been introduced to servo manufacturers
when decoding incoming PWM signals. This has caused the need for servos to be
"Smarter" by adapting to the unusual PWM transmitted by poorly written libraries
which do not adhere to the servo PWM Standard. The EZ-B does adhere to servo
PWM standards.

1.9.1 How does a servo motor work?

The simplicity of a servo is among the features that make them so reliable. The heart
of a servo is a small direct current (DC) motor, similar to what you might find in an
inexpensive toy. These motors run on electricity from a battery and spin at
high RPM (rotations per minute) but put out very low torque (a twisting force used
to do work— you apply torque when you open a jar). An arrangement of gears takes
the high speed of the motor and slows it down while at the same time increasing the
torque. (Basic law of physics: work = force x distance.) A tiny electric motor does not
have much torque, but it can spin really fast (small force, big distance). The gear
design inside the servo case converts the output to a much slower rotation speed but
with more torque (big force, little distance). The amount of actual work is the same,
just more useful. Gears in an inexpensive servo motor are generally made of plastic to
keep it lighter and less costly. On a servo designed to provide more torque for heavier
work, the gears are made of metal (such as with EZ-Robot Servos) and are harder to
damage.

With a small DC motor, you apply power from a battery, and the motor spins. Unlike
a simple DC motor, however, a servo's spinning motor shaft is slowed way down with
gears. A positional sensor on the final gear is connected to a small circuit board. The
sensor tells this circuit board how far the servo output shaft has rotated. The electronic
input signal from the computer or the radio in a remote-controlled vehicle also feeds
into that circuit board. The electronics on the circuit board decode the signals to
determine how far the user wants the servo to rotate. It then compares the desired
position to the actual position and decides which direction to rotate the shaft so it gets
to the desired position.

1.9.2 Types of servo motors

Servos come in many sizes and in three basic types: positional rotation, continuous
rotation, and linear.
 Positional rotation servo: This is the most common type of servo motor. The
output shaft rotates in about half of a circle, or 180 degrees. It has physical
stops placed in the gear mechanism to prevent turning beyond these limits to
protect the rotational sensor. These common servos are found in EZ-Robot's
arms, legs, limbs, etc.. For example, the JD or Six robots use these servos.
 Continuous rotation servo: This is quite similar to the common positional
rotation servo motor, except it can turn in either direction indefinitely. The
control signal, rather than setting the static position of the servo, is interpreted
as the direction and speed of rotation. The range of possible commands causes
the servo to rotate clockwise or counterclockwise as desired, at varying speed,
depending on the command signal. You might use a servo of this type on a
radar dish if you mounted one on a robot. Or you could use one as a drive
motor on a mobile robot. The EZ-Robot AdventureBot uses two continuous
rotation servos with wheels. The center (90 degrees) is the center of a
continuous rotation's STOP position. The further you move away from 90
degrees in either direction controls the speed of the continuous rotation servo
in that direction
 Linear servo: This is also like the positional rotation servo motor described
above, but with additional gears (usually a rack and pinion mechanism) to
change the output from circular to back-and-forth. These servos are not easy to
find, but you can sometimes find them at hobby stores where they are used as
actuators in larger model airplanes.

1.9.3 Controlling a servo motor

A standard servo is what you normally find in R/C Hobby Toys. They are high
precision devices that can rotate a shaft up to 180 degrees. With the EZ-B and a
Standard Servo, you can easily configure how many degrees to rotate the output shaft.

1.10 Power Connectors


While many connectors carry power in addition to data, some connectors are used
specifically to provide power connections to devices. These vary widely by
application and size, but we will only focus on some of the most common ones here.

1.10.1 Barrel Connectors


Barrel connectors are typically found on low-cost consumer electronics which can be
plugged into wall power via bulky AC wall adaptors. Wall adaptors are widely
available, in a variety of power ratings and voltages, making barrel connectors a
common means for connecting power to small projects.
The female barrel connector, or "jack", can be purchased in several varieties: PCB
mounted (surface mount or through hole), cable mount, or panel mount. Some of
these connectors will have an additional contact that allows the application to detect
whether a power supply is plugged into the barrel jack or not, thus allowing the device
to bypass batteries and save battery life when running on external power.
Female barrel connector. When no plug is inserted, the "insertion detection" pin will
be shorted to the "sleeve" pin.
The male barrel connector, or "plug", is usually only found in a wire termination
variety, although there are multiple methods of attaching the plug to the end of the
wire. It's also possible to get plugs that come pre-attached to a cable.

1.10.2 What is Pin Header Connectors?


Pin header is a type of electrical connector, this connector are widely used in
electronic or instrumentation of PCB (Print Circuit Board) function as bridge between
two PCBs which were blocked, and used to take current or signal transmission.
When pin headers connector mated with header connectors (Female header called
“header connector”) called Board to board connector(click to view more on WIKI)
connection. Mated with cable connectors called Wire to board connection such when
it function as recipients for jumper wire.

Figure 1.7 Board to board connection

Board to board connection

Figure 1.8 Write to board connection

Wire to board connection

1.11 Introduction of Male & Female Pins

1.11.1 By pitch(spacing):
Pitch refers to the distance or space between two pins in electronic community, more
details check Wikipedia
Figure 1.8 P.C.B LAYOUT

 -2.54mm (.100”) inch pitch pin header connectors ( typically and widly used)
 -2.00mm (.079”) inch pitch pin header connectors ( widly used)
 -1.27mm (.050”) inch pitch pin header connectors ( used as well)
 -1.00mm (.039”) inch pitch pin header connectors ( for small device)
 -0.80mm (.032”) inch pitch pin header connectors ( for smaller device)

1.11.2 Number of rows:

 Single row pin header connectors


 Dual rows pin header connectors
 Triple rows pin header connectors
 Quad rows pin header connectors ( Max )

Number of rows depend on the PCB board’s design, and considering the Current.
Single and Dual row are normally than others.

1.11.3 Number of pins:


The pins for per row generally is depend on the pitch. for standard pitch such as
2.54mm and 2.0mm has 2-40 pins, and smaller pitch like 1.27mm and 1.0mm has
2-50 pins per row. Sometimes there are special module can make over 40 pins or 50
pins header, it’s according to the requirement from customers and need to consider the
performance before production.

1.11.4 Version:

 Straight (Dip or Vertical) pin header connector


 Right-angle ( 90 degree) pin header connector
 SMT (surface mount, SMD) pin header connector
Figure 1.9
Versions angle

Figure 1.10 Male & Female headers

1.12 Introduction of Nema Stepper Motor


A NEMA 17 stepper motor is a stepper motor with a 1.7 x 1.7 inch (43.18 x 43.18
mm) faceplate. The NEMA 17 is larger and generally heavier than for example a
NEMA 14, but this also means it has more room to put a higher torque.

1.12.1 NEMA features and benefits

Ease of selection is the fundamental design advantage of a NEMA-style starter. To


effectively select a NEMA-style product, you only need to know the horsepower and
voltage.Serviceability is another key in the NEMA market. Most NEMA products are
serviceable and provide front access to internal parts. Unless a total device
replacement is necessary, contacts and coils of all sizes can be repaired usually
without removing the device from the panel.Reserve capacity is a consideration in the
ease of selection of NEMA products. They are designed to be very robust and broadly
applicable. They are "general-purpose," as opposed to being more specific and/or
application intensive.

NEMA-style devices have interchangeable heater elements. In fact, a range of thermal


units are available for the overload. This characteristic makes a NEMA product
attractive on many construction jobs, where the ultimate motor schedule or the actual
motor nameplate is not known until close to the start-up date.

The motor control center (MCC) or Enclosed Package Solution is a NEMA tradition.
Most NEMA products are sold as starters, in either open-style or various enclosed
versions.

A Step Motor is defined as a device whose normal shaft motion consists of discrete
angular movements of essentially uniform magnitude when driven from a sequentially
switched DC power supply. A step motor is a digital input-output device. It is
particularly well suited to the type of application where control signals appear as digital
pulses rather than analog voltages. One digital pulse to a step motor drive or translator
causes the motor to increment one precise angle of motion. As the digital pulses
increase in frequency, the step movement changes into continuous rotation.

Figure 1.11 Nema Motors

1.12.2 Types of Stepper Motors


There are three basic types of step motors in use, though in industrial automation the
most common type is the hybrid type:

 Active rotor: permanent magnet (PM)


 Reactive rotor: variable reluctance (VR)
 Combination of PM and VR: hybrid (HY)

Design Tips for Using Step Motors

 Parallel connect the lead wires for best torque over the widest speed range
 If not enough current is available from the drive, series connect the lead wires
for full torque at low speeds
 Keep motor case temperature below 100 °C. This can be achieved by lowering
the motor current or limiting the duty cycle
 Allow sufficient time to accelerate load
 Use a microstepping drive for smoothest motor performance over a wide
speed range
 For open loop operation, size the motor with a 30-50% torque margin at speed.
Including an encoder in the system and using a Stall Prevention feature may
allow operation all the way down to a 0% torque margin
 Do not disassemble motors. A significant reduction in motor performance
will result
 Do not machine shafts without consulting Electromate® first
 Do not disconnect motor from drive while power is applied. Remove power
from the drive before disconnecting the motor
 Do not use holding torque/detent torque of motor as fail-safe brake
 Use an Electromate® recommended stepper drive with your step motor to
ensure optimal performance

Electromate® sells a family of 2-phase hybrid type step motors with a 1.8° step angle in
NEMA frame sizes from NEMA 8 to NEMA 42. Stepper motors from
Electromate® are available in 4, 6 or 8 lead configurations for bipolar or unipolar
operation. All motors can be wired in series or parallel, depending on the requirement.
Motors are available with optional rear shaft extensions, encoders, brakes, cables,
gearboxes and IP65 sealing.

1.12.3 Our NEMA Frame Stepper Motors include:

 NEMA 8 Step Motors


 NEMA 11 Step Motors
 NEMA 14 Step Motors
 NEMA 17 Step Motors
 NEMA 23 Step Motors
 NEMA 24 Step Motors
 NEMA 34 Step Motors
 NEMA 42 Step Motors

1.13 What is CNC shield?


It is a shield for arduino that fits over the arduino uno/mega board and can be used to
drive a CNC(Computer Numerical Control) machine or a 3d printer(advanced) . It has
the basic configuration already made , though you need to work on the connections to
motors and sensors.

1.13.1 What is GRBL CNC?


GRBL is a firmware for arduino boards(uno,nano,Duemillanove) that controls
stepper motors and spindles/lasers. GRBL uses gcode as input and outputs signals via
the arduino pins. Most industrial cnc machines uses parallel port controller that
requires Those big purple connectors.
ril3y edited this page on Feb 24, 2013 · 1 revision
1.13.2 What is a grblShield?
The Arduino grblShield is a complete hardware solution for Dank's CNC motion
control system called grbl.
Compatible with the Uno and other 328p versions of the Arduino development
platform. (Note: grbl 0.6 is not compatible with 168-based Arduinos (nor will it ever
be), and currently grbl does not support the Arduino Megas).

1.13.3 grbl Features:

 Interprets a subset of rs274/ngc standard gcode


 Three motion control axes - X, Y and Z
 Full support for arc motion
 Acceleration / deceleration management

1.13.4 grblShield Features:

Compatible with grbl 0.6 and later versions

 Three stepper motors supporting X, Y and Z axes


 8x microstepping
 2.5 amps per winding (bipolar steppers)
 12v-30v motor voltage supported
 Independent current control per axis
 Motor connectors plug compatible with RepRap and Makerbot electronics
 Uses TI DRV8818 stepper drivers

1.13.5 3-Axis CNC/Stepper Motor Shield for Arduino


The Arduino CNC Shield makes it easy to get your CNC projects up and running in a
few hours. It uses opensource firmware on Arduino to control 4 stepper motors using 4
pieces of A4988 Stepper Motor driver breakout board, with this shield and
ArduinoUno/Mega, you can build all kinds of robotics, linear motion project or projects
including CNC routers, laser cutters and even pick&place machines.
Figure 1.12 CNC Driver

Brief Data:
GRBL 0.9 compatible. (Open source firmware that runs on an Arduino UNO that
turns G-code commands into stepper signals)
4-Axis support (X, Y, Z , A-Can duplicate X,Y,Z or do a full 4th axis with custom
firmware using pins D12 and D13)
2 x End stops for each axis (6 in total)
Coolant enable
Uses removable A4988 compatible stepper drivers. (A4988, DRV8825 and
others)(Not Included)
Jumpers to set the Micro-Stepping for the stepper drivers. (Some drivers like the
DRV8825 can do up to 1/32 micro-stepping )
Compact design.
Stepper Motors can be connected with 4-pin Molex connectors or soldered in place.
Runs on 12-36VDC. (At the moment only the DRV8825 drivers can handle up to
36V so please consider the operation voltage when powering the board.)
. GRBL Control Software/Firmware for Arduino
Before you can use this CNC shield with Arduino, a control firmware need to be
downloaded into Arduino board. We are going to use „GRBL‟ to accomplish our job.
GRBL is open-source software that runs on an Arduino Uno that takes G-Code
commands via Serial and turns the commands into motor signals. Grbl is a
no-compromise, high performance, low cost alternative to parallel-port-based motion
control for CNC machine. It accepts standards-compliant g-code and has been tested
with the output of several CAM tools with no problems. Arcs, circles and helical
motion are fully supported, as well as, all other primary g-code commands. Macro
functions, variables, and most canned cycles are not supported, but we think GUIs can
do a much better job at translating them into straight g-code anyhow.
A copy of this open-source firmware can be downloaded from the below link:
Following the below steps to prepare this CNC Shield board to function properly:
1. Download a copy of GRBL from: https://github.com/grbl/grbl
Unzip this file into your local hardisk location, you may want to create a special new
folder for this purpose for easy locating of all files needed in your project. Locate an
Arduino sketch „grblUpload.ino‟ in this folder where you have unzip the files.
Below is the files structures located in my local hardisk:

Figure 1.13 grblupload


Open up this sketch „grblUpload.ino‟ and you should see the screen as below:
Figure 1.14 grblupload Code

Click the upload icon as usual to „compile/upload‟ as you normally upload Arduino
sketch. When you see „done uploading‟, click the „Serial Monitor‟ on Arduino IDE as
shown below:
Figure 1.15 grblupload command

If you can receive response message “ Grbl 0.9j ['$' for help] ” from your Serial
Monitor, congratulation! You have successful uploaded the „GRBL‟ firmware into
your Arduino board.
3. Hooking Up the Stepper Motor to CNC Shield
Connect steppers motor to CNC Shield board as the below block diagram. of the CNC
Shield connected to 3-stepper motor:

Figure 1.16 grblupload


Figure 1.16 CNC driver
sheild

. G-Code Sender
To send commands to your CNC/3-axis stepper motor driver board you need a g-code
sender to send command and instruction.
Download the Universal-G-Code-Sender.
Universal GcodeSender is a Java based GRBL compatible cross platform G-Code
sender. Use this program to run a GRBL controlled CNC machine. Once downloaded,
connect the UNO board USB to your computer and take note of the COM port it is
connected to.
Run the start-windows.bat or the JAR file directly.
You will be presented with the following screen:
Click the “Machine Control” tab. Select the “Port” number which your Arduino board
is attached to. Select 115200 as the Baud rate as this is the speed configured in
“GRBL” firmware. Click “Open” button to start the communication for controlling
this shield board.
Now, you are ready to control the XYZ stepper motor connected to shield board.
Click X+ or X- for example, the stepper motor attached to X terminal will turn in
forward or reverse direction.
This will complete our initial setup for driving 3-axis stepper motor connected to this
shield board with “GRBL” loaded to Arduino controller board using “Universal
G-Code Sender” user interface.

1.14 Summary
From last decade technology is also coming in Pakistanis a very faceting
mode. Everyone likes to use printer, computer and Internet. So, if we
utilize this technology for Educational purposes it will surely raise the
stander of education.
CHAPTER NO.2
REQUIREMENT ANALYSIS
2 Requirement Analysis
In this chapter analysis of requirement is carried out using HMI
diagrams and separating functional and non -functional diagram. Business
requirement have also considered because this Product is made for office
use.

2.1 The Hands-On User of the Product


Users are human beings who interface with the product in some way.
Users are also known as actors.
 User
Table 1: User
User Name User

User Role Turn on Arduino


Download Applications Arduino IDE
Install Application
Subject matter No
experience

Technological Yes
experience

2.2 Use Case Diagram


A use case diagram is a graphical depiction of the interaction among
the elements of a system.
A use case methodology uses in system analysis to identify, clarify, and
organize system requirement. In this context, the term “system” refers to
something being developed or operated, such as a mail -order product sales
and service website. Use case diagrams are employed in UML (Unified
Modelling Language), a standard notation for the modelling of real -world
objects and systems.
A use case diagram at its simplest could be an illustration of a user’s
interaction with the system and shows the connection between the user and
therefore the completely different use cases during which the user
involves.
A use case diagram contains four components.
 The boundary, which defines the system of interest in relation to the
world around it.
 The actors, usually individuals involved with the sys tem defined
according to their roles.
 The use cases, which the specific roles are played by the actors
within and around the system.
The relationships between and among actors and the user cases.

2.2.1 Use Case 1


Development Base:

Planning
Design
Design

Development

Testing Developer 2
Developer 1
Implementation

Fig: 2.1 Developer


2.2.2 Use Case 2

Turn on
Arduino UNO

Application1
Arduino IDE

Application
2(Google
Task)

Fig: Use Case

2.3 Product Use Case


#UCI
Use case Title: Turn on Arduino UNO
Description: The user first turns on Arduino IDE.
Primary Actor: User
Pre-Condition User should firstly Pore on arduino.
Post-Condition: The use can see the interface of CNC Drawing Machine
.
#UC2
Use case Title: Download Applications
Description: The user installs the application (gbrl) which help him to interact with
CNC Drawing Machine
Primary Actor: User
Pre-Condition: The user should login applications.
Post-Condition: User can upload his/her Tasks and can see notification.

2.4 Functional and Data Requirement


Software requirement document plays the central role in the entire
software development process. To start with, it is needed in the project
planning and feasibility phase. In this phase, a good understanding of the
requirement is needed to determine the time and resources required to build
the software. As a result of this analysis, the scoop of the system may be
reduced before embarking upon the software development.
This section includes the requirement that specify all the fundamental
actions of the software system. There are
Section 1: Functional requirement
Requirement #: Functional requirement 1 Requirement type: Functional
Title: Turn on arduino
Description: The user should turn on or power on arduino so that he/she can see
interface and modules.
Rationale: In order for a user to turn on Arduino UNO.
History: Created June 10, 2019
Requirement #: Functional requirement 2 Requirement type: Functional
Title: Download Applications
Description: The user should download GBRL applications so that he can interact
with CNC Machine.
Source: requirement Engineer Team
Rationale: In order for a user to download the PC application.
Customer Satisfaction: 5 Customer Dissatisfaction:1
History: Created June 10, 2019
Requirement #: Functional requirement 3 Requirement type: Functional
Title: Connect the apps with Arduino
Description: The use connects the app with UNO using UNO IDE API.
Source: Requirement Engineer Team
Rationale: In order for the user to show mobile notifications and upload tasks.
Customer Satisfaction:5 Customer Dissatisfaction:1
History: Created June 10, 2019

2.5 Non-Functional Requirement


Non-functional Requirements are given in this section.
2.5.1 Look and Feel Requirements
This section gives a description of the hardware, software and communication
interfaces and provides basic prototype of the user interface.

2.5.2 User Interface


1. A first-time user of the smart mirror should see a screen full with different
modules.
2. After this he will be able to upload his schedule from mobile.
2.5.3 Hardware Interface
It does not have any direct hardware interfaces.
2.5.4 Software Interface
The gbrl application communicates with arduino uno to upload schedule etc.

2.5.5 Usability and Humanity Requirement


1. The product will be user friendly. Product will be easy to use.
2. System must do all transactions within reasonable time.
3. Reliability and availability requirements:
a. Product will be reliable.
b. Product will be easily usable.
c. Product will work properly.
4. The functionality of this product can be enhanced with some modules in
future.

2.6 Quality Requirement of the Project


2.6.1 legal Requirement
No illegal requirements are used in this project.
The standards are followed which are provided by the department.
Compliance Requirements
1. Educational data of user should be confidential.
Standard Requirement
CNC should be developed using DDLC model.
2.6.2 Software System Attribute
 Reliability
 Availability
 Security
 Maintainability
 Portability

2.6.3 Operational and Environmental requirements


Requirement #: Quality Requirement 1 Requirement type: Quality
Requirement
Title: Internal Storage
Description: The system should have internal storage in MBs.
Source: Requirement Engineer Team.
Rationale: In order to for system storage.
Customer Satisfaction:5 Customer Dissaticfaction:1
Dependencies: None
History: Created June 12, 2019

Requirement #: Quality Requirement 2 Requirement type: Quality


requirement
Title: Application Memory Usage
Description: The amount of Operating System memory occupied by the application
in MBs.
Source: Requirement Engineers Team
Rationale: In order to for user to tell about the application size in MBs.
Customer Satisfaction:5 Customer Dissaticfaction:1
Dependencies: None
Requirement #: Quality requirement 3 Requirement type: Quality
requirement
Title: System Reliability
Description: The availability of the system when its is used. The system should give
accurate result every time.
Source: Requirement Engineers Team
Rationale: In order to for CNC that the system is available 24/7 hours.
Customer Satisfaction:5 Customer Dissaticfaction:1
Dependencies: None
History: Created June 12, 2019

2.7 Cultural and political Requirements


2.7.1 Cultural Requirements
The CNC is providing English Language for user convenience and
write verses of Holy Quran.

2.7.2 Political requirement


This CNC Drawing Machine should provide fully functionality only to
customer.

2.8 Summary
In this chapter we underscored analysis of system requirement tha t
helps us to understand design and feature for this product. UML diagrams
and analysis of each requirement is performed to get into each requirement
duly.
Chapter 3
System Design
Project planning

Step 1: Disassembly DVD/CD Drives First step to start building this CNC machine is
to disassemble two DVD/CD drives and take off them the stepper motors. Use the
screwdriver to open them and take off them the rails. Next step is to choose our base
for this CNC machine. I used one surface from remaining DVD garbage' stuff. Finally
we will need to find something to attach the one of the stepper-rails vertically to our
construction. (you will understand what I mean in our next step) Watch the above
image.
Image Notes 1.
1. 1st Stepper motor with rails
2. 2nd stepper motor with rails
3. This metal will be our CNC "base"
4. We will cut this plastic to attach on it later one of the stepper-rails
Step 2: X and Y axis In first image above you will see the Y axis of our CNC
machine. Attach it on your surface, in this part you will need some screws and nuts in
second image you will see the X and Y axis. The X axis is attached to two plastic
parts that I took from remaining 'garbage' stuff. I cut it to fit the construction. This is
an easy procedure. Just make sure to put the Y axis straight to CNC base and the X
axis vertically in this (90 degrees)
Step 3: The Z axis That's the most difficult part of our construction. You will need
something to attach it on X axis, a flat surface. On that surface you will attach the
servo motor (Z axis) and the pen base. Pen (or pencil) must be able to move up and
down with the help of servo motor .Watch the above image to understand what you
need to do to build Z axis Image Notes 1. Servo motor must be able to move up and
down the pen
Step 4: Paper base Now you will have to attach a wood (or plastic) surface on Y axis
(5x5cm will be fine).On this you will put the paper piece to print your texts or images
Remember, printing area is 4x4cm
Following is the list of risks that may get in the way during the development of
the project. Table given below describes each of risk with the probability of
occurrence and its effect with scale from 0-10. 0 means nothing and 10 means at
peak point and middle value shows the medium occurrence.
Step 5: The Circuit
Now that we have our contraction ready, it's time to build the circuit and test stepper
motors (X and Y axis).Watch the above image with breadboard circuit schematic.
Steppers motors wiring is something that need patient. On next step you will find a
'testing' code for x and y axis. If yours steppers doesn't work properly you must find
correct working combination by changing the cables between them and the L293D IC
On mine CNC , X axis motor connection are: L293 A: Pins 1 and 3 & B: 2 and 4, but
on Y axis motor connection are A: 1 and 2 & B: 3 and 4
Step 6: Testing X and Y axis movement
Here is the X and Y axis testing code embedded using code bender For X axis: For Y
axis: If you see any movement here that means that the stepper motors wiring is
correct! if you don't, try to change the cables.. .
Step 7: Uploading the CNC code
Here is the main CNC code embedded using code bender In this part you will see
your pen goes up. If don't, change pen Up and pen Down variables that controlling the
servo motor. Press the "Run on Arduino" button and program your board from your
browser!
Step 8: The GCTRL program
Now we are ready to print our first image! To do this we will use the gctrl.pde
processing program. This program sends 'G code' images to the CNC plotter. What
is G code? G code is a file with X,Y and Z coordinates. Header of this file is set to:
M300 S30.00 (Servo down) G1 X10.00 Y10.00 F2500.00 G1 X20.00 Y10.00
F2500.00 M300 S50.00 (Servo up) Download Processing from here, now download
and open GCTRL.pde application. Click the "play" icon/button to start the program.
~Watch the above image~ Now press 'p' and select your Arduino serial port. Press 'g'
and select the 'drawing g code' file
Step 9: Make your own G code file
To make g code files that are compatible with this CNC machine you have to use the
Inkscape. Inkscape is professional quality vector graphics software which runs on
Windows, Mac OS X and Linux. It is used by design professionals and hobbyists
worldwide, for creating a wide variety of graphics such as illustrations, icons, logos,
diagrams, maps and web graphics. Inkscape uses the W3C open standard SVG
(Scalable Vector Graphics) as its native format, and is free and open-source software.
Download and install Inkscape from here (Important: download 0.48.5 version) Now
you need to install an Add-on that enables the export images to g code files. This add
on can be found here with installation notes.
Setup Inkscape for first use
Open the Inkscape, go to File menu and click "Document Properties". See the 1st
image above and make the changes, make sure to change first to "cm". Now close this
window. We will use the area within 4 to 8 cm. See the 2nd image above. How to
print texts Put text, change font to Times New Roman and size to 22. Now click on
cursor icon and center the text like the 3rd image above. Select Path from menu and
"Object to Path". How to print images This is more difficult than texts. Images must
have a transparent background. Drag and drop the arduino logo image (download it
from files) in Inkscape. Click ok to the next window. Now you have to re-size the
image to fit our printing area, see the 4th image above. Click Path from menu and
"Trace Bitmap". Make changes as the 5th image above. Click ok and close the
window. 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".
The 6th image above show how to delete image outline.
Export as g code
Final, go to file menu, click save as and select g code. Click ok on next window.
That's it! Ready to go! Use the gctrl.pde app to print the g code file on your new
Arduino CNC Plotter!

Term Defination

User A person who intrects with the the mobile phone


application and without mobile phone
Palystore An Applicatio pre-installed on android devices,allow
user to download and install application
DECS Description

RAT Rational

DEP Dependency

TAG A unique presitance identifire cotained in apLanguage


statement
MUST Something that should not be overlooked or missed

PLAN An intention or decision about one is going to do.

DEDINED The Official definition of a term

3.1 Class Digram


Class diagram is a static diagram. It represents the static view of an
application. Class diagram is not only used for visualizing, describing, and
documenting different aspects of a system but also for constructing
executable code of the software applicat ion.

3.1.1 Class Responsibility Collaborate Mode

Main Activity Arduino UN0

Module ON -Pin ON

+CallActivatepin() +Activatepin()
-CallDeactivatepin( -Deactivatepi()
)
3.2 Sequance Digram
A sequence diagram shows object interactions arranged in time sequence.
It depicts the objects and classes involved in the scenario and
the sequence of messages exchanged between the objects needed to carry
out the functionality of the scenario. ...Sequence diagrams are sometimes
called event diagrams or event scenarios.

3.2.1 Analysis sequence model diagram

Module
Activate

PC Fetch

UNO IDE

Fig 7 : Sequance Digram

3.3 Data Flow Digram (DFD)

3.3.1Fully Dressed Format


Table 1:Planning
Section: Main

Name: Planning

Actors: Developer

Purpose: The developer plans the things in the CNC what should
be here and for what purpose should be.
Description: The developer will plan all the modules in the CNC and
user friendly will be as well.
Cross References: None
Pre-Conditions: None

Successful Successful planning has been done in order to do next


Post-Conditions step in the project.
Failure A change when have to done in the project then
Post-Conditions replanting is done and time consuming.
Typical Course of Events

Actor Action System response

1 The Developer will do planning 2 None

Alternative Course

Step3: Planning has not done successfully.

Table 2:Designing
Section: Main

Name: Designing

Actors: Coder and Developer

Purpose: The aim is to design and placement of the module


according to the requirement of the stakeholder.
Description: The coder and developer will design and do meetings
with the end user in order to maintain the quality of the
project.
Cross References: None

Pre-Conditions: Do Planning

Successful All the designing has been done in this phase in order to
Post-Conditions make a final full platform.
Failure Syntax error, Logical error or any other error related to
Post-Conditions coding is occurred.
Typical Course of Events

Actor Action System response

1 Developer and coder and other 2 A system shows the code which is
software team will make the to be done.
coding to do the design.
Alternative Course
Step3: Code error in the designing.

Table 3:Developemrnt
Section: Main

Name: Development

Actors: Developer

Purpose: To develop system as well as the values of the


development
Description: Do development of the CNC Drawing Machine.

Cross References: None

Pre-Conditions: Designing

Successful The development has been done and final product has
Post-Conditions been developed.
Failure The development has not been finally done in the
Post-Conditions development.
Typical Course of Events

Actor Action System response

1 The developer will do the


development
Alternative Course

Step3: Syntax, logical and other error may be occurred.

Table 4:Testing
Section: Main

Name: Testing

Actors: Test Team

Purpose: To do testing at low level as well as on the upper level in


the coding.
Description: The main task is to make a testing in order to make the
final and fruitful testing.
Cross References: None

Pre-Conditions: Development and designing.

Successful The testing stage has been cleared.


Post-Conditions
Failure The test has not been done successfully.
Post-Conditions
Typical Course of Events

Actor Action System response

1 The test team will do testing to 2 System will debug he errors.


the coding.
Alternative Course

Step3: Hardware may not be suitable with the CNC Machine.

Table 5:Implentation
Section: Main

Name: implementation

Actors: Hardware Team

Purpose: The main aim of this is to do the implementation in the


mirror so that it can run successfully.
Description: The main task is to implement the modules so that it can
be done successfull y.
Cross References: None

Pre-Conditions: Testing, development and designing.

Successful Implementation has Benn done finally.


Post-Conditions
Failure Implementation get error like invalid repository, test
Post-Conditions errors and other such type of the error.
Typical Course of Events

Actor Action System response


1 The software will do its 2 The implementation get error or has
implementation. been implemented.
Alternative Course

Step3: Implementation can get error in the app.

Table 6:Update
Section: Main

Name: Update

Actors: Software Team

Purpose: The purpose is to bring the new modules or new things in


the CNC.
Description: The CNC version will be updates.

Cross References: None

Pre-Conditions: Old version

Successful The CNC has been finally updated.


Post-Conditions
Failure Update the CNC may be not suitable for the hardware
Post-Conditions design.
Typical Course of Events

Actor Action System response

1 The developer will add new 2 The mirror has been finally
features in the CNC. updated.
Alternative Course

Step2: The hardware may not suitable for the app that is
designed.

Table 7:Use Arduino


Section: Main

Name: Use Arduino

Actors: User
Purpose: The user can use ARDUINO.

Description: The aim is to get the new information that has required to
user.
Cross References: None

Pre-Conditions: Buy Arduino

Successful The user can successfully interact with the CNC


Post-Conditions modules.
Failure None
Post-Conditions
Typical Course of Events

Actor Action System response

1 A user will use Arduino. 2 Provided information to user.

Alternative Course

Step2: Modules crashed.

Table 6:Feedback
Section: Main

Name: Feedback

Actors: User

Purpose: The purpose is to get opinion of the user.

Description: The aim is to get response from user while he was using
CNC Drawing Machine.
Cross References: None

Pre-Conditions: None

Successful The response has been done finally.


Post-Conditions
Failure None
Post-Conditions
Typical Course of Events
Actor Action System response

1 A user will interact will the CNC. 2 Boot the CNC

Alternative Course

Step2: Modules connection error.

METHODOLOGY
We have supply the current in Arduino with USB DATA cable to transfer Data from
Computer to Arduino Board [1], Here we have used 3 Stepper Drivers to supply the G
codes in Sequence to the stepper motors. Arduino will be mounted on CNC shield.
CNC shield will be distributing the Current in the command of Arduino. CNC shield
will be converting the command of G codes in digital pulse by Stepper motor. In X
direction Stepper motor will be move left and Right ,Y direction stepper motor will be
move in front and back direction, Z direction Stepper motor will be move in Up and
down[2]. We have made much difficult design via using this machine. The accuracy
of this machines result is very high. So we have used in industry to reduce the cost of
design printing and maintain accuracy level. Drafting and Scaling of CNC Plotter
machine is very precious.
3.1 DESIGN OF CNC MACHINE
There are 3 movements of using 3 CD ROMs. The horizontal movement(X) i.e.
forward & backward movement is provided by the lower CD Rom. The 2nd CD Rom
is mounted between the 2 columns which provide side movements(Y) i.e. left and
right hand side movements. The spindle which is mounted on the 3rd CD Rom
provides vertical movement (Z) for feed of tool
3.2 PROBLEM DEFINITION
The available Arduino controlled CNC machines are having only 2 axis movement.
The structure is weak and can machine foam only.
3.3 WORKING
We have supply the current in Arduino with USB DATA cable to transfer Data from
Computer to Arduino Board [1], Here we have used 3 Stepper Drivers to supply the G
codes in Sequence to the stepper motors. Arduino will be mounted on CNC shield.
CNC shield will be distributing the Current in the command of Arduino. CNC shield
will be converting the command of G codes in digital pulse by Stepper motor. In X
direction Stepper motor will be move left and Right ,Y direction stepper motor will be
move in front and back direction, Z direction Stepper motor will be move in Up and
down[2]. We have make many difficult design via using this machine. The accuracy
of these machines results is very high. So we have used in industry to reduce the cost
of design printing and maintain accuracy level. Drafting and Scaling of CNC Plotter
machine is very precious.
3.4 Main parts of CNC plotter
Mini CNC Plotter Machine is worked on input as a G codes of Design and Converting
it via use of Arduino, Stepper Drivers, CNC Shield, Stepper Motor in to a Rotation of
Lead screw. We have work on to maintain lowest cost of our project. We have design
a simple construction of our project. This is easier way to use stepper motor with lead
screw, CNC shield, Stepper drivers, Arduino Board, etc. The Setup of machine is
flexible that’s why it will be easily transported and Maintenance time is short. The
basic diagram of CNC Plotter machine is shown in figure.

3.5 BLOCK DIAGRAM OF PROCESS


In this idea of project, Arduino microcontroller platform with ATMEGA 328 core is
used. It can be easily interfaced with PC using FTDI module whereas also with the
easy drivers and stepper motors to. The basic block diagram is as shown in FIG.1 The
explanation is given as follows

2.9 Summary
In this we described in a very detail that what are the components in
this system, how they interact with each other and what are the steps a user
will take to achieve his target using features and functions of this above
system.
CHAPTER No.4
IMPLEMENTATION
IMPLEMENTATIONS
In this chapter main coding of application is described. It describes that
how mirror works. It helps us to understand features and user interaction
with these features, for instance such a product that will help to user to
control their electronics from anywhere .

CODE
#include <Servo.h>
#include <AFMotor.h>

#define LINE_BUFFER_LENGTH 512

char STEP = MICROSTEP ;

// Servo position for Up and Down


const int penZUp = 115;
const int penZDown = 83;

// Servo on PWM pin 10


const int penServoPin =10 ;

// Should be right for DVD steppers, but is not too important here
const int stepsPerRevolution = 48;

// create servo object to control a servo


Servo penServo;

// Initialize steppers for X- and Y-axis using this Arduino pins for the L293D
H-bridge
AF_Stepper myStepperY(stepsPerRevolution,1);
AF_Stepper myStepperX(stepsPerRevolution,2);

/* Structures, global variables */


struct point {
float x;
float y;
float z;
};

// Current position of plothead


struct point actuatorPos;

// Drawing settings, should be OK


float StepInc = 1;
int StepDelay = 0;
int LineDelay =0;
int penDelay = 50;

// Motor steps to go 1 millimeter.


// Use test sketch to go 100 steps. Measure the length of line.
// Calculate steps per mm. Enter here.
float StepsPerMillimeterX = 100.0;
float StepsPerMillimeterY = 100.0;

// Drawing robot limits, in mm


// OK to start with. Could go up to 50 mm if calibrated well.
float Xmin = 0;
float Xmax = 40;
float Ymin = 0;
float Ymax = 40;
float Zmin = 0;
float Zmax = 1;

float Xpos = Xmin;


float Ypos = Ymin;
float Zpos = Zmax;

// Set to true to get debug output.


boolean verbose = false;

// Needs to interpret
// G1 for moving
// G4 P300 (wait 150ms)
// M300 S30 (pen down)
// M300 S50 (pen up)
// Discard anything with a (
// Discard any other command!

/**********************
* void setup() - Initialisations
***********************/
void setup() {
// Setup

Serial.begin( 9600 );
penServo.attach(penServoPin);
penServo.write(penZUp);
delay(100);

// Decrease if necessary
myStepperX.setSpeed(600);
myStepperY.setSpeed(600);

// Set & move to initial default position


// TBD

// Notifications!!!
Serial.println("Mini CNC Plotter alive and kicking!");
Serial.print("X range is from ");
Serial.print(Xmin);
Serial.print(" to ");
Serial.print(Xmax);
Serial.println(" mm.");
Serial.print("Y range is from ");
Serial.print(Ymin);
Serial.print(" to ");
Serial.print(Ymax);
Serial.println(" mm.");
}

/**********************
* void loop() - Main loop
***********************/
void loop()
{

delay(100);
char line[ LINE_BUFFER_LENGTH ];
char c;
int lineIndex;
bool lineIsComment, lineSemiColon;

lineIndex = 0;
lineSemiColon = false;
lineIsComment = false;

while (1) {

// Serial reception - Mostly from Grbl, added semicolon support


while ( Serial.available()>0 ) {
c = Serial.read();
if (( c == '\n') || (c == '\r') ) { // End of line reached
if ( lineIndex > 0 ) { // Line is complete. Then execute!
line[ lineIndex ] = '\0'; // Terminate string
if (verbose) {
Serial.print( "Received : ");
Serial.println( line );
}
processIncomingLine( line, lineIndex );
lineIndex = 0;
}
else {
// Empty or comment line. Skip block.
}
lineIsComment = false;
lineSemiColon = false;
Serial.println("ok");
}
else {
if ( (lineIsComment) || (lineSemiColon) ) { // Throw away all comment
characters
if ( c == ')' ) lineIsComment = false; // End of comment. Resume line.
}
else {
if ( c <= ' ' ) { // Throw away whitepace and control
characters
}
else if ( c == '/' ) { // Block delete not supported. Ignore
character.
}
else if ( c == '(' ) { // Enable comments flag and ignore all
characters until ')' or EOL.
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
line[ lineIndex++ ] = c-'a'+'A';
}
else {
line[ lineIndex++ ] = c;
}
}
}
}
}
}
void processIncomingLine( char* line, int charNB ) {
int currentIndex = 0;
char buffer[ 64 ]; // Hope that 64 is enough for 1
parameter
struct point newPos;

newPos.x = 0.0;
newPos.y = 0.0;

// Needs to interpret
// G1 for moving
// G4 P300 (wait 150ms)
// G1 X60 Y30
// G1 X30 Y50
// M300 S30 (pen down)
// M300 S50 (pen up)
// Discard anything with a (
// Discard any other command!

while( currentIndex < charNB ) {


switch ( line[ currentIndex++ ] ) { // Select command, if any
case 'U':
penUp();
break;
case 'D':
penDown();
break;
case 'G':
buffer[0] = line[ currentIndex++ ]; // /!\ Dirty - Only works with 2 digit
commands
// buffer[1] = line[ currentIndex++ ];
// buffer[2] = '\0';
buffer[1] = '\0';

switch ( atoi( buffer ) ){ // Select G command


case 0: // G00 & G01 - Movement or fast
movement. Same here
case 1:
// /!\ Dirty - Suppose that X is before Y
char* indexX = strchr( line+currentIndex, 'X' ); // Get X/Y position in the
string (if any)
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++ ]; // /!\ Dirty - Only works with 3 digit
commands
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: // M114 - Repport position
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 );
}
}
}
}

/*********************************
* Draw a line from (x0;y0) to (x1;y1).
* int (x1;y1) : Starting coordinates
* int (x2;y2) : Ending coordinates
**********************************/
void drawLine(float x1, float y1) {

if (verbose)
{
Serial.print("fx1, fy1: ");
Serial.print(x1);
Serial.print(",");
Serial.print(y1);
Serial.println("");
}

// Bring instructions within limits


if (x1 >= Xmax) {
x1 = Xmax;
}
if (x1 <= Xmin) {
x1 = Xmin;
}
if (y1 >= Ymax) {
y1 = Ymax;
}
if (y1 <= Ymin) {
y1 = Ymin;
}

if (verbose)
{
Serial.print("Xpos, Ypos: ");
Serial.print(Xpos);
Serial.print(",");
Serial.print(Ypos);
Serial.println("");
}

if (verbose)
{
Serial.print("x1, y1: ");
Serial.print(x1);
Serial.print(",");
Serial.print(y1);
Serial.println("");
}

// Convert coordinates to steps


x1 = (int)(x1*StepsPerMillimeterX);
y1 = (int)(y1*StepsPerMillimeterY);
float x0 = Xpos;
float y0 = Ypos;
// Let's find out the change for the coordinates
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.onestep(sx,STEP);
over+=dy;
if (over>=dx) {
over-=dx;
myStepperY.onestep(sy,STEP);
}
delay(StepDelay);
}
}
else {
for (i=0; i<dy; ++i) {
myStepperY.onestep(sy,STEP);
over+=dx;
if (over>=dy) {
over-=dy;
myStepperX.onestep(sx,STEP);
}
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 before any next lines are submitted
delay(LineDelay);
// Update the positions
Xpos = x1;
Ypos = y1;
}

// Raises pen
void penUp() {
penServo.write(penZUp);
delay(penDelay);
Zpos=Zmax;
digitalWrite(15, LOW);
digitalWrite(16, HIGH);
if (verbose) {
Serial.println("Pen up!");

}
}
// Lowers pen
void penDown() {
penServo.write(penZDown);
delay(penDelay);
Zpos=Zmin;
digitalWrite(15, HIGH);
digitalWrite(16, LOW);
if (verbose) {
Serial.println("Pen down.");
}
}
INKscape Design
Inkscape is used to design the plotted diagram or text. In this project by using this
software G-code file of a selected image or text is created G-code is a commonly used
numerical control programming language which includes X, Y, Z coordinates.

4.1 Creating G-Code File Using Inkscape


The CNC plotter of our project will work within 20cm×20cm area So we choose the
document properties of the Inkscape 40cmx40cm (Width × Height) which is four
times the working area of the plotter because the plotter can draw only in the first
quadrant. So we have initially kept the axes at the nearest end of the motors which is
considered as origin to easily modify the design. In Fig. 3 the working area of CNC
plotter is shown with the text written in the pre-defined area. The text is selected using
cursor and then select “object to path” from the drop down window to save the G code
form of the selected text. To create G-code of an image, the file must have a
transparent background. The image should be dragged into the selected area then
select “trace bitmap” from drop down window to create a transparent image. Scans
are selected as 8 and “Edge detection” is selected to create black & white image. After
adding this transparent image in the predefined area we`ve used “object to path”
command to create the G-code file of the selected image by following the steps
described earlier.
4.2 Processing
Processing is open source programming language software which is used for
electronic drawings. GTCRL processing program is used to send G-code file from
user interface to CNC plotter. The Fig. 6 shows the user interface of processing 2.2.1
software after running GTCRL program. The port of Arduino Uno is selected by
pressing „P‟ button on keyboard hence G button is used to upload our desired G-code
file. Immediately CNC machine will start sketching selected G-code file. Sketching
can be stopped by pressing X button.

Summary
In this chapter we described the main coding of mirror. It described
that how the main features of mirror work. How user interact with these
modules and what are the steps a user will take to achieve his target using
modules.
CHAPTER No:5
TESTING
3 Testing
In this chapter test case are designed to test the application.

3.1 Test case of CNC Drawing Machine


Table 1: Installation Working
TC#01 Date created:20/05/2019
Created by: Muhammad Umer
Requirement# 01

Description User will be able to install the application.

Steps Click/Touch Installation option

Step Type Description Expected Actual P/F

1 Test to pass User will be User login After Pass


able to install the successful
the application installation
application using his of
after getting gmail and application,
downloaded. can set his user will be
schedule. use
application.

Item Input Test Type Expected P/F Date


Result
1.1 Click/Touch Test to Pass. User can Pass 20/05/2019
Installation upload
Option. his/her
Schedule.

Executed on Executed by Passed/Failed

20/05/2019 Muhammad Umer Passed

This test case is designed to test working of installation option to check whether
these options are working perfectly or not.
I tried to install the application. I tested this case on android smart phone.
Table 2: Module Working
TC#01 Date created:20/05/2019
Created by: Muhammad Umer
Requirement# 01 Controller UI

Description User will be able to view all of option to change the schedule.

Steps After CNC Drawing Machine will be in front.

Step Type Description Expected Actual By

1 Test to pass Main A list of All the main Faisal


features schedule of features of Muneer
should work. the application.
application.

Item Input Test Type Expected P/F Date


Result
1.1 After CNC Test to Pass. Main Pass 20/05/2019
Drawing features
Machine will should work.
be in front.

Executed on Executed by Passed/Failed

20/05/2019 Faisal Muneer Passed

This test case is specially designed to check whether a list of schedules can be
added so that it can be viewed on CNC Drawing Machine. These drawing appear on
the right side of the paper.
I checked this test case on CNC Drawing Machine using pc.
Table 3: CNC Drawing Machine Working
TC#01 Date created:20/05/2019
Created by: Muhammad UMER
Requirement# 01 CNC Drawing installation

Description User will be able to see the modules and picture that he uploaded.

Steps After splach paper will be in front.

Step Type Description Expected Actual By

1 Test to pass Main A list of All the main Muhammad


features schedule of features and Umer
should work the modules of
application application.
and
modules.

Executed on Executed by Passed/Failed


20/05/2019 Faisal Muneer Passed

This test case is specially designed to check the working of smart mirror and its
modules work well.

CONCLUSION
In this paper we have presented the concept of a low cost three-axis mini CNC plotter.
The
existing CNC machines are of high cost, difficult to maintain and requires highly
skilled operators.
Our CNC plotter overcomes these problems. It is of low cost and easy to control and
there is no need of highly skilled operators. It can be used for long hours at a stretch
which is not possible in existing ones. It is hoped to extend this work for future
development.

FUTURE SCOPE
The pen of the machine can be replaced by a laser to make it work like a laser
engraving or cutting machine. Engraving machine can be used on wood. The pen can
also be replaced with a powerful drill so that it can be used for both milling and
drilling purposes. The servo can be replaced with a stepper motor and the pen with a
3-D pen to make it a 3-D printer which can print objects with dimensions. By
extrapolation of the axes, the working area of the machine can be extended keeping
the algorithm unaltered.

You might also like