Introduction: CNC Drawing Arm
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:
- adjacent angles about a diagonal are equal
- 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.
Advantages
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
Disadvantages
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 3: Parts List
Attachments
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.
Code update 15 September 2021
The attached file "CNC_drawing_arm_v3.1.ino" contains a minor bugfix.
The data type in code lines 896 and 897 has been changed from int() to long().
Thank you leo_nuñez for noticing this.
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
The menu is not case sensitive. Typing :
- MENU brings up the menu
- 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.
Click here to view my other instructables.
33 Comments
Question 8 months ago
Hi lingib,
thank you very much for sharing this awesome project.
I have build an 70% upscaled version of the robot. The arms are 510mm and the short arm is 85mm. I used the same ratio (20-80) and the same Arduino uno. The robot moves but I can not find the 0,0 point (T1 in the Arduino code) for this configuration. I tried upscaling the coordinates as well but it didn't work. I played around with the inputs in the code under float (118-121) and found a 0,0 point and a scaling where it kind of works but only in a very limited area. My problem is that the robot does not perform any straight lines. the x and y axis are always curved and the dimensions tend to expand the further it is away from 0,0.
I would be very thankful if you could help me find a solution to my problem.
thanks, Simon
Answer 7 months ago
Hi Simon,
Thank you for your interest in my project :)
I do not understand what you mean by (20-80) ratio ... I don't use ratios.
I suggest that you study the dimensions in photo 2 and photo 3 of Step 1 Theory before attempting to upscale the plotter.
The two longest arms on my plotter are exactly 300mm in length.
The short arm can be any length providing the thinner link-arm is parallel to the arm closest to the motors.
Upscaling affects not only the length of the drawing arms but also the size of the drawing board which in turn alters the(0,0) start position.
If you chose to upscale the plotter then you will need to change each of the values in code lines. 118, 119, 120
Regardless of size ... the long drawing arms MUST always be the same length.
The (0,0) drawing coordinate is the lower left of your drawing board.
All measurements are taken from this point.
The position you choose for your (0,0) coordinate should not be with both arms in a straight line ... for the plotter to work the elbow must always be bent.
"T1" on the main menu accesses a test function (code lines 425..515).
To use this function it is necessary to (roughly) position your pen over your (0,0) drawing coordinate.
You are then presented with a submenu that allows you to accurately position your pen over the (0.0) coordinate using the a,s,k,l & e (for exit) keys.
You can find all references to T1 in the code by pressing the CTRL & F keys together and entering T1 into the popup search field.
Regarding the line shapes ... check out my reply to DejayRezme in the comments section.
Upscaling is likely to exaggerate any error.
If you require high accuracy and a large format I recommend https://www.instructables.com/CoreXY-CNC-Plotter/... and https://www.instructables.com/CoreXY-CNC-Plotter/...
I have succesfully upscaled this plotter to A1.
The resolution remains at 80 steps/mm regardless of size.
Hopefully this helps.
Cheers
Lindsay
Question 10 months ago on Step 8
Can you add a code to add laser engraving?, only need the signal to start and stop laser.
thanks
Answer 9 months ago
Sorry ... have yet to experiment with lasers so any code would be suspect :(
Question 2 years ago
Line 896 / 897:
STEPS1 = int(angle1 * RAD_TO_DEG * STEPS_PER_DEG);
STEPS2 = int(angle2 * RAD_TO_DEG * STEPS_PER_DEG);
cambiar por:
STEPS1 = long(angle1 * RAD_TO_DEG * STEPS_PER_DEG);
STEPS2 = long(angle2 * RAD_TO_DEG * STEPS_PER_DEG);
Por momento da errores de desborde. Gracias!!!
Answer 2 years ago
Thank you for spotting this error and letting me know :)
I have amended the code and uploaded it to Step 8: Arduino Code.
File "CNC_drawing_arm_v3.1.ino" contains the amended code.
2 years ago
One big complaint here. You need more video's of it doing things. I could watch these things do stuff for hours... One short video is just not enough.. :-)
Another great instructable Lingib, very detailed and nicely explained.
Thanks...
Question 3 years ago
Hi.
Do you have data about the accuracy and reproducibility?
How the required torque changes with respect the arm length?
Regards,
Run
Answer 3 years ago
Sorry ... only what you see.
Somewhere in the comments section below I explain how the accuracy varies slightly with distance.
I have made several plotters. The most accurate and reproducable plotter is https://www.instructables.com/id/CoreXY-CNC-Plotter/ used in conjunction with my instructable https://www.instructables.com/id/How-to-Control-a-Servo-Using-GRBL/
3 years ago
Wow this is amazing. You have given the world a ray of hope
Reply 3 years ago
Thank you :)
4 years ago
I'm very much fascinated with your dual arm drawing arm and started woking on a scale down version (arm length 200mm).
I have a question about the code (CNC_drawing_arm.ino). What is the purpose of the function calculate_delays() ? and also how did you got the Minimum_delay value as 2500.
Thanks very much for your attention
Reply 4 years ago
The small jump could be mechanical, something slipping, your substitute DRV8825 stepper driver not behaving the way you expect, or you may have accidentally changed something in the code ... the project as published works.
The steps/rev for your setup is 19200 not 19600 (see below)
--------------------------------
Pulley ratio = 60/20 = 3
Motor steps/rev = 200
Microstepping = 32
--------------------------------
Multiplying these = 19200
With the motors positioned at the top of the board, the (0,0) coordinate for this plotter is at the lower-left. All coordinates MUST be positive ... I have no idea what a coordinate of (-50, 250) will do !
What happens when you you plot the included test patterns T5,T6,T7 ?
Reply 4 years ago
Thank you for your interest in my project :)
Both motors must start and stop at the same time. Different delays are required because each motor requires a different number of steps to complete a given move.
The minimum delay, which you set in the header, determines the plotter speed and was found by trial and error. Halving the value of 2500 will double the plotting speed but you may encounter problems such as overshoot depending on the mass of the plotter arm.
4 years ago
Thanks very much your reply and now I have an issue about the way the lines drawn by my plotter. As given in image when drawing the line from A(x=0, y=100) to B (x= -50, y=250) and backward, the pen jumps to left for about 5mm before proceeding towards B. Similarly, the pen jumps to the right about 1mm on its way back. The about path from A to B lies in between the two traces. Appreciate you guide me on this regards.
As for my system I use NEMA17 motors, DRV8825 stepper driver with 32 micro-steps and 20:60 pulley to yield 19600 steps per round.
The second image shows my prototype and it's now in pen_down mode only.
Thanking you
4 years ago
Can you teach laser cutting?
Reply 4 years ago
Thank you for your interest in my projects and your suggestion :)
Laser cutting would be a great project but is something that I have no experience.
Burning photographs into wood and stencil cutting using a low-power laser fitted to my https://www.instructables.com/id/CoreXY-CNC-Plotter/ is on my to-do list but is some way off.
4 years ago
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. :)
Reply 4 years ago
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.
Question 5 years ago on Step 3
Could be more specific about the 3/16 inch (4.76mm) tubluar spacers? length, OD and ID :)