Introduction: D.I.Y 3-Axis Polar CNC Machine
Today I would like to share how to build a 3-Axis Polar CNC Machine at home. Similar to a few of my recent projects, the main materials used for this project are also PVC pipes and broken or discarded materials, hope you guys don't get bored.
Please see the brief description, as well as, how a Polar CNC Machine works in the video below before getting started in detail.
Step 1: Supplies
a. Main materials:
- 1pcs x Arduino Uno R3. (Link Amazon)
- 1pcs x Arduino CNC Shield V3 GRBL. (Link Amazon)
- 3pcs x Stepper Motor Driver A4988. (Link Amazon)
- 3pcs x Stepper motor NEMA 17. (Link Amazon)
- 2pcs x 50 mm L Stepper Motor Support. (Link Amazon)
- 2pcs x GT2 6mm Closed Timing Belt 200mm. (Link Amazon)
- 2pcs x GT2 Timing Pulley 20 Teeth. (Link Amazon)
- 2pcs x GT2 Timing Pulley 60 Teeth. (Link Amazon)
- 2pcs x Round Shaft Diameter 8mm, Length 400mm. (Link Amazon)
- 1pcs x Round Shaft Diameter 8mm, Length 200mm. (Link Amazon)
- 2pcs x 8mm Linear Rail Shaft Clamping Guide Support. (Link Amazon)
- 2pcs x T8 Lead Screw 2mm Pitch, 8mm Lead , Length 400mm with Copper Nut. (Link Amazon)
- 20pcs x Ball Flanged Shielded Bearings 8 x 22 x 7mm. (Link Amazon)
- 1pcs x Aluminum Flexible Shaft Coupling, Inner Hole Size: 5mm x 8mm. (Link Amazon)
- 1pcs x Power Supply 12/24VDC. (Link Amazon)
- 2pcs x Clear/White Acrylic, size A3, thickness at least 5mm. (Link Amazon)
- 4pcs x Copper Brass Pillars L-5/10mm. (Link Amazon)
- 1 meter x 8P/16P Rainbow Ribbon Cable. (Link Amazon)
- Some small cable ties, cable spiral wrap, M3/M4 bolts and nuts, some paper clips.
b. PVC pipes and its fittings:
- 4pcs x PVC Pipe Elbow Ø42mm.
- 8pcs x PVC Pipe Straight Connector Ø42mm.
- 16pcs x PVC Pipe Tee Ø42mm.
- 2pcs x PVC Pipe Cross Ø42mm.
- 16pcs x PVC Pipe End Cap Ø42mm.
- 2pcs x PVC Pipe End Cap Ø60mm.
- 4pcs x PVC Reducer Ø60mm to Ø42mm.
- 2 meter x PVC Pipe Ø42mm and Ø60mm.
- Drilling machine with drill bit hole 8/22mm.
- Hand saw.
- Hand grinder.
- Soldering machine.
- Big scissor.
Step 2: Schematic and How It Works
The 3-Axis Polar CNC general configuration is including: three NEMA-17 stepper motors, leadscrew and belt driven system, PVC & acrylic frame and it is controlled by Arduino Uno plus GRBL CNC Shield. Its operation is as follows: one Y axis spin a rotary table, one X axis move linearly forward and backward relative to the centre of rotary table, and one Z axis move linearly up and down to carry out the task, e.g: lift a pen up/down.
The connection is quite simple. My Polar CNC has 3 axes which are called:
- Linear X axis: its stepper motor is connected to X axis header on CNC shield.
- Rotary Y axis: its stepper motor connected to Y axis header on CNC shield.
- Linear Z axis: its stepper motor connected to Z axis header on CNC shield.
The NEXTPCB support me for this project. If you have a PCB project, please visit the NEXTPCB website to get exciting discounts and coupons.
- Only $0 for 1-4 layer PCB Prototype: https://www.nextpcb.com/pcb-quote?act=2&code=tunen...
- New customer get $100 coupons, register at: https://www.nextpcb.com/register?code=tunendd
- Up to 30% off for the PCB orders.
- Up to 20% off for the PCBA orders.
Step 3: Build Rotary Y Axis
Assemble a rotary table, it is composed of:
- 1pcs x Acrylic sheet, size 300 x 300.
- 2pcs x Motor L-shaped supports.
- 2pcs x 8mm Linear rail shaft clamping guide supports.
The center of rotary table should be marked on the acrylic sheet because it is important for a polar coordinate system.
Build a frame from PVC Ø42 tees, straight connectors and cross, size L x W x H = 500 x 230 x 230mm.
My first idea as shown below.
The rotary shaft was connected directly to a stepper motor via flexible coupling, but it didn't work well.
So I changed to belt transmission system with pulleys ratio 20:60 teeth (1:3). I mounted Y stepper motor on the acrylic sheet, install one 20 teeth pulley on its shaft. Two holes were punched for connecting to the frame.
Modify the PVC frame a little bit, mount a acrylic support to frame and connect stepper motor to rotary table by one shaft 200mm, closed timing belt plus 60 teeth pulley.
Fix a rotary shaft at bottom by one screw locking bearing.
Step 4: Build Linear Z Axis and Pen Holder
Mounting Z stepper motor on 2 end caps PVC Ø60 and connecting to 400mm lead screw by a flexible coupling 5 x 8mm.
I had some broken desoldering guns and I reused their tube and spring as a pen holder.
Cut a piece of spring, tried to twist this spring so that it clamped firmly on the end of pen and put them into small tube of desoldering gun.
I used a pen with diameter about 10mm and everything fitted perfectly by this way.
Put the desoldering gun tube inside a small pipe, lock it by 2 cable glands at 2 ends then connect this pen holder to Z axis working base. There is a small gap between the bottom cable gland and pen, which ensures that the pen tip can move up and down when a drawing surface is not flat.
If we do not have a desoldering gun tube, we can reuse plastic cover of a soldering machine and it is not a bad solution.
Pre-assembling and checking the Z axis. Done.
Step 5: Build Linear X Axis
X axis working base as shown below which was built from Ø42 PVC tees and cross. Later, Z axis would be mounted on this X axis vertically. Bearings & copper nuts were also installed so that Z and X axis could work horizontally and vertically.
Thread X axis lead screw and shaft through the copper nut and bearings.
I mounted X stepper motor on the acrylic sheet, installed one 20 teeth pulley on motor shaft. As same as Y axis, two holes on the acrylic sheet were punched for connecting to the frame.
Step 6: Assembly and Connection
Continue to build the CNC frame up high:
- Reinforce frame by vertical and horizontal connecting pipes, tees and elbows.
- Mount the acrylic support for X stepper motor to CNC frame.
- Install 4 end caps PVC Ø42 for mounting X axis.
Mount X axis to main frame and connect stepper motor to lead screw by closed timing belt 200mm plus 60 teeth pulley.
Thread lead screw and shaft of Z axis through X axis PVC vertical cross.
Install Z axis working base and pen holder.
Adjust the X axis and pen holder so that the pen tip should coincide with the center of rotary table.
Mounting Arduino Uno plus CNC shield to X axis acrylic support and connecting all wires to stepper motors.
Step 7: GRBL Parameters
1. Download and install GRBL firmware for Arduino Uno: https://github.com/gnea/grbl
2. STEP/MM setting notes:
X and Z axis travel resolution ($100 & $102): Since they move linearly, they are calculated and set-up as normal, based on:
- The stepper motors step angles - steps per revolution.
- The pulleys and closed timing belt specifications.
Y axis travel resolution ($101): The Y axis rotates around the center of CNC machine so it is calculated differently. STEP/MM of rotary Y axis is defined by angle in polar coordinates. So we return to the original specification of stepper motor, it is step angle or step per revolution. My setting was as follow:
- Stepper motor step angle: 200 steps per revolution or step angle of 1.8° (1.8°/step).
- Pulleys ratio: 20:60 or 1:3.
- Micro-stepping: 1/8.
Y axis STEP/mm ($101) = STEP/ANGLE = (200 x 8 x 3)/360° = 13.333 STEP/°
STEP/° is the key for the CNC machine to work properly in polar coordinates based on GRBL firmware.
And as we can see, to get a bigger STEP/° parameter, which means we get more accuracy in polar system, and we need a bigger gear ratio. This explains why my initial configuration didn't work well. ☹.
Step 8: Inkscape & Universal Gcode Platform
I used the following softwares to generate G-code, as well as, sending G-code file to Polar CNC controller & monitor the operation of CNC machine:
Step 9: Cartesian to Polar Conversion and TkCNC Editor Software
1. Cartesian To Polar Conversion.
According to wikipedia, polar coordinates are defined as follows: "In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction. The reference point (analogous to the origin of a Cartesian coordinate system) is called the pole, and the ray from the pole in the reference direction is the polar axis. The distance from the pole is called the radial coordinate, radial distance or simply radius, and the angle is called the angular coordinate, polar angle, or azimuth. Angles in polar notation are generally expressed in either degrees or radians (2π rad being equal to 360°)."
The Cartesian coordinates x and y can be converted to polar coordinates r and φ with r ≥ 0 and φ in the interval (−π, π] by:
- r = √ (x² + y²)
- φ = atan2(y,x)
Cartesian (x, y) → Polar (r, φ)
The polar coordinate system is not often used, but it may have some advantages comparing to Cartesian coordinate system in some specific case : for example, in the polar coordinate system, a circle can be generated by simply rotating the rotary axis with zero interpolation error.
2. tkCNC Editor Overview:
tkCNC Editor is a text editor, specially designed for CNC code (G-code) editing for CNC machines. It is used by CNC programmers and operators for fast editing and verification of CNC code.
tkCNC Editor main features:
This software has a lot of cool functions and we can use 30 days trial version with full features. In this project, I applied the following useful functions:
- Conversion of CNC G-code from Cartesian to Polar coordinates.
- Text editor functions such as: Cut, Copy, Paste, Delete, Find/Replace....
- CNC program simulation.
We can download and install tkCNC Editor in our computer following the detail instruction at: https://www.tkcnc.com/download.html
Step 10: Cartesian to Polar Conversion Tips
To be able to convert texts or images from Cartesian coordinates to Polar coordinates, I did the following steps:
- Open Inkscape, write a text or load an image then convert it to a G-code file by Gcodetools extension. For the first testing, I created a G-code for a 40mm square in Inkscape, named "Square.gcode".
% (Header) (Generated by gcodetools from Inkscape.) (Using default header. To add your own header create file "header" in the output dir.) M3 (Header end.) G21 (All units in mm) (Start cutting path id: rect31) (Change tool to Cylindrical cutter) G00 Z2.000000 G00 X25.164278 Y56.835720 G01 Z-1.000000 F100.0(Penetrate) G01 X74.835722 Y56.835720 Z-1.000000 F1000.000000 G01 X74.835722 Y7.164280 Z-1.000000 G01 X25.164278 Y7.164280 Z-1.000000 G01 X25.164278 Y56.835720 Z-1.000000 G00 Z2.000000 (End cutting path id: rect31) (Footer) M5 G00 X0.0000 Y0.0000 M2 (Using default footer. To add your own footer create file "footer" in the output dir.) (end) %
- Open file "Square.gcode" by tkCNC Editor software. Select the part of code to be converted (ignore the header and footer), go to "Modify" ‣ Select "Cartesian to Polar Conversion...", a polar coordinate settings window pops up.
- Polar parameters setting:
- Plane: XY.
- Conversion type: Interpolate polar points.
- Machining tolerance: 0.010.
- Select tickbox: Start from angle zero and Infinite rotation axis.
- Click "OK" and the conversion is started.
- Note that polar coordinates are represented by X and C in this software. We need to replace "C" by "Y" so that the GRBL firmware can understand these commands. We can save it with a different name, for example "Square_Polar.gcode" and use a built-in "Find/ Replace" function in tkCNC Editor.
- Go to "Simulation" tab, select "Simulate CNC Program..." to check the conversion result. The square looks like this after conversion.
Honestly, this is an awfully great software!!!
Step 11: Start Testings
Firstly, we should test how Polar CNC works by drawing a square or a rectangle. This is similar to test a traditional CNC machine by drawing a circle if it works at Cartesian coordinates. The first testing steps were as follows:
- Open UGS, select Port and set Baud to 115200, click on Connect tab.
- Set the original coordinates by button Reset Zero. It should be located in the center of rotary axis.
- To calibrate the rotary Y axis, I commanded it to move 360mm in the UGS. Take note that 360mm parameter in this case is 360° (degrees) because I have set $101 in steps per degree (STEP/°). If it rotated exactly one revolution, my setting was correct.
- Click Open ‣ Browse to the G-code file "Square_Polar.gcode" that converted by tkCNC Editor.
- Click Send and Polar CNC will perform drawing picture following the converted G-code.
The image below shows a square drawn by a Polar CNC machine before and after converting from Cartesian to Polar coordinates. I also tested the Polar CNC machine by drawing a star.
We can also use other softwares which have built-in tools for converting the text or images into GCODE, for example some softwares related to laser CNC engravers. Then we can modify their G-Code files by tkCNC and converted them to polar coordinates.
Step 12: Some More Testing Results
My Polar CNC machine worked well as shown in some pictures above. I've also drawn some more texts and images before and after conversion to understand how my Polar CNC worked, for examples:
The DOG image looks like this in UGS after I converted its G-code from Cartesian to Polar coordinates.
And a text "SUBSCRIBE" looks like below.
The image gets smaller as it gets closer to the center of CNC machine if we don't do the conversion. If we rotate the text or image vertically, place it far from the center and don't carry out transformation to polar coordinates, we would also get a nice looking writting or image. And they would only be scaled down a bit, at the part of text or image which are located near by the CNC's center and they have a curved shape according to the specified radius.
Step 13: Conclusion
I had a very interesting feeling when I focused on its operation, especially the motion of rotary axis.
In fact, there are some projects that cannot be implemented for student learning because it requires expensive or precision machined materials. So please don't think this is a step backwards!
Thank you for reading my work and hope you enjoyed my post this time!!!
First Prize in the
Make it Move Challenge