https://github.com/pilhuhn/xy-plotter
Arduino-code for my XY-plotter
https://github.com/pilhuhn/xy-plotter
arduino plotter stepper-motor
Last synced: 10 days ago
JSON representation
Arduino-code for my XY-plotter
- Host: GitHub
- URL: https://github.com/pilhuhn/xy-plotter
- Owner: pilhuhn
- License: apache-2.0
- Created: 2018-01-03T11:22:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-01T15:36:23.000Z (over 4 years ago)
- Last Synced: 2025-04-15T01:53:36.473Z (10 days ago)
- Topics: arduino, plotter, stepper-motor
- Language: C++
- Size: 61.5 KB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= XY-Plotter
Software for my plotter, first described at http://pilhuhn.blogspot.com/2018/01/homegrown-xy-plotter-with-arduino.html
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: set resolution to _val_ steps per mm. Default is 160steps per mm
* Q : emergency stop in manual mode
* v : 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: send z-Axis command _c_ with value _val_. See zAxis.ino for more info
* a[,,] : arc (circle) with radius _r_. If _start_ and _end_ are given, an arc is created.
* A[,,] : 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-axisThe 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`.