Multicolor DrawBot

by tuenhidiy in Circuits > Arduino

20239 Views, 234 Favorites, 0 Comments

Multicolor DrawBot

Title_2.JPG
Title_1.JPG
Multicolor Drawbot

I have seen many versions of the COREXY Drawbots and almost no one has enabled "Homing" function for them, even though the design already had space to fit limit switches. Today, I'd like to share how a CoreXY Drawbot can draw colorful shapes or texts by enabling its "Homing" function.

Supplies

I would like to thank the JLCPCB for supporting me on this project. If you have a PCB project, please visit the JLCPCB website to get exciting discounts and coupons as follows:

Main materials:

⦾ 1set x 3D printed parts, available at: https://www.thingiverse.com/thing:2349232/files

⦾ 1pcs x Arduino UNO R3 or Combo Arduino + CNCShield + A4988.

⦾ 1pcs x Arduino CNC Shield V3 GRBL.

⦾ 2pcs x Stepper Motor Driver A4988.

⦾ 2pcs x Stepper motor NEMA 17.

⦾ 1pcs x SG90 Servo.

⦾ 2meter x GT2 6mm Timing Belt.

⦾ 2pcs x GT2 Timing Pulley 16 Teeth.

⦾ 2pcs x Round Shaft Diameter 8mm, Length 500mm.

⦾ 2pcs x Round Shaft Diameter 8mm, Length 400mm.

⦾ 2pcs x Linear rod M3 x 75mm, Z Axis. I reused these rods from old CDROMs.

⦾ 8pcs x LM8UU linear bearings.

⦾ 5pcs x Bearing 624zz.

⦾ 1pcs x M8-L530mm threaded rod and 4pcs x M8 nuts.

⦾ 1pcs x Power Supply 12/24VDC.

⦾ 2 meter x 8P/16P Rainbow Ribbon Cable.

⦾ 2pcs x Limit switches.

⦾ 1pcs x 5mm DC Female Power Plug.

⦾ 1pcs x Multicolor pen.

⦾ 2 meter x copper braided shield.

⦾ Some small cable ties, cable spiral wrap, M3 - M4 bolts and nuts.

3D Printed Parts and Pre-assembly

⦾ X supports

⦾ Top and bottom clamshells

⦾ Y front and back supports

⦾ Slider base

⦾ Slider and pen holder

⦾ Idle pulley and thumb screw

⦾ Arduino case

Assembly

Detailed assembly instructions are included in the Thingiverse link. I only mention the parts that need attention, especially how to install limit switches.

⦾ X limit switches

I firstly measured the distance from 2 x limit switches located on the X supports to Arduino box, then soldered their wires accordingly.

The limit switches should be mounted on the X supports before installing stepper motors.

I reused 2 old stepper motors which have short shafts, about 12mm so that limit switches can be mounted easily on the stepper motors head side without touching each other.

⦾ Clamshell (Y) limit switch

As above, the limit switch should be mounted on the top clamshell before assembling the top and bottom clamshell together.

Its cable is threaded through a rectangular hole available on the clamshell.

⦾ Pen holder

I printed 2 types of pen holders, one is for regular pen and the other is bigger for multi-color (multi-nib) pen.

I use one of my daughter's multicolored pens. It is about 22mm in diameter.

Cable Arrangement

I used a copper braided shield taken from a multi-cores control cable to cover all the drawbot's cables.

The cables of stepper motor, limit switch far away from control box and M8 bolt were all threaded into copper braided shield.

The servo and Y axis limit switch were also done in same way.

It looks pretty cool in the end!!!

Connections

My Drawbot cable connection is show as below:

Notes:

  • We can use 2 limit switches for X- and Y-, it is good enough for a drawbot.
  • If the limit switch wire is placed too close to the stepper motor wire, it can cause interference and give an incorrect stop signal.

GRBL Firmware

a. Enable CoreXY kinematics in GRBL firmware:

⦾ Download GRBL firmware files.

⦾ Copy GRBL to C:\Users\Administrator\Documents\Arduino\libraries\

⦾ Go to C:\Users\Administrator\Documents\Arduino\libraries\config.h. Uncomment the command line "#define COREXY" to enable CoreXY kinematics.

⦾ Homing Configuration: I have referred to https://github.com/gnea/grbl/wiki/Two-Axis-System-Considerations.

Homing configuration for my CoreXY Drawbot is as follow:

#define HOMING_INIT_LOCK // Comment to disable
...
#define HOMING_CYCLE_0 (1<<X_AXIS)  // COREXY COMPATIBLE: First home X
#define HOMING_CYCLE_1 (1<<Y_AXIS)  // COREXY COMPATIBLE: Then home Y
...
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
...
//#define HOMING_SINGLE_AXIS_COMMANDS // Default disabled. Uncomment to enable.
...
#define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
...
//#define HOMING_FORCE_POSITIVE_SPACE // Uncomment to enable.
...

b. Upload GRBL firmware to Arduino Uno:

Take note that we should modify GRBL's config.h file properly as mentioned above, before uploading the GRBL firmware to our Arduino.

⦾ Open Arduino IDE, from File menu click Examples ‣ GRBL ‣ grblUpload.

⦾ Select the correct Port and Board (Arduino Uno) ‣ Compile and Upload the code to Arduino Uno.

c. GRBL parameter:

Hard limits enable:

$21 = 1

Homing cycle enable:

$22 = 1

Homing direction invert:

$22 = 3

The parameter $22 is used to adjust the direction of the Drawbot's movement when performing "Homing". Specifically with my case, the Drawbot will move in order and direction as follows, when doing "Homing":

- In the X direction, my Drawbot move from left to right (towards the control box) until it hits the limit switch mounted on the left X support.

- In the Y direction, my Drawbot move from front to back until it hits the limit switch mounted on the clamshell.

- After "Homing", my Drawbot understands this position as the origin coordinate (0,0). Because I already enabled this function in Step 6.a via parameter "HOMING_FORCE_SET_ORIGIN" in the "config.h" file.

X & Y axis travel resolution ($100 & $101):

The X & Y stepper motors steps per revolution: 200.

Micro-stepping: 8.

No of pulleys teeth: 16.

Timing belt pitch: 2mm.

➽ $100 & $101 = (200 steps * 8 microsteps) / (2mm pitch * 16 teeth pulley) = 50 step/mm

Maximum spindle speed

$30 = 255

Drawbot Software

Inkscape 0.92.5 with its extensions:

With this plug-in, I can easily adjust the Servo up/down command (M03/ M05), as well as, the Servo up/down angle.

The servo up and down commands can be set to the same, for example M03, and they differ in angle:

  • Pen up: M03 S0.
  • Pen down: M03 S35.

⦾ Universal Gcode Platform (UGS).

When Arduino successfully connects to UGS, "ALARM" status will show up in "Controller State" tab and we will not be able to control the Drawbot until we press "Unlock" button in "Common Actions" tab. This tab name may be different, ex: named "Toolbox" in UGS 2.0.11.

This is mainly a safety feature to remind the user to home, since position is unknown to Grbl. We can also enable or disable via this command in "config.h" file before uploading to Arduino.

#define HOMING_INIT_LOCK // Comment to disable


After doing some jogging steps in X, Y axis and commanding servo to up and down in some specific angles, I click the "Home machine" tab to do "Homing" and set origin coordinates of Drawbot.

Testings

Test_1.JPG
Test_3.JPG
Test_2.JPG
Test_4.JPG

I used Inkscape and its extensions to export a "DOG" picture into 2 gcode files in outline and hatchfill format. And I used 2 different colors to draw the outline and hatchfill shapes. Simply for each color change I did a "Homing" to the Drawbot and they were done correctly.

  • Outline

  • Hatchfill

  • Result

By this way, I can split the image into several parts with different colors, same scale and origin position in Inkscape then output GCODE files. Just do "Homing" after changing color, Drawbot will do a good job. It's manual but also very interesting!!!

Conclusion

Thank you for reading my work!!!

Please LIKE, SHARE & SUBSCRIBE to my Youtube channel!