Arduino code for the 2.5 axis draw bot I've been working on recently. Takes commands over serial to run.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
SerialCommander
cmd
2ADrawBot.ino
LICENSE
README.md

README.md

2ADrawBot

Arduino code for the 2.5 axis draw bot I've been working on recently. Takes commands over serial to run. "SerialCommander" processing sketch runs command files generated by https://github.com/dankelley2/PlotterGen

img_9203

Sending Commands

Upon boot, the arduino will request a command by sending CMDREQUEST over serial.
That is your key to type or send the next command. The arduino will immediately send another CMDREQUST until
the commandBuffer (CommandBuffer class, cmd library) has stored 10 commands. This allows you to input more commands while the first command is still running.

To avoid too many string -> floating point conversions on the arduino, all distance related numerical command arguments (SPEED and STEPLEN commands have a different input) should be "distance in mm * 100". This allows you to use up to 1/100th of a mm for precision, while keeping the code clean and free of decimal places or scientific notation

Valid Commands are in the following format:

COMMAND {newline}

or

COMMAND X_NUMBER Y_NUMBER {newline}

Commands:

  • MA : Move Absolute. Moves to an absolute position.

    • Example:"MA 11053 5075" Moves to the absolute position (110.53mm, 50.75mm)
  • MR : Move Relative. Moves to a position relative to the current position.

    • Example:"MR 1000 -2500" Moves the relative position 10.00mm on the x axis and -25.00mm on the y axis
  • STEPLEN : Sets the number of steps per MM on the X and Y axis

    • Example:"STEPLEN 2325 6451" Sets steps per MM on X axis to 23.25, and steps per MM on Y axis to 64.51. If more precision is needed, edit the defaults in the arduino sketch file
  • SPEED : Sets the maximum speed in steps per second. This is the only command that takes areguments as integers.

    • Example:"SPEED 600 400" Sets speed on X axis to max 600 steps per second, and speed on Y axis to max 400 steps per second.
  • LIFT : Activate Servo to Lift pen. Not yet implemented.

    • Example:"LIFT"
  • LIMITS : Set x and y limits (dimensions) of draw area defaults are 200mm X by 100mm Y

    • Example:"LIMITS 20000 10000" Sets the size of the draw area and limits maximum travel to 200mm X by 100mm Y
  • HOME : Moves the X axis in a positive direction (right) until hitting an endstop (PIN_INPUT3), then moves Y in a negative direction until hitting an endstop (PIN_INPUT4), then moves back to the coordinates (0,0).

    • Example:"HOME"
  • Z : Zero; Sets the current coordinates as (0,0)

    • Example:"Z"
  • POS : Get current position in MM and print them via serial

    • Example:"POS"
  • ON : Turns on outputs to stepper motors (Note: this is done automatically for MA and MR commands)

    • Example:"ON"
  • OFF : Turns off outputs to stepper motors (Note: this is done automatically for MA and MR commands)

    • Example:"OFF"

Example Code:

SPEED 600 400  
HOME  
MR 1000 1000  
MA 2000 1000  
MA 2000 2000  
MA 1000 2000  
MA 1000 1000  
MA 0 0  
  1. Limits draw area to 200mmX by 100mmY
  2. Sets max speed to 600 steps per second X and 400 steps per second Y
  3. Home carriage until endstops are hit, then go to (0,0)
  4. Move Right (X+) 10mm, and Down (Y+) 10mm
  5. Lines 5 through 8 draw a 1cm Square
  • Last line moves back to (0,0), motors will be turned off automatically.