2D Plotter Presentation


Published on

Published in: Automotive
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • مهمة اوى نقطة ان الماشين شغالة بال COMMANDS
  • 2D Plotter Presentation

    1. 1. CNC Machine 2DPlotter SupervisorD.R Eman ShabanT.A Mahmoud Fayez
    2. 2. Team Members….Hassan Awad Abd El-AzizMahmoud Mohamed Hussein Mahmoud Salah Salam Marwan Ezz El-Deen Mohamed Momen Gamal El-Deen
    3. 3. Agenda….• Introduction• History• System Features• System Architecture  Software subsystem  Mechanical subsystem  Electronic subsystem• Mode of Operation• Algorithms• Testing and Simulations
    4. 4. Introduction,,,,
    5. 5. Introduction CNC MachineComputer 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 .
    6. 6. Introduction Project Idea• Automation of 3 Motors to control the coordinates (X,Y,Z)of a pen with flexible head can be used as Plotter.
    7. 7. History  The first commercial NC machines were built in the 1950s, 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 withoutThe first commercial NC requiring constantwww.cnccookbook.com attention from their operator.
    8. 8. System Features…
    9. 9. System Features• Rapid speed positioning using G00• Plot line using G01• Plot Circles using G02,G03 clockwise or anti-clock wise.• Manual Mode control the position of the Plotter using Keyboard• Programming Mode write full program includes moving plotter, Arithmetic operation and decisions instructions
    10. 10. System Architecture
    11. 11. System Architecture
    12. 12. Software SubsystemUser InterfaceTerminal App Send G-Code Programs, Control InstructionInterpreter Move Motors Geometry Motors Kernel invokeConfigureTimers Timers
    13. 13. System Architecture cont Software SubsystemThere are 6 Main Software Modules• MotorLib.h : Configure, Monitor and Move Motors.• TimersLib.h : Configure periodic task.• Interperter.h : Parse G-line program separate tokens and execute instruction – [simple Arithmetic instructions ADD MUL]. – [Motor Instructions Operation G00,G01,G02,G03]. – [Decision instruction JEQ,JNE].
    14. 14. System Architecture cont. Software Subsystem cont. • UART.h – Serial communication port driver to send the G-code program and control instruction to the machine • BresenhamLineDrawing.h • MidPointCircleDrawing.h
    15. 15. System Architecture Mechanical Subsystem 3 Motors each one attached to AXIS (X,Y,Z)  Stepper Motor with the following Description  Step angle 1.8°  Holding Torque: 3.9 Kg.cm (40 N.cm)  Current 2 A  leads: 6 wires (4 per coils 2 COM)
    16. 16. System Architecture cont CNC Machine Mechanical Design: Figure-1 Different views of Our CNC Machine
    17. 17. System Architecture cont Electronic Subsystem  It consists of 8 bit At mega 328P microcontroller and stepper motor control drivers BAL 35 for controlling all the three stepper motors. Microcontroller generates necessary STEP and DIRECTION signals for each stepper motor controller to achieve desired speed and rotation. A RS 232 is used for communicating data between PC and microcontroller.
    18. 18. Control Modes• We have three types of control mode: -Calibration Mode (CL). -Load Mode (LD). -Execution Mode (EXE).
    19. 19. Control Mode instructionCommand DescriptionCL Manual ModeLD Program ModeSTART Executed the program stored on RAMEXE Read G_Line from serial and executed it immediately and acknowledge the next instructionRESET Reset the machine to the initial X_co,Y_co_Z_co coordinatesSETBX Set border of our board on X-axisSETBY Set border of our board on Y-axisSETBZ Set border of our board on Z-axis
    20. 20. State ChartState chart illustrates how to switch between modes
    21. 21. Machine Language Program instruction Command Description G00 Rapid speed X,Y,Z Vector. G01 .linear interpolation between 2 points Bresenham line drawing G02 Clockwise circular interpolation. G03 Anti Clockwise circular interpolation. 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.
    22. 22. Syntax Language Program• G00 <Operation> {X [R|I] #} {Y [R|I] #} {Z [R|I] #} EX: G00 XI1000 YI1000 ZI1000• G01 <Operation> {X [R|I] #} {Y [R|I] #} EX: G01 XI1000 YI500
    23. 23. Syntax Language Program cont.• G02 and G03 <Operation> {R [R|I] #} {Q [R|I] #} {C [R|I] #} EX: G02 RI4000 QI0• ADD and MUL <Operation> {R [R|I] n}, operand1, operand2 EX: ADD RR1,RR2,II100 ; RR1=RR2+100
    24. 24. Example of G-Code programsHello CNCCNC>Controll$LD ;the following program describe of “CNC” text with G-codeG02 RI5000 QI2 CI2 ;draw "C"G00 ZI1500 ;Lift PlotterG00 XI1500 YI-10000 ;space between charG00 ZI-1500 ;down PlotterG00 YI10000 ;draw "|"G01 XI5000 YI-10000 ;draw ""G00 YI10000 ;draw "|"G00 ZI1500 ;Lift PlotterG00 XI6500 YI-10000 ;space between charG00 ZI-1500 ;down PlotterG02 RI5000 QI2 CI2 ; draw "C”EOPSTART
    25. 25. Algorithms…
    26. 26. Bresenham Line Drawing G01 Implementation• Algorithm which determines which points in an n-dimensional raster should be plotted in order to form a close approximation to a straight line between two given points. It is commonly used to draw lines on a computer screen, as it uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in standard computer architectures.
    27. 27. Similarities between computer screen and Our board • Computer screen is divided into very small units called pixels and out board is divided into small movements called steps and we replaced the function of put pixel(X,Y); with step(Motor);Figure-2 Sub-pixel displayhttp://en.wikipedia.org/wiki/Pixel
    28. 28. ExampleCode written for screen Code written for Out machine)Put _pixel(X+1,Y+1 );Set_Direction(MotorX,Positive );Set_Direction(MotroY,Positive );parallerStep(MotorX,MotorY)put_pixel(X+1,Y Set_Direction(MotorX,Positive); Step(&MotorX);put_pixel(X,Y+1) Set_Direction(MotorY,Positive); Step(&MotorY);)Put_pixel(X-1,Y );Set_Direction(MotorX,Negative );Step(&MotorX
    29. 29. Example of Bresenham Line Drawing Bresenham for drawing Line 7° 60° 30° 45° Figure 3 our Implementation of Bresenham line drawing on Console Screen Different slope
    30. 30. Midpoint Algorithm G02,G03 Implementation• the Midpoint circle algorithm is an algorithm used to determine the points needed for drawing a circle actually drawing one octant but we draw the other using mirroring. The algorithm is a variant of Bresenhams line algorithm, and is thus sometimes known as Bresenhams circle algorithm.
    31. 31. Midpoint Algorithm Example Bresenhams Circle algorithmFigure-3 Rasterisation of a circle by the Bresenham algorithmhttp://en.wikipedia.org/wiki/Midpoint_circle_algorithm
    32. 32. G00 Implementation• Implementation phases – Enable Interrupt handler of Each Timer[0,1,2] – Configure Timer to trigger event (On_TimerOverFlow)(void**); when Timer overflow• The foreground program is free to do useful work as it is occasionally interrupted output operations.
    33. 33. Context switching between Motors on G00 command Foreground Foreground Step Step Step Time process process MotoX MotoZ MotoYFigure-4Context switching betweenStep(&MotorX),Step(&MotorY) andStep(&MotorZ)
    34. 34. Testing and Simulations…
    35. 35. Testing and Simulations… (PROTEUS) • We simulate the behavior of motors [#of performed step, frequency of the pulses] using PROTEUS simulator. It enables us to test and debug faster than the physical level. • DEMO OF PROTEUS
    36. 36. Testing and Simulations… (Final Demo) Start
    37. 37. THANKS 