Giter Club home page Giter Club logo

me_405_plotter's Introduction

ME 405 Pen Plotter

Ryan Ghosh and Ryan Flaherty (mecha18)

ME 405-03

Pen Plotter

Introduction

For our ME 405 term project, we designed, built, and programmed a polar pen plotter. A Nucleo board on the plotter reads an hpgl file, converts the commands to motor positions, and controls the stepper drivers to make the plotter draw. Meanwhile, a PC receives the commands over UART to draw the same shapes on the screen in sync with the plotter.

The following videos show the plotter in action:

Python Code

Documentation

Source code

CAD Files

SolidWorks files for the pen plotter can be found here.

STL and DXF Files

All custom parts for the plotter are either 3D-printed or laser-cut.

3D-Printed Files

All stl files can be found in the STLs folder.

In each filename, _x# indicates the quantity required, and _rev# indicates the revision number.

Laser-Cut Files

The base for the plotter should be laser-cut from 3mm or 0.125" thick material. The dxf file can be found in the DXFs folder.

Bill of Materials

The following table contains all the parts you need for the pen plotter that are not either 3D-printed or laser-cut:

Item # Description Quantity Source
1 1515 Extrusion (300mm long) 3 Amazon
2 MGN12C Rail (240mm long) 1 RobotDigg
3 NEMA17 Stepper Motor 2 Printed Solid
4 2GT 20T Toothed Idler (for 9mm belt) 1 Printed Solid
5 2GT 20T Pulley (for 9mm belt) 2 Printed Solid
7 6201 Bearing 2 AliExpress
8 5x25mm Shaft 1 AliExpress
9 3x20mm Shaft 3 Misumi
10 5x7x0.5mm Shim 2 AliExpress
11 Omron D2F-L Microswitch 3 Digikey
12 M3 Square Nut (DIN 562) 36 McMaster-Carr
13 M3 x 8mm Socket Head Cap Screw 59 McMaster-Carr
14 M3 x 10mm Socket Head Cap Screw 5 McMaster-Carr
15 M3 x 12mm Socket Head Cap Screw 12 McMaster-Carr
16 M3 x 20mm Socket Head Cap Screw 2 McMaster-Carr
17 M3 Heat-Set Insert (M3 x D5.0 x L4.0) 27 AliExpress
18 M3 Washer (narrow) 8 McMaster-Carr
19 M3 Washer (large) 4 McMaster-Carr
20 36mm Round NEMA14 Stepper 1 Printed Solid
21 M5 x 45mm Socket Head Cap Screw 1 McMaster-Carr
22 M2 x 12mm Pan Head Self Tapping Screw 6 AliExpress
23 M5 Locknut 1 McMaster-Carr
24 Unthreaded Bumper 4 McMaster-Carr
25 Nucleo-L476RG 1 Digikey
26 TMC2208 Stepstick 3 Amazon
27 Stepper Driver Board 2

Wiring

Stepper Driver Board #1

Signal Nucleo Pin Color
EN1 C2 red
EN2 C3 green
GND GND black
3V3 3V3 gray
CLK PB6 brown
CS1 PB8 yellow
CS2 PB9 orange
SCK PB13 (SPI2_SCLK) blue
MOSI PB15 (SPI2_MOSI) white
MISO PB14 (SPI2_MISO) purple

Stepper Driver Board #2

Signal Nucleo Pin Color
EN1 C6 blue
GND GND green
3V3 3V3 yellow
CLK PB6 brown
CS1 C7 orange
CS2 3V3 white
SCK PB13 (SPI2_SCLK) blue
MOSI PB15 (SPI2_MOSI) white
MISO PB14 (SPI2_MISO) purple

Limit Switch Wiring

The wires should be soldered to the outermost legs on the limit switches so that they are normally closed.

Endstop Stepper Board # Pin
theta 1 REFL1
radius 1 REFL2
pen up/down 2 REFL1

Stepper Driver Board Jumpers

To set the TMC2208 drivers to use 8 microsteps, jumpers should be placed on the JP6 and JP7 headers to short MS1 and MS2 to GND.

Setting VREF

To calculate the VREF values to set on the TMC2208 drivers, the desired RMS current should be multiplied by 1.41 ohm.

The following table shows the VREF values we used:

Motor Target RMS Current (A) VREF (V)
theta 1.13 1.59
radius 1.13 1.59
pen up/down 0.35 0.49

Wiring Example

Wiring Example

Task Diagram

Task Diagram

Kinematics

Since our pen plotter uses one motor for controlling the angle of the arm and another to control the radius, we had to use inverse kinematics to determine the motor angles needed to get the pen to the target x and y coordinates. We used the Newtom-Raphson algorithm to find the required motor angles to reach the target position. The following images show the steps we took to find the matrices and equations we would use in the algorithm:

  1. Simplified schematic of the robot with links and pivots
  2. Forward kinematics: determine x = f(theta), where theta is the motor angles and x is the pen position
  3. Find the Jacobian matrix for the system
  4. Differentiate x = f(theta) with respect to time to find velocity
  5. Find g(theta), where g(theta) = x - f(theta) and x is a constant target position. Then differentiate g with respect to theta.

We then used these equations in the NewtonRaphson function in tasks.py to convert pen positions read from the hpgl file into motor angles.

Kinematics steps 1-2

Kinematics steps 3-5

Program Flow

tasks.py contains the main function that runs on the Nucleo. The program proceeds in the following steps:

  • Read an hpgl file and split it into separate commands
  • convert target positions into millimeters
  • Interpolate between points so that the minimum distnance between any two points is less than or equal to MAX_MM_DIST (which we set to 0.5mm)
  • Use Newton-Raphson to convert the positions to theta angles for the motors
  • Convert theta angles to numbers in units of microsteps that can be sent to the TMC4210s as the X_TARGET
  • Configure the TMC4210 and TMC2208 chips
  • Home all three steppers
  • Wait for a button press
  • Start the two tasks:
    • task_cmds: reads through the commands and sends them to the TMC4210s
    • task_comms: sends the current command to the PC via UART to be plotted on the screen
  • Disable the motors once the end of the command list has been reached

More details on the individual functions can be found in the documentation for the python files.

me_405_plotter's People

Contributors

rsghosh avatar ryanpflaherty avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.