Skip to content

Arduino code for the 2.5 axis draw bot I've been working on recently. Takes commands over serial to run.

License

Notifications You must be signed in to change notification settings

dankelley2/2ADrawBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. Servo 'UP' position defined in code as SERVO_UP

    • Example:"LIFT"
  • DROP : Activate Servo to Drop pen. Servo 'DOWN' position defined in code as SERVO_DOWN

    • Example:"DROP"
  • ZCHANGE : Toggles Servo position between up and down.

    • Example:"ZCHANGE"
  • 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
LIFT
HOME  
DROP
MR 1000 1000  
MA 2000 1000  
MA 2000 2000  
MA 1000 2000  
MA 1000 1000  
LIFT
MA 0 0  

LINE 1 - Limits draw area to 200mmX by 100mmY

LINE 2 - Sets max speed to 600 steps per second X and 400 steps per second Y

LINE 3 - Lifts pen off of paper

LINE 4 - Home carriage until endstops are hit, then go to (0,0)

LINE 5 - Lowers pen on to paper

LINE 6 - Move Right (X+) 10mm, and Down (Y+) 10mm

LINE 7..10 - Lines 7 through 10 draw a 1cm Square

LINE 11 - Lifts pen off of paper

LINE 12 - Moves back to (0,0), motors will be turned off automatically.

About

Arduino code for the 2.5 axis draw bot I've been working on recently. Takes commands over serial to run.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published