# CNC Drawing Arm

20,002

251

16

This instructable describes an A3 robotic drawing arm that doubles as a plotter.

The drawing arm has 2DOF (degrees of freedom) and is made from two stepper motors, a few GT2 timing-belts and pulleys, and some flat aluminium bars. An SG90 servo is used to raise and lower the pen.

The metal-work is simple ... all you require are a few twist drills and a hacksaw.

The plotter has an on-board interpreter that recognizes the g-code output from "Inkscape"

Providing you don't have any wobbly joints the resolution and accuracy of this plotter is excellent.

The opening photo shows the fully assembled arm. Next a source image is converted to a "sobel outline" [1]. Finally the gcode for the "sobel outline" is sent to the plotter [2]. The last photo shows the completed image.

Keep in mind that the final image has been magnified ... 1 image pixel equals 0.5mm !

## Step 1: Theory

The drawing arm is a simplification of the dual arm plotter first described in https://www.instructables.com/id/CNC-Dual-Arm-Plo...

The calculations used in that plotter are shown in the first diagram.

How the drawing arm evolved

Belt drives were added to the dual-arm plotter to improve its resolution. These modifications are described in https://www.instructables.com/id/CNC-Dual-Arm-Plot...

The addition of belt drives allows the motor offsets to be the same. In doing so a "rhombus" is formed, as shown by the black construction lines in the remaining diagrams.

This project uses the following properties (there are more) of a rhombus:

• the diagonals always cross at right-angles
• the diagonals bisect each other
• the opposite sides are parallel

Providing we keep the opposite sides parallel, we can move the motor 2 arms to the positions shown in blue.

We now have a robotic arm.

The calculations are not affected.

This plotter configuration has the following advantages over the above dual-arm plotters:

• greater plotting area (no elbow conflicts with the opposite motor)
• motor 2 shoulder arm is shorter
• the pen-holder is simpler
• no joint at the pen-holder

This plotter configuration has the following disadvantages over the above dual-arm plotters:

• any motor 2 joint movement is magnified due to pantograph action.
• there is more leverage on the shaft of motor2 due to the shaft-extender.

## Step 2: Circuit Diagram

The above circuit shows two 12 volt stepper motors [1] connected to Big EasyDriver controllers set to 16 times micro-stepping.

Adjust each motor current, in turn, to 400mA by rotating the Big EasyDriver potentiometer while monitoring the current drain shown on the CPS-3205 power supply.

[1]

An alternate circuit using 6 volt stepper motors and EasyDriver controllers set to 8 times micro-stepping is shown in instructable https://www.instructables.com/id/CNC-Dual-Arm-Plo...

If you choose to use 6 volt steppers, the supply voltage must be reduced to 6 volts. You will also need to adjust the motor currents to 600mA and the following code definitions to:

#define STEPS_PER_DEG 6400/360

DELAY_MIN = 5000,

## Step 4: Drilling Template

The main arms are made from 25mm x 3mm flat alumium bar'.

The 300mm tie bar can be narrower.

Each joint is sleeved with a tubular 3/16 inch spacer that is 6mm in length. The spacer is sandwiched in place by means to two 3mm washers and a 3mm nut and bolt.

The 6mm spacer must protrude slightly if the bars are to rotate freely when the 3mm nut and bolt is tightened. To achieve this simply reduce the thickness of one bar at each joint.

The drawing arm is made from 25mm x 1mm flexible aluminium bar. This allows the SG90 servo to raise the pen.

The pen holder is formed by making two bends in the 25mm x 1mm bar. The fold lines shown in the template are 20mm apart.

A 4mm nut and bolt is used to retain the pen in place. Finger pressure is all that is required.

The total "reach" of the arm is close to 600mm which is suitable for drawings up to A3 in size.

## Step 5: Assembling the Arm

Photo1 shows the pen-lift and pen-holder assembly. Pen-lift is possible due to the flexibility of the 1mm thick aluminium arm. The pen is held in position by means of a finger-tight 4mm nut and bolt.

Photo 2 shows the arms cut and drilled to length [1]. The tubluar spacers that create a smooth low-friction joint are shown in this photo.

Photo 3 shows a birds-eye view of the assembled arm.

[1]

The two 3mm holes for attaching the 1mm thick drawing arm to the 3mm thick elbow are shown at 90 degree to the drilling template. Either way works but the template provides more clearance for the 3mm bolt heads.

## Step 6: Position the Motors and Spindle

Create a drilling template for the motor holes. I used "masking tape" as shown in the first photo.

Draw a center-line at the top of the board then drill the corner holes for the motors. The holes shown in the second photo are spaced 10mm either side of the center-line and 10mm from the top edge of the base-board [1].

Drill clearance holes for each motor shaft.

Place a GT2-200 timing belt over both pulleys as shown in the second photo. Mark the position of the bolt on the center-line. Create a "spindle" by cutting the bolt to length with a hacksaw.

Drill a 6mm hole and elongate it towards the paper as shown in the third photo. Sliding the spindle towards the paper will tension BOTH timing-belts.

Mount the spindle by sandwiching the base-board between two nuts and two large flat-washers as shown in the last photo.

[1]

The base board should be large enough for a sheet of A3 paper plus about 230mm of clear board above the paper for the motors. If the motors are too close the elbows may make contact with the pulleys when the pen is at the top corners of the paper.

## Step 7: Assemble the Plotter.

With the lower timing-belt in place place the drawing arm over the spindle as shown in the first photo.

Two flat washers separate the shoulder arms. There is an additional washer top and bottom to allow everything to rotate freely. A 6mm "drill collet" prevents the arms from falling off when the plotter is being transported.

A 5mm bore shaft extender is used to raise the second GT2-20 timing pulley to the same height as the top GT2-80 shoulder pulley. I used an old drill shank for the shaft extension but anything that is 5mm in diameter will do ... even a threaded bolt.

## Step 8: Arduino Code

The .ino code for this plotter is attached.

Copy the contents of "CNC_drawing_arm.ino" to a new "sketch" and save it using the same name (less the .ino file extension). The file is now ready to be uploaded to your arduino.

Notes

The code is identical to that used in https://www.instructables.com/id/CNC-Dual-Arm-Plo... apart from the following definitions:

• #define STEPS_PER_DEG 12800/360
• #define NUDGE STEPS_PER_DEG/4
• DELAY_MIN = 2500,

Code update 12 August 2017

The motor stepping algorithm has been improved in "CNC_drawing_arm_v2.ino".

Prior to this release the motors stepped alternately. Simultaneous stepping is now possible should that be required. This eliminates potential one-step errors which results in smoother lines.

Code update 16 August 2017

The method for creating test patterns has been improved in "CNC_drawing_arm_v3.ino".

Complex patterns and true circles are now possible. The code changes are detailed in the file header.

## Step 9: Connecting Your PC

Apply 12 volts to the drawing arm [1].

Connect a USB cable between your PC and the Arduino.

Run a terminal emulation program such as https://www.instructables.com/id/CNC-Gcode-Sender... and the above menu should appear on your screen.

The menu is not case sensitive. Typing :

• G00 allows you to send the pen to a specific XY co-ordinate with the pen raised.
• G01 allows you to send the pen to a specific XY co-ordinate with the pen lowered.
• T1 allows you to position your pen over your 0,0 co-ordinate. Type 'E' to exit.
• T2 allows you to scale your drawiing. For example "T2 S2.5" will scale your drawing 250%. The default scale is 100%. All pen moves use the drawing scale last set using this menu option.
• T3 and T4 allow you to raise or lower the pen.
• T5 draws an "ABC" test pattern.
• T6 draws a "target".
• T7 draws a set of radial lines

Notes

• Some terminal emulation programs will display the "Xon" and "Xoff" handshake codes from the arduino as the numbers "17" and "19" rather than the small hollow squares shown above.
• The micros() timer is used for stepping the motors which means that the maximum plot time, before the timer overflows, is 70 minutes.
• Do NOT pause the plotter once plotting has commenced as the motors rely on the system time for stepping.

[1]

Apply 6 volts if you are using 6 volt 600mA motors

## Step 10: Creating an Outline

Use Inkscape to generate the gcode for your images as shown in "Step 9" of instructable https://www.instructables.com/id/CNC-Robot-Plotte...

Image outlines may also be generated using https://www.instructables.com/id/CNC-Edge-Detecti... If you choose to use this method then use the attached "sobel_outline.pde", or "canny_outline.pde", code to create your outlines otherwise your images will be laterally inverted.

The reason for this is that Inkscape expects the co-ordinate (0,0) to be at the lower-left corner of the image, whereas Processing3 defines co-ordinate (0,0) to be at the top-left. The code changes are minor and appear in the "trace" section of each "pde" file.

## Recommendations

• ### CNC Class

28,883 Enrolled

## 16 Discussions

hi sir, You are GREAT!.

and i have a question about arc drawings. When you plot arches, do you divide into smaller straight lines to plot them or something else ?
it will be soo good if you can explain. :)

The method I devised for plotting arcs is explained in "Step 11" of https://www.instructables.com/id/CNC-Drum-Plotter/

Two identical triangles are formed when you bisect a chord drawn between the start and end points on a circle.

The angle at the center of the circle can now be calculated using trigonometery. The arc-length can then be calculated using the formula arc=angle*radius.

If the start and end points are close together then each chord lies on the arc.

My solution is to calculate the target arc-length, divide it into a number of smaller lengths (this makes each chord lie on the arc) and calculate the intermediate end points. The last intermediate point is connected to the target end-point.

Step 4 : "Each joint is sleeved with a tubular 3/16 inch spacer that is 6mm in length."

Length = 6mm

OD = 3/16"

ID = takes 3mm bolt

A minor code update, "CNC_drawing_arm_v3.ino", has been added to "Step 8".

Raw Inkscape g-code may now be used should you wish to create your own test patterns.

A code update, "CNC_drawing_arm_v2.ino", has been added to "Step 8".

This update improves the stepping algorithm which results in smoother lines.

Awesome. The extra torque due to the extension one the one stepper could be mitigated with a couple bearings hard mounted to your frame. Once the slop is supported by bearings the length of shaft is no longer an issue.

In practice the torque on the shaft has not been an issue ... I just saw it as a disadvantage relative to the dual-arm versions at the time I wrote the article.

The main problem are the tiny "wiggles" due to the motor movements being magnified by the 300mm arms. Shorter arms would reduce this effect but would also reduce the plot area.

Wow that is an ingenious design for a robot arm! Maybe this could work for a 3D printer as well, with a tower moving the (reinforced) arm up and down.

7 replies

Thanks for the "RepRap Helios" reference ... the design is interesting.

hmmm, given Z-tower and one of those draw-3d pens you would avoid weight distortion at end of arm and solve the problem of cooling/solidification…maybe :)

You'd need to redesign the whole arm to have a additional beam above the linkage to provide stiffness. Using thicker carbon fiber rods this could be pretty stiff and lightweight.

Or perhaps move from flat stock to square/retangular tubing?

Yeah tubes not rods. And two of them separated by some height to give more stiffness and avoid slop.

Thank you for your comment :)

Depending on what you want to print, a robotic arm may not give you the precision that you require as there is a hidden problem. The precision degrades with distance :(

Some calculations using my diagrams:

Let A=angle, D=distance, L=arm length=100mm, motor=1.8 degrees per step.

cos(A)=(D/2)/L) ................. ....................(1)

rearranging we get

D= 2*L*cos(A) ........................................(2)

Let's now calculate the change of distance (d) for a single step for three different start angles.

The required formula becomes:

d=2*L*cos(A) - 2*L*cos(A+1.8)

d=200(cos(A) - cos(A+1.8)) ................... (3)

Substituting for start angles of 20, 40, and 60 degrees we get:

20 degrees: d=200(cos(20)-cos(21.8)) = 2.24mm

40 degrees: d=4.11mm

60 degrees: d=5.48mm

These distances will be smaller when we use 16*microstepping and 4*belt drive but the non-linearity is cause for concern.

A cartesian XY system using a GT2 20-tooth pulley and a matching GT2 timing-belt offers better linearity, and higher resolution.

With this approach 1 motor revolution of 200 steps moves the timing-belt 20*2=40mm which equates to a CONSTANT distance of 40/200=0.2mm for each motor step. Microstepping would further improve this.

Yeah, there is a theoretical maximum depending on gearing, print area and strength and speed of the motor.

I've also seen servo motors / DC motors with a magnetic rotary encoder being used. Not sure where the limits for precisions are for those. But it might help with these robot arms (for example the RepRap Helios is using an arm)