CNC Drawing Machine

by caliho in Workshop > CNC

928 Views, 4 Favorites, 0 Comments

CNC Drawing Machine

20220512_075353.jpg
stepper motor.jpg
micro servo.jpg
arduino uno.jpg
power supply.jpg
linear bearing.jpg
timing belt.jpg
stepper driver.jpg
switch.jpg
cnc shield.jpg
linear rail.jpg

Want a physical copy of a digital art piece with an authentic look that can't be replicated by a printer? This Arduino CNC drawing machine moves along its x-, y-, and z-axes to plot digital images and text onto paper and contains mechanical, electrical, and software components. Its function is largely aided by software that translate paths and images into GCODE for the machine to read.

Many thanks to my family members and to Ms. Berbawy, who provided resources and guidance for this project, which was created for her Principles of Engineering class and was based on the instructions of DIY Machines.

Process

  1. Take measurements of existing parts to design and print 3D printed components
  2. Assemble the x-, y-, and z-axes
  3. Connect the electronic components
  4. Download and set up the necessary software
  5. Test the hardware

Supplies

3D Printed Parts

xaxisidle.png
x powered.png
railmount.png
yaxisservo.png
yaxispen.png
penslider.png
servohornattachment2.png
Screenshot (5).png
Screenshot (6).png

These 3D printed parts allow for the attachment of other components, acting as "joints." The x-axis parts house the stepper motor that controls the machine's side-to-side movement, while the y-axis parts house the stepper motor that controls the back-and-forth movement. The rail mount connects these two axes. A micro servo on the y-axis servo end controls the z-axis, lifting the pen up and down using the servo horn attachment and the pen slider.

Necessary 3D printed parts:

  1. X-axis idle end
  2. X-axis powered end
  3. Rail mount
  4. Y-axis servo end
  5. Y-axis pen end
  6. Pen slider
  7. Servo horn attachment

These were printed using a Prusa Mini:

  • 0.15mm layer height
  • 40% infill

Part CAD and Assembly

b.PNG
a.PNG
c.PNG
d.PNG
e.PNG
f.PNG

The first step is to CAD the parts listed below while ensuring that each is able to attach to the bulleted list of parts listed underneath. I measured the bulleted parts as precisely as possible using dial calipers and CADDED those first before creating the parts I would 3D print. I used Autodesk Fusion 360 to model the machine's components and assemblies.


1. X-axis idler end: This is one of two parts that will be drilled into the wooden board to stabilize the machine. Its main purpose is to hold one end of the linear rail and to house the toothed pulley to be used for the x-axis movement. A small extrusion will also be needed for the x-axis limit switch to contact since the limit switches on the machine will allow it to locate its position.

  • Wooden board (wood screw x2)
  • Linear rail (M3 x 12 bolt and nut)
  • Toothed pulley (M3 x 18 bolt and nut)
  • (limit switch contact location)

2. X-axis powered end: This is the second part that will be drilled into the wooden board. It will hold the other end of the linear rail and house the x-axis stepper motor. A toothed pulley will need to be attached to the motor's shaft later on.

  • Wooden board (wood screw x2)
  • Linear rail (M3 x 12 bolt and nut)
  • Stepper motor (M3 x 6 bolts x4)

3. Rail mount: The rail mount rests on the linear rail block and clamps the ends of the x-axis timing belt. As a result, this 3D printed part will move along the x-axis as the machine moves. The y-axis stepper motor is housed here, and the y-axis timing belt will move along the toothed pulley attached to the motor's shaft and the idler pulley also housed in the rail mount. Linear bearings fitted into this part will hold the long metals rods that will guide the y-axis movement. The x-axis and y-axis limit switches are also housed here.

  • Linear rail block (M3 x 6 bolt x4)
  • X-axis timing belt
  • Stepper motor (M3 x 6 bolt x4)
  • Idler pulley (M3 x 12 bolt and nut)
  • 8 x 15 x 45 linear bearing x2
  • Limit switch x2

4. Y-axis servo end: One end of the long metal rods and one end of the y-axis timing belt will be attached to the y-axis servo end. The micro servo will lie on its side, ensuring that there is enough room for the servo horn and servo horn attachment. An extrusion will be needed for the y-axis limit switch to contact.

  • 350mm metal rod x2
  • Y-axis timing belt
  • Micro servo
  • (limit switch contact location)

5. Y-axis pen end: The other end of the rods and the y-axis timing belt is attached here. A location for a linear bearing will be needed for the metal rod that will guide the movement of the z-axis along a toothed pulley.

  • Y-axis timing belt
  • 350mm metal rod x2
  • 8 x 15 x 25 linear bearing
  • Toothed pulley (M3 x 18 bolt and nut)

6. Pen slider: The metal rod that guides the z-axis movement is attached to the pen slider, along with one end of the z-axis timing belt. When moving up and down, there should be minimal side-to-side movement, which can be ensured by using a rectangular shape instead of a circular one. The pen or other drawing device can be attached by housing M3 nuts on the inside of the part and inserting M3 bolts from the outside.

  • 100mm metal rod
  • Z-axis timing belt
  • Pen/pencil (M3 x 25 bolts and nut x2)

7. Servo horn attachment: This part fits onto a one-sided micro servo horn to hold the other end of the z-axis timing belt so that the servo can pull the pen slider up and down.

  • Micro servo horn
  • Z-axis timing belt

Tips:

*Use hole sizes of 3.4mm for the M3 bolts (if printed on a Prusa Mini with a 4mm nozzle)
**For the timing belt attachment areas, use enough of an offset that the center extrusion doesn't break apart when the belt is removed, and align the components so that the belt is parallel to its corresponding axis (the z-axis timing belt should be parallel to the y-axis).

Wooden Base Board

20220227_155942.jpg
20220227_155423.jpg
20220227_160547.jpg
20220227_161520.jpg

Use a circular power tool to cut a wooden board to approximately 15in x 17in

Materials used:

  • Circular power tool
  • 14.75in x 28in wooden board
  • Smaller wooden board with a length of at least 15in
  • 2 clamps
  • Tape measurer
  • Gloves
  • Pencil
  • Crates/table

Steps:

  1. Draw a vertical line at 17in on the large wooden board.
  2. Align the power tool onto the line drawn.
  3. Align the smaller board on the left of the tool to use as a guide.
  4. Clamp the boards together.
  5. Ensure the part of the board that will be cut off is not on top of the crates/table.
  6. Adjust the blade position in the power tool so that the protruding part is only slightly longer than the thickness of the board.
  7. Put on gloves and power on the tool.
  8. Cut with a steady speed and motion.

Electronics Testing

20220310_165927.jpg
20220316_211628.jpg
switchtest.png
20220316_203948.jpg
servotest.png
20220317_075815.jpg
20220322_174605.jpg
20220324_175732.jpg
20220324_183501~2.jpg

The three main electronic components of this machine are the limit switches, the micro servo, and the stepper motors. These tests ensure that the parts, especially if they aren't new, are working as they're supposed to. Testing them before completely assembling the machine allows for a better understanding of how the components work and interact and prevents any major issues during the full test.

Limit switch testing:

1. Set the multimeter to 200Ω. The following should be observed (this can also be used to determine the identity of each terminal if they aren't labeled):

  • When the probes are in contact with the common and normally open terminals, there's a reading when the switch is pressed.
  • When the probes are in contact with the common and normally closed terminals, there's a reading when the switch is not pressed.

2. Connections to the Arduino board:

  • Common → ground
  • Normally open → any digital pin
  • The code used for switch testing prints "UNTOUCHED" or "TOUCHED" on the serial monitor depending on the state of the switch

*Debounce time = the amount of time that must pass before the switch can be pressed again for a response

Micro servo testing:

1. Connections to the Arduino board:

  • Brown = ground wire → ground
  • Red = power wire → 5V output
  • Orange = signal wire → any digital pin

The code used for micro servo testing (Arduino IDE → File → Examples → Servo → Sweep) turns the servo from 0° to 180°, pauses, turns it from 180° to 0°, pauses, and repeats.

Stepper motor testing:

1. Determine the stepper motor pinout if the model number is unknown or the datasheet is unavailable:

  • Set the multimeter to 200Ω. There should be a reading when paired pins are in contact with the probes. Male-to-female jumper wires can be used for testing, with the female ends on the pins and the male ends in contact with the multimeter probes.
  • Additionally, when paired pins are in contact, there should be resistance when turning the motor. When each pin is connected to its pair, the motor should be very difficult to turn.
  • The stepper motor wires should be aligned so that the end connecting to the CNC shield has each pin next to its pair. This isn't always the case since different stepper motors have different pinouts, so the wire order may need to be carefully changed.

2. Connections to the CNC shield and Arduino board:

Materials:

  • 2 stepper motors
  • 2 stepper motor wires
  • 2 stepper drivers and 2 heat sinks
  • 1 CNC shield
  • 1 Arduino board and USB (for the final electronics connections, the Arduino Uno should be used for compatibility with the CNC shield, but for testing, a different board can be used, such as the Arduino Mega 2560)
  • 12V power supply or 12V battery and wires

Stack (from bottom to top): Arduino board, CNC shield, stepper drivers (on the x and y locations of the shield), heat sinks

Adjust the current limits of the stepper drivers (current ratings can be found on the stepper motor's datasheet)

  1. Turn the screwdriver clockwise all the way on the potentiometer of the stepper drivers to set the current limit to 0 before plugging in or turning on the power supply and plugging the Arduino into the computer.
  2. Set the multimeter to 20V DC.
  3. One multimeter probe contacts ground while the other one clamps to the screwdriver using an alligator clip.
  4. Turn the screwdriver counterclockwise to increase the limit with the power supply on and the Arduino plugged in.

*The current limit should be set close to but below the current rating since too low of a setting could cause missteps and lower precision while a higher setting could cause overheating. (DRV8825 stepper driver: VREF = 2 x current rating, A4988 stepper driver: VREF = 8 x current rating x current sense resistance)

The code used for stepper motor testing rotates the motor.

Soldering

20220320_181025.jpg
20220320_170904.jpg
20220320_173401.jpg
20220320_173111.jpg
20220320_181150.jpg

Solder wires onto the limit switches to allow for a connection to the CNC shield.

  1. Solder a female-to-male connector to each of two electrical wires (use different colors for differentiation such as one black and one white) with the connector part on the male end removed.
  2. Since the electrical wire was in a twisted pair, a multimeter was used to identify the individual wires.
  3. Solder the remaining ends of the electrical wire to the common and normally open terminals of each limit switch.
  4. End result: a black wire with a female end connected to the common terminal and a white wire with a female end connected to the normally open terminal of each limit switch

Physical Part Assembly

20220512_075944.jpg
20220512_075829.jpg
20220512_075900.jpg
20220316_170944.jpg
20220512_080004.jpg
20220512_075621.jpg
20220512_075701.jpg
20220512_080042.jpg
20220512_075441.jpg

The assembly will be easiest if done in this order:

  1. X-axis (x-axis idle end, x-axis powered end, rail mount)
  2. Y-axis (y-axis servo end, y-axis pen end)
  3. Z-axis (pen slider, servo horn attachment)

*Epoxy glue can be used to join the 3D printed parts to the linear rods (and the linear bearings if needed), but tape is strong enough to keep the components together during testing.

Finally, drill the x-axis idle end and x-axis powered end into the wooden board, making sure that the range of the pen doesn't go off the board.

Electronics Connections

20220512_075521.jpg
20220412_164215.jpg
20220320_183625.jpg
20220512_080108.jpg

Stack the stepper drivers, CNC shield, and Arduino board in the same way as during stepper motor testing.

X-axis limit switch

  • White wire → X- white column
  • Black wire → X- black column

Y-axis limit switch

  • White wire → Y- white column
  • Black wire → Y- black column

Micro servo (if the wires aren't long enough, use male-to-female connectors to extend the lengths)

  • Brown wire → GND
  • Red wire → 5V
  • Orange wire → Z+ white column

Stepper motors

  • Corresponding axes

*Use electrical tape to group and organize the wires

GRBL

2.PNG
Screenshot_20220413-074958_Gallery.jpg
20220512_080436.jpg

Install the GRBL library in Arduino IDE.

  1. Open the serial monitor.
  2. Set the band rate to 115200.
  3. Type "$$" in the serial monitor to show the configuration.
  4. Edit the configuration as needed (ex. $100 and $101 can be changed using the formula: previous steps/mm x inputted distance ÷ distance traveled = updated steps/mm).

Important commands:

  • "$H" = homing (moves the axes towards the limit switches until contact is made, then "bounces" off)
  • "M3 S90" raises the z-axis
  • "M5" lowers the z-axis
  • "G92 X0 Y0" sets the origin at the ends of the x- and y- axes ("$H" followed by "G92 X0 Y0" should be performed every time before starting a drawing)
  • "G00" = rapid positioning (linear movement at maximum speed)
  • "G01" = linear interpolation (linear movement at a set feed rate: G01 X# Y# F#)
  • "G02" = circular interpolation clockwise (set endpoint and center point offset: G02 X# Y# I# J#)
  • "G03" = circular interpolation counterclockwise
  • "G20" = sets feed rate units to in/min
  • "G21" = sets feed rate units to mm/min
  • "G28" = return home
  • "G90" = absolute mode
  • "G91" = relative mode

To draw the boundaries of the drawing space:

  1. M3 S90
  2. $H
  3. G92 X0 Y0
  4. M5
  5. G1 X0 Y215 F2000
  6. G1 X210 Y215 F2000
  7. G1 X210 Y0 F2000
  8. G1 X0 Y0 F2000

After the boundaries are determined, use a pencil to mark the paper placement on the wooden board for future reference.

Chilipeppr

3.PNG
json.png
testrun.png
20220516_214146~2.jpg

Chilipeppr GRBL can be used to send GCODE automatically instead of having to input commands line by line.

  1. Install a serial port JSON server for a connection to the Arduino.
  2. Open the application.
  3. Click "Home Axis" in the axes window.
  4. Click "Zero Out" to reset the coordinates.
  5. Import the test drawing created by DIY Machines.
  6. Press start at the upper left to perform a dry run.

G Code Generators

snoopyinkscape.PNG
snoopygrbl.PNG
SnoopyDrawing (2).jpg
CNC Drawing Machine

Drawings can be created on Inkscape, CadSoftTools, DFX2GCODE, and other GCODE generating software, then translated into GCODE on Chilipeppr.

Inkscape settings to change:

  • Download the MI Inkscape Extension by DIY Machines
  • File → Document Properties for units and dimensions
  • Stroke Style and Fill
  • Path → Object to Path → MI GRBL Z AXIS Servo Controller → MI GRBL Z AXIS Servo for servo up (M5), servo down (M3), x-axis speed (10000), y-axis speed (4000), angle for servo (90), and delay (0.2)

Possible Inkscape actions:

  • Import drawings and convert into paths
  • Freehand or using paths
  • Shapes
  • Combine/merge shapes

Using these software, any shape or digital image can be drawn by the CNC drawing machine. You can now create original artwork produced by a machine!