S18: XY-Plotter

From Embedded Systems Learning Academy
Revision as of 03:11, 23 May 2018 by Proj user12 (talk | contribs) (System Overview and Mechanism)

Jump to: navigation, search

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Project Title

XY-Plotter

Abstract

We live in an epoch where the world is driven by technology. In recent decades, there have been so many advances in the field of technology. With this advancement for human upliftment, automation has become a paramount factor. This project aims at building an automatic 2D XY-plotter which can efficiently draw 2D figures. The plotter machine is assembled based on a mechanism similar to H-bot where the two stepper motors are on the main chassis connected to the single belt. Both the motors account for the movement of the chassis in X and Y axis. A servo motor is used to control the pen height which is connected to the main chassis. Gcode interpreter is developed in order to make the SJ one board decode the G-code and control the motors accordingly. Sd-card is used to provide the Gcode to the SJ one board.

Objectives & Introduction

Computer numerical control (CNC) is the automation of machine tools by means of computers executing pre-programmed sequences of machine control commands. These machines find their use in any process that can be described as a series of movements and operations. These include 2D printing, laser cutting, welding, hole-punching etc.

XY plotter is a CNC(Computer Numerical Control) based drawing robot capable of drawing 2D figures. It uses LPC1758 ARM Cortex M3 based microcontroller(SJOne) as a brain of the robot. The SJOne board is interfaced to the motor shield PCB which connects two stepper and one servo motors. SD-card is selected to provide the 2D figures to the SJ one controller in the form of G-codes instructions. A G-code interpreter then decodes the instructions and generate the required movements for the stepper motor and servo motor. The home position for the plotter is specified using the limit switch.

The objectives of the project are:

  • To learn FreeRTOS multitasking and demonstrate it.
  • To acquire knowledge about intertask communication using queues.
  • To become competent in implementing device drivers like GPIO, SPI, PWM.
  • To make use of GPIO external interrupts and timer interrupt to connect with the limit switch.
  • To understand software watchdogs and apply the same to the project.
  • To learn mechanical aspects of rotating a motor through belts and pulleys.

Team Members & Responsibilities

  • Akshay Kurli
  • Gaurav Yadav
  • Pritam Gholap
  • Tanmay Kishore Jambhekar

Schedule

Week# Date Task Actual Problem Encountered
1 03/27
  • Research different mechanism for plotter assembling.
  • Requirement documentation. List out the parts required.
Completed on 03/31
2 04/03
  • Order Components
Completed on 04/08
3 04/10
  • Determine the required software for generating and visualizing the Gcode.
  • Read file from Sd-card and interpret single line G-code.
  • Completed on 04/11
  • Completed on 04/30
4 04/17
  • Test both the stepper motor and servo motor with the SJ one Board.
  • Design the PCB shield for servo and stepper motor.
  • Completed on 04/19
  • Completed on 04/23
5 04/24
  • Assemble the plotter machine.
  • Circuit testing on protoboard.
  • Calculate the relation between G-code values and PWM pulses on both the stepper motors.
  • Completed on 04/25
  • Completed on 04/27
  • Completed on 05/05
6 05/01
  • Develop the motor task to run both the stepper motors and servo.
  • Run the stepper motor according to interpreted G-code.
  • Test the plotter machine for drawing a straight line (Single line Gcode).
  • Completed on 05/01
  • Completed on 05/05
  • Completed on 05/08
7 05/08
  • Interface limit switch for determining plotter initial position.
  • Develop the interpreter task to read multi-line G-codes.
  • Establish communication between interpreter task and motor task.
In progress
8 05/15
  • Send board file for printing
  • Create tasks to plot different characters
  • Write the equation to draw lines at different angles
In progress

Parts List & Cost

Item# Part Desciption Vendor Qty Cost
1 SJOne Boards From Preet 1 $80.00
2 Nema-17 Stepper Motor Amazon 2 $28.00
3 Micro Servo Motor 9G Amazon 1 $2.6
4 GT2 Timing Belt and Pulley wheel Amazon 1 $14.99
5 Allegro’s A4988 DMOS Microstepping Driver Amazon 2 $
6 $
7 $
8 $
9 $
10 $
11 $

Design & Implementation

Following sections provide the implementation of hardware and its design. The software provides the infrastructure to manage and control the hardware.

System Overview and Mechanism

The XY plotter machine is based on a mechanism similar to H-bot where the two motors responsible for XY movements are on the main chassis, which keeps the center of gravity closer to the chassis for a better stability. Graphic animation of the mechanism used in the project is shown in figure 2 where linear motions of the violet slider along X and Y axes are controlled by orange and green driving pulleys depicting two stepper motors. The violet slider has a pen connected at the front. The movement of pen based on the motor rotation is shown in figure 3. Based on the front view, M1 and M2 represent two stepper motors on the left and right of the machine. For example to move the pen in the left direction on the X-axis, both the stepper motor should rotate in a clockwise direction with the same speed. The movement of pen based on the motor rotation is shown in figure 3. Based on the front view in figure 1, M1 and M2 represent two stepper motors on the left and right of the machine and the direction arrows shows the direction of the pen. For example to move the pen in the left direction on the X-axis, both the stepper motor should rotate in a clockwise direction with the same speed.

Figure 2. Pen Slider movement mechanism
Figure 3. Pen movement vs Motor Rotation

Printed Circuit Board (PCB)

Schematic and PCB Layout

PCB design is used to reduce the hardware complexity and complicated one-to-one wire connections. For this project, PCB designing was done using Autodesk's EAGLE 7.6.0. In this schematic of the board is done in which all the components are selected and general connections are done. After completing the schematics, it is converted to board file in which actual placement of components on board and routing of the signals is done. EAGLE provides features like auto routing, multilayer signal routing, converting the file specs in Gerber format for PCB printing and so on. In this project, the board was designed for interfacing two motor drivers and one servo motor with SJOne board. Before concluding the design, all the components were placed on a breadboard and tested to check their functionality separately and then all together. After checking the hardware requirement and its availability, the board design was finalized. The designed board consists of:

  • Board size is 60.96 mm X 80.01 mm
  • Voltage regulator to supply 5V to the servo motor and 3 pin connector for the same
  • 12V power supply for stepper motor
  • Two motor drivers interfacing SJOne
  • one 17 X 2, one 10 X 2 and one 8 X 1 pin connector for GPIO, 3.3V and GND from SJOne board

Track width for the signal is 0.016 mm and for the power signal, it is 0.024 mm. Package library of the A4988 driver was imported from the Sparkfun. The PCB design is then sent to PCB manufacturer with Gerber file.

  • PCB board layout

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.


Hardware Interface

GT2 Timing Belt and Pulley

A 2mm pitch and 6mm wide GT2 timing belt and pulley are used to transfer rotational motion (from a stepper motor) into linear motion (along with a rail). The figure 4 shows Timing Belt and Pulley alignment. With the H-bot mechanism described above, the two stepper motors on the main chassis are connected together with one GT2 belt with the help of two same-sized pulleys as shown in Figure 5.

Figure 4. GT2 Timing belt and Pulley
  • Calculation

Specification of the pulley used in this project is:

Number of teeth= 16;

Pitch = 2mm.

Therefore,as per the Figure 1 ,Circumference = pitch * number of teeth = 2 * 16 = 32mm.

NEMA 17 Stepper Motor

A stepper motor is one kind of electric motor used in the robotics industry, it converts electronic signals into mechanical movement each time an incoming pulse is applied to the motor.

Two NEMA 17 Stepper Motors are used to move pen assembly based on Hbot plotting mechanism, by the motion of the GT2 belt connected with these two stepper motors. Each pulse moves the shaft in fixed increments. NEMA 17 stepper motor has a 1.8° step resolution, then in order for shaft to rotate one complete revolution, in full step operation, the stepper motor would need to receive 200 pulses, 360° ÷ 1.8 = 200.

The belt moves along the circumference of the sprocket connected with the stepper motor shaft, for one complete rotation of the stepper motor the belt moves distance equivalent to 32mm, distance the pen assembly moves for each step (1.8°) of the stepper motor rotates is 32/(360°)*1.8° = 0.16 mm for every pulse received.

Pulses for motors are generated by setting both GPIO pins P2.0 and P2.3 to high for 1000 microseconds and low for next 1000 microseconds, this produces is a pulse with 50% duty cycle with frequency of 1000 Hz. Using full step resolution for both the stepper motors, for the pen to move a distance of 100mm in either axis the number of steps both the motors must take is 100 / 0.16 = 625 steps or 625 pulses at 1000 Hz.

To achieve even fine resolution and smoother motion of the motors, half, quarter, eight, sixteenth step operation can be used with NEMA 17 stepper motors. Micro stepping increases number of steps per revolution by a factor of 2^n (where n is the micro stepping factor).

For example half step n = 1/2, a single step will now become 1.8° * 2^(1/2) = 0.9, this doubles the number of required pulses ,so a 100 mm line along X or Y axis will now require 1250 pulses at 1000Hz.


Z axis Servo motor

The bracket holding the pen in place, can be moved up and down vertically using a servo motor. This mimics picking up the pen during drawing or writing with hand.

A SG90 9g digital servo motor is used for this. PWM input for the servo motor is given from pin P2.2 configured as PWM output on the SJ One Board.

For pen down, a PWM pulse of 1.5ms at 50 Hz, servo motor stays at the neutral position or 0°, the pen comes in contact with the surface and the plotter starts drawing.

For pen up, a PWM pulse of 2ms at 50Hz is input, servo motor rotates right, pen is picked up.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

Implementation

This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.

Testing & Technical Challenges

Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.

Include sub-sections that list out a problem and solution, such as:

<Bug/issue name>

Discuss the issue and resolution.

Conclusion

Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?

Project Video

Upload a video of your project and post the link here.

Project Source Code

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

List any references used in project.

Appendix

You can list the references you used.