Tuesday, July 10, 2012

CNC Machine 2D Plotter

CNC Machine 2D Plotter

Document content

o   Abstract
o   Introduction
o   History
o   System Features
o   System Architecture
o   Mechanical subsystem
o   Electronic subsystem
o   Software subsystem
o   Terminal App
o   Interpreter
o   Timer
o   Geometry Kernel
o   Motor Library
o   Testing and Deployment

 Abstract 

CNC Machine 2D Plotter (AVR C, C#): 

o   Aims to automate Plotter to produce images by moving a pen held by structure that can move the pen in two orthogonal directions the plotter can raise and lower the pen as required to create the desired image. 
o   This is done using Ardiuno, Stepper Motor and Geometric Algorithm such as bresenham's line drawing algorithm and midpoint circle drawing the system was tested and simulated under proteus

Introduction 

Computer numerical control (CNC) machines are automated milling machines that make industrial components without human assistance. This is possible because CNC machines are fed a series of instructions that are delivered to an internal computer controller. These instructions are in the form of codes that belong to the numerical control programming language.The code used to program CNC machines is generically called  G-code. However, G-code instructions are only part of the programming language. Specifically, G-codes give CNC machines the coordinates.


History 

The first commercial NC machines were built in the 1950's, and ran from punched tape.
CNC, and later CNC, allowed for tremendous increases in productivity for machine tools because the machines could be run automatically without requiring constant attention from their operator.

                   

The first commercial NC

 System Features

  Modes of control:

     -Calibration Mode (CL) Manual Mode controls the position of the plotter X,Y,Z
     -Load Mode (LD) Stores a program written with language similar to G-code and execute it using START instruction this mode has a restriction that the size of program must not exceed 20 instruction.
     -Execution Mode (EXE) communication protocol happened through serial UART. the micro-controller sends an acknowledge with the state of program and the ID of the next instruction should be executed and wait for the PC to send it. Using this mode allow us to write a program larger than 20 instructions as the whole program will be saved on the Computer memory

The following table describes the control commands with its specification



Command
 Description
CL
 Manual Mode using W,S,A,D,Q,Z buttons on the keyboard
LD
Load  Program on the micro-controller RAM
START
 Execute the program stored on the RAM of micro-controller
EXE
Read G_Line from serial and executed  it immediately and  
acknowledge the next instruction and state of  the program
RESET
Reset the machine to the initial X_co,Y_co_Z_co coordinates
SETBX
 Set border of our board on  X-axis
SETBY
Set border of our board on Y-axis
SETBZ
Set border of our board on Z-axis

§ Language specification XG-code


Array of lines responsible for telling the machine what to do Arithmetic/decision/moving plotter instructions we don't implement the standard of G-code so we call it XG-code


Command Description
G00 Rapid speed positioning X,Y,Z Vector.
G01 linear interpolation between 2 points Bresenham line drawing.
G02 Clockwise circle using Bresenham circle
G03 ANTI-Clockwise circle using Bresenham circle
ADD ADD operand [2] and operand [3] then put result set on Operand [1].
MUL MUL operand [2] and operand [3] then put result on Operand [1].
JEQ Jump if flag is set.
JNE Jump if flag is reset.
CMP Compare operand [1] and operand [2] and set Equal flag.
EOP End of program.




                                            




   

 CNC 2D Plotter DEMO