Jump to content

A Small CNC Machine For Luthiery - Part 3

After going through the StepConf Wizard to set up our CNC router LinuxCNC will have created a shortcut on the desktop to allow us to run the CNC machine with our configuration. Double-clicking this icon will launch Axis, the default graphical user interface. Upon opening Axis the user is presented with a 3D representation of the physical machinable cutting area of our CNC machine. A default test cutting program is loaded on startup featuring the LinuxCNC logo and a small cone object in the preview window represents the position of the CNC cutting tool. The maximum bounds of movement of the CNC machine, as defined by StepConf Wizard in part 2 of this series, are represented as a rectangular cuboid object with dotted red edges. In our case the cube is 200mm wide, 300mm long and 50mm high, which aligns with the maximum limits of travel of our particular CNC router.

566bb986af072_12AxisStartup.thumb.png.45

 

Take a fresh piece of plywood, MDF or other flat material at least 150mm x 150mm and secure it to the table. Fit a small engraving cutter to the spindle and tighten the collet. Open a blank text document using whatever text editor you prefer to use on your system and enter the following G-Code. If your machine is set up for millimetres use the left column. If you’re running your machine in inches use the right column:

566bb387ede56_100squarecode.JPG.a55f6faa

 

Save this file as ‘100square’ with the file extension ‘.ngc’ to a convenient location on your computer.

Using the metric version, let’s break the code down into its components:

  • G21 – This command tells Axis that the units of measure contained in the following code is expressed in millimetres. If G20 is used then the units of measure are inches.
  • G0 Z15 – the G0 command instructs the CNC machine to linearly move its axis or axes at maximum velocity. This is useful to speed up moving from one area to another in preparation for the next cut, but should not be used when actually cutting as the speeds and forces involved could damage the tool. Z is the axis that is to be moved and the number immediately following is the position the axis is required to move to.  In effect this line is commanding the CNC router to raise the Z axis to 15mm above the surface of the workpiece at maximum speed.
  • G0 X0 Y0 Z5 – The CNC machine is again required to execute a rapid move, but this time we have also included destinations for the X and Y axes (X0 and Y0). Z axis is also instructed to lower to 5mm (Z5).
  • G1 X0 Y0 Z-0.5 F300G1 tells the machine to linearly move at a rate which is specified by F300, expressed in units per minute. Because the Z axis is required to move to a negative value (Z-0.5) we are now plunging the tool into the workpiece to begin cutting and a slower axis velocity is required. X and Y axes are set at 0, but because we already moved to X0/Y0 in the previous step there will be no change in these two axes.
  • G1 X100 Y0 Z-0.5 F300G1 again instructs the machine to use the feed rate F300. The X axis is requested to move to 100 while maintaining Y at 0. This will result in the X axis moving to the right in a straight line to a distance of 100mm. The Z axis remains at the same value as previously commanded by the G1 instruction.
  • G1 X100 Y100 Z-0.5 F300 – The machine will move Y up to 100 at low feed while keeping X at 100 and Z at -0.5.
  • G1 X0 Y100 Z-0.5 F300 – The CNC router will move X axis back to 0 at low feed
  • G1 X0 Y0 Z-0.5 F300 – The Y axis is reduced to 0 at low feed.
  • G0 X0 Y0 Z15 – The Z axis is raised to 15mm above the surface at maximum rate. The cutter is withdrawn from the work piece.
  • M2 – This command signifies the end of the program and the CNC can stop operation.

Many G-Code commands and variables are ‘modal’ and remain in effect until another contradictory command is executed. As an example the above program could be re-written for maximum modality and provide the exact same output. The drawback is that it can become difficult to read to the user, as much of the detail is removed:

566bb38979712_100squrecode2.JPG.5ddd1fa4

 

You will note that the F300/F12 feed rate that originally appeared at the end of each G1 line now features at the top of the program. This is because each successive G1 command will utilise the last known feed rate, which is now defined at the beginning of the code.

Returning to Axis it can be seen that on start-up the location of the cutting tool is exactly at the upper-left corner of the machine limits of travel (X=0 and Y=0) and the tip of the cone is positioned at maximum height (Z=0).

566bb986af072_12AxisStartup.thumb.png.45

 

This corresponds with the home position that was defined earlier while running the StepConf Wizard. In reality the cutting head could be physically located anywhere within the limits of travel, as is the case below:

02 CNC Unhomed.jpg

 

Before the CNC router can be operated it needs to be returned to its home position. On more advanced machines this procedure can be automatic, with the axes seeking their home positions when the user commands the machine to home itself. In our case we will home the machine manually.

Click the File open button or press <O>, navigate to where you saved the G-Code program we created and load ‘100square.ngc’. You should be presented with the following in the preview window:

01 Axis Startup.png

 

Check the Emergency Stop pushbutton on the CNC router control interface has been reset, and press <F2> or click the ‘Toggle Machine Power’ orange button on the top menu bar.

03 Axis Toggle Power.png

 

A number of greyed-out options under the ‘Manual Control’ tab become active. With the CNC machine connected to the PC and powered-up, use the four arrow keys on the computer keyboard to move the machine around the cutting bed in the X and Y directions. The <page up> and <page down> keys will also move the Z axis up and down. Manually moving the cutting head around the table is called jogging. As the cutting head moves around the display updates the position of the cone object and shows the path taken as a solid yellow line. In the below example the cutter has been jogged towards the front edge of the table by 31.739mm (Y axis), across to the left 21.547mm (X axis) and up 20.545mm (Z axis).  These values appear in the upper-left corner of the display; the Digital Read-out or DRO:

05 Axis Jog Home.png

 

The CNC machine, having now executed the above moves is sitting with its cutting head physically home, but well away from the workpiece at a distance which does not yet correspond to the values shown in the preview window:

06 CNC Jog Home.jpg

 

Now that the CNC machine itself is at its home position Axis needs to be told that this is now the position that corresponds with the upper-left corner of the red dotted-edged cuboid object, ie the 'soft' home position. The ‘Home Axis’ button is then clicked for each of the X, Y and Z axes. As each axis is homed the DRO updates to indicate that the associated axis is at position ‘0’ and a axis-homed.png.663db37d625029ff76531fe13 symbol is added next to the readout. Note also that the position of the cutting head in the preview window returns to the upper-left corner of the work area box to reflect the fact that it has now had its home position reset.

07 Axis Home.png

08 Axis Homed.png

 

The second step to perform before we can run a job is to ‘touch off’ the cutter against the workpiece. This is the process of setting the position of the workpiece relative to the home position of the machine. With the CNC router homed the job can be run, but unless the tool is touched-off Axis does not know where the workpiece lies relative to the tip of the cutting tool. In the above example the square object looks as if it sits bang-up against the top of the limits of travel, when in actuality the workpiece is about 25mm below the tip of the cutter and a few inches inside the edges of the table. Without touching-off, at best the machine may run the job with the tool completely missing the workpiece. At worst the CNC may try to drive the cutting tool through the workpiece into the table, ruining the job, damaging the table and destroying the cutting tool.

To touch off manually jog the cutting head to the point at which you require the origin of the job to be positioned on the material. In the below example the cutting head has been jogged right 34.071mm (X axis), jogged away from the front of the table 42.856mm (Y axis) and jogged vertically down by 22.156mm (Z axis) to place the tip of the cutter at exactly the spot where the job origin is required to be.

09 Axis Jog to Touchoff.png

 

In our case I have marked the workpiece with a cross to indicate where I want the square shape to begin:

10 CNC Jog to Touchoff.jpg

 

As each axis is moved into position click the ‘Touch Off’ button. A dialogue box opens to allow the user to manually specify an additional offset to the workpiece relative to the axis being touched off, but in most cases it is sufficient to use the default of 0.

11 Axis Touch Off.png

12 Axis Touch Off Dialogue.png

 

After touching off the axis the DRO updates to show the position of the cutter has now been reset to 0. Note also that the square object has now moved 'deeper' into the red cuboid object that defines the limits of machine movement.

13 Axis Homed.png

 

Click the ‘Clear Live Plot’ button or press <CTRL-K>. This clears the preview window of any paths that were created by the manual jogging of the cutting head.

14 Axis Clear Live plot.png

15 Axis Cleared.png

 

Manually jog the cutter away from the workpiece a few centimetres. With the machine homed and touched-off we are now ready to run the job.

16 Axis Backoff.png

17 CNC Backoff.jpg

 

If the CNC machine has a manual spindle control turn it on and set the spindle speed appropriately. Click the blue ‘Play’ button or press <R>.

18 Axis Begin GCode.png

 

The CNC machine and preview window will now begin stepping through the code and manoeuvring around the workpiece. Note that the movement of the cutting head in the preview window is indicated by pale red lines for slow cutting motions, and for rapid jogging motions between each cut the tool follows the cyan dotted lines without leaving a trail.

19 Axis Running.png

20 CNC Running.jpg

 

After a few minutes the program completes and the cutter retreats away from the workpiece to a safe distance where the spindle can now be turned off. If all things have gone to plan you should now have the 100 x 100 square engraved on your workpiece.

21 Axis Complete.png

22 CNC Complete.jpg

 

Take a good quality ruler or Vernier calipers and measure each of the four sides of the engraved square and confirm that they each measure 100mm.

23 Measure sides.jpg

 

If the sides of the square do not equal 100mm then some tuning of the configuration file must be undertaken to correct this error. The most likely culprit is that the lead screw pitch has been incorrectly set. The correction factor to apply to bring the axis scale back to the correct value is:

566bb38ab1d86_Axisconversionfactor.JPG.8

 

If the square is exactly out of scale by a factor of two the other possibility is that the 'Motor Steps Per Revolution' setting is out by a factor of two. Doubling the value of 'Motor Steps Per Revolution' will make the edge of the square twice as big, whereas halving this setting will reduce the length of the square’s edge by half.

----------

Now that we have the CNC router actually cutting something and each axis is scaled correctly, we can move on to creating something a little more exciting. In the next instalment in the CNC series we will create a truss rod cover from scratch using CAD and mill it on the CNC router.

 


  • Like 1
Report Article



User Feedback


There are no comments to display.



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...