CNC Mill

From HacDC Wiki
Revision as of 17:15, 20 November 2011 by Redbeard (talk | contribs) (lots and lots of content walking through the basics of g code)
Jump to navigation Jump to search


  • Computer Numerical Control (CNC) - The ability to control a machine using mathematical commands
  • Computer Aided Design (CAD) - Software which generates a model which a machine can translate into tooling commands for manufacturing.
  • Computer Aided Manufacturing (CAM) - The actual process of production from file to finished product.
  • Tooling/tools - The bits used in a mill to actually
  • Milling - The use of a spinning piece of metal to shape an object through calculated removal of a media, normally via an X / Y / Z axis.
  • Manual Data Input (MDI) - A method for doing manual milling with precise control commands.
  • Lathing - The use of a "static" piece of metal to shape an object through calculated removal of a media which is in (usually) a circular motion.
  • EMC2 - The software used to translate G Code into electrical pulses which can be used by a mill.
  • Axis - The most commonly used graphical user interface with the program EMC2

Getting Started

To initially get started with the CNC mill, it's helpful to have a basic grasp of G Code. How better to get started with this than to begin playing.

Turning on the Mill

When turning on the mill there are three primary "light switch" style switches which should be turned on. The first is on the back of the black box labeled "MicroProto Systems, MicroMill DSLS 3000". This switch is located on the back to the right side (imagine reaching around on the rear right). Flipping the switch "up" should turn this on.

Next, turn on the main control to the spindle. This is achieved via the light switch on the M3/M5 box. Turn this to the "on" position (flicking it towards the label M3/M5).

Finally, turn on the spindle on the actual mill. This is in a blue enameled box residing on the Z axis. Flip this switch "up". If the spindle immediately starts spinning, this is because someone didn't send the control command to stop it. This isn't a problem, but we will want to stop it sooner than later. We will cover this in the next section.

Starting EMC2

To start, you'll want to fire up EMC2 with the proper configuration file. This can be done by using the icon on the desktop or by clicking the corresponding link on the quick launch bar on the top of the screen.

If the mill has been turned on and the right configuration file is used, you will hear the spindle briefly spin up.

Once in EMC2 you'll need to enable machine control of the mill. Begin by clicking the large red "X" button on the button toolbar within AXIS. After this button has been pressed, the power button directly beside it should become available to click. Upon pressing this "power" button, EMC2 / AXIS can be used to send commands to the mill.

Making our first motions

Beginning Manual Control

To start, we're going to use the "jog" functions to move the milling cutter around and get a feel for what is "positive" and "negative" on the X, Y, & Z axis.

Especially, when starting out, limit motion to the X and Y axis as this has the least potential for damaging our tooling (aka, breaking a bit). As you get a feel for what's positive and negative, we will start using larger motions.

To start, hit "F3" on the keyboard to enter fully manual control. This will present us with a radio button to choose the axis, followed by a "+" and "-" sign to show where our milling cutter will move.

To start, select the "X" axis and press the positive button. Next, select the "Y" axis and press the positive button. As you were moving the milling cutter around, you'll notice that the coordinates are displayed in the preview window. This is where you can quickly survey where your tooling is located. Using these tools, move the mill to the following positions (x,y) - (0,0), (0,1), (1,1).

Next, lets raise the tool a little bit to give ourselves more clearance to put in something to be milled. Select the Z axis and press the "+" button. Move the Z axis all the way to "1".

At this point, adding our Z axis, our tooling should be located at (1,1,1).

Advanced Manual Control - MDI (Manual Data Input)

In AXIS press "F5" and go to the MDI Section. Within this section we can type in actual G Code to move our tooling around. To start, we're going to use simple "go to" commands. This will rapidly move the tool to the position that we tell it to. Note, at any time, we can stop the execution of these commands by hitting the "esc" key on the keyboard. The first command we will use is "rapid go to" or "g0"

To make our first motion, let's move the X axis to position 0.5. To do this, enter the command:

 g0 x0.5

The X axis should begin moving.

Additionally, we can give multiple coordinates at once. Now try the command:

 g0 x0 y0

This should send our tool back to the starting position. This can make things go much, much faster for resetting back to the position that you started with the mill at.

To have more fine grained control we can use the command "g1". There is nothing that G0 does which G1 cannot. The only difference in syntax is that we specify the feed rate of the motion as the first option. By default the mill is set to operate in inches per minute. Thus, unless you change this (via g code) it should be assumed that this will be the unit of measure for your commands.

Lets slowly drop our Z axis back to zero:

 g1 f2 z0

Note, since we were at a position approx 1 inch up and told the mill to return to zero at a rate of F2 or 2 inches per minute, it will take approximately 30 seconds for this command to complete. Slow movement of the tool (especially when 'plunging' the z axis is a good idea as it allows for time to hit the "esc" key if things start going horribly wrong).

Now, let's build on some of these together:

 g1 f10 x1 y1 z1

Whoops, back to zero:

 g1 f5 x0 y0 z0

When moving back to zero you will see that the mill is moving half of the original speed (5 inches per minute rather than 10 inches per minute).

Let's really open this thing up and see what it can do. While watching this command move notice the "vel: " or Velocity property in the preview window. This will allow you to see the actual speed of the tool.

 g1 f50 x1 y1 z1

Hmm, apparently our steppers max out at ~10.39 inches per minute. Thus, no matter how much faster we tell them to go, they will never go faster than this.

Linear motion is great and all, but how about we dwell outside the euclidean space for a minute. The next commands that we are going to learn are G2/G3. G2 will make a clockwise arc while G3 will make a counterclockwise arc. The command syntax is as follows:

*G2 - Command
*Fx - Feedrate at X inches per minute
*Xv - Destination X coordinate (in this case end at v)
*Yw - Destination Y coordinate (in this case end at w)
*Ix - X axis center point offset
*Jy - Y axis center point offset
*Za - Interpolated Z axis coordinate (optional)

To start, lets make a circle:

 g2 f5 x1 y0 i-0.5 j0

Annnnd we fail. This is because we've given junk data to the mill. Lets try that again making a circle. Of course, to make a circle, we will want our beginning (1,1,1) to be the same as our destination (1,1,1) only changing the X axis center point offset.

 g2 f5 x1 y1 i-0.5 j0

Fun math bits... run that command again and note the "distance to go" or "DTG" in the preview area. Note the distance at the immediate start of plotting our 1 inch diameter circle (2 * 0.5 X offset). This should be a predictable result

When you're done

Be a dear and reset the mill back where you started. Go into MDI mode and run:

 g0 x0y0z0


GCode Tips

Jogging the mill is a pain in the ass. One of the most helpful GCode commands you can use is "go to coordinate". To go to an X coordinate "zero" one would use "g0 x0", similarly to go to y0 one would use "g0 y0". This is especially helpful for moving the tooling out of the way to add a new piece to be milled or to make an adjustment. Subsequently, the tooling can be reset with "g0 x0" "g0 y0" "g0 z0"

Config File

Redbeard made some changes to the config file including resetting the initial home positions to "0 0 0 0" so that when the application starts up, it will leave the tool exactly where it is placed. While this isn't the behaviour we want long term, it's perfect for our current lack of limit switches. Additionally, the directive "no_force_homing=1" was added to get rid of pesky error messages (again, since we don't have limit switches for homing the device.)