Skip to content

pilhuhn/xy-plotter

Repository files navigation

XY-Plotter

The plotter waits on its serial interface for commands.

Currently implemented commands are

  • s : manual mode. Pass in a path definition to make the plotter move.

  • E : enable the motors

  • D : disable the motors

  • C : continuous mode: see below

  • H : Go home - sets the plotter to its defined home point

  • u : pen up, raises the pen so that it does not draw

  • d : pen down, lowers the pen so that it draws

  • r<val>: set resolution to val steps per mm. Default is 160steps per mm

  • Q : emergency stop in manual mode

  • v<val> : set servo at passed int _val_ue

  • V : toggle verbose mode (default off)

  • R : toggle dry run (default off)

  • i : enable end switches

  • I : disable interrupts

  • z<c><val>: send z-Axis command c with value val. See zAxis.ino for more info

  • a<r>[,<start>,<end>] : arc (circle) with radius r. If start and end are given, an arc is created.

  • A<r>[,<start>,<end>] : arch like 'a', but current point is mid-point and not on the arc/circle

Path definition

Path commands are relative movements from the current position of the print head. The format follows:

    PIPE::= '|'
    SPACE ::= ' '
    XCHAR ::= 'X'
    YCHAR ::= 'Y'
    MINUS ::= '-'
    COMMA ::= ','
    NUM ::= ['0'-'9']
    PEN_UP ::= 'U'
    PEN_DOWN ::= 'D'

    radius ::= NUM+
    start :: NUM+
    end :: NUM+
    arc ::= ('A' | 'a') radius (COMMA start COMMA end)?
    item ::= (XCHAR | YCHAR) MINUS? NUM+
    move ::= item (SPACE item)
    segment ::= move | arc | PEN_UP | PEN_DOWN
    path ::= segment ( PIPE segment)*

where 'n' is a numeric digit.

Examples:

  • X30 - move 30 units on the X-axis

  • Y-2 - move -2 units on the Y-axis

  • X10 Y5 - move 10 units on the X-axis and also 5 units on the y-axis

  • X2 Y2|X-2 - first move 2 units on the X-axis and 2 on the y-axis. Then move -2 units on the X-axis

The units depend on the setting of the plotter. In my case 1 unit = 1mm.

Continuous mode

With the 's' command, the plotter expects one path definition, does the work and waits for a new command.

With continuous mode, the plotter only expects path segments after continuous mode was enabled. It processes the segments and then reads the next path from serial input. If it encounters -END it will stop and exit continuous mode.

Example to display the start of a Hilbert curve
C
X4 Y0|X0 Y4|X-4 Y0|X0 Y4|X0 Y4|X4 Y0|X0 Y-4
X4 Y0|X0 Y4|X4 Y0|X0 Y-4|X0 Y-4|X-4 Y0|X0 Y-4
-END

Plotter responses

The plotter responds with vaious kind of data. If it waits for more input it will reply with a text starting with OK. Debug output starts with D. If the plotter encounters an error it will repyl with ERR.

Releases

No releases published

Packages

No packages published