Basic CNC Controller, Part 5 - Configuration

Part 5

Configuration

 

Plug the UNO into your computer via the USB cable while the CNC shield is powered by the power supply and launch CNCJS. Once everything is connected you can open the communication and expand the console section.

 

The following parameters should be displayed:

 

CNCjs 1.9.20 [Grbl]

Connected to COM7 with a baud rate of 115200

Grbl 1.1h ['$' for help]

client> $$

$0=10 (Step pulse time, microseconds)

$1=25 (Step idle delay, milliseconds)

$2=0 (Step pulse invert, mask)

$3=0 (Step direction invert, mask)

$4=0 (Invert step enable pin, boolean)

$5=0 (Invert limit pins, boolean)

$6=0 (Invert probe pin, boolean)

$10=3 (Status report options, mask)

$11=0.010 (Junction deviation, millimeters)

$12=0.002 (Arc tolerance, millimeters)

$13=0 (Report in inches, boolean)

$20=0 (Soft limits enable, boolean)

$21=1 (Hard limits enable, boolean)

$22=0 (Homing cycle enable, boolean)

$23=0 (Homing direction invert, mask)

$24=25.000 (Homing locate feed rate, mm/min)

$25=500.000 (Homing search seek rate, mm/min)

$26=250 (Homing switch debounce delay, milliseconds)

$27=1.000 (Homing switch pull-off distance, millimeters)

$30=17000 (Maximum spindle speed, RPM)

$31=3000 (Minimum spindle speed, RPM)

$32=0 (Laser-mode enable, boolean)

$100=50.000 (X-axis travel resolution, step/mm)

$101=50.000 (Y-axis travel resolution, step/mm)

$102=50.000 (Z-axis travel resolution, step/mm)

$110=500.000 (X-axis maximum rate, mm/min)

$111=500.000 (Y-axis maximum rate, mm/min)

$112=500.000 (Z-axis maximum rate, mm/min)

$120=50.000 (X-axis acceleration, mm/sec^2)

$121=50.000 (Y-axis acceleration, mm/sec^2)

$122=50.000 (Z-axis acceleration, mm/sec^2)

$130=400.000 (X-axis maximum travel, millimeters)

$131=400.000 (Y-axis maximum travel, millimeters)

$132=150.000 (Z-axis maximum travel, millimeters)

ok

 

Don’t be alarmed, these are not as complicated as they look. Most controllers have parameters like this. We will focus on the four important parameters needed to get your machine moving.

The first parameter is $1 = 25. This indicates the amount of time the stepper motor takes to disengage after movement. Once the motor disengages the motor shaft will turn freely. We want our stepper motors to be permanently engaged to avoid any unwanted movement. To do this, set

$1 = 255. GRBL considers 255 to be infinite. This means your machine will always maintain its position.

 

Secondly, we look at a group of parameters - $100, $101, and $102. These are the displacement resolution parameters for the stepper motor.  Basically, you are telling the software how many steps the motor must make to move your machine by 1mm.

To calculate this parameter, we need the following information:

  1. Number of steps of our motor. (In my case 200)
  2. The micro-stepping mode chosen in the previous step. (In my case 1/32)
  3. The machine drive system. (Leadscrews, ball screws or belt drive)

 

I will give two examples using leadscrews or belt driven.

 

First example - an 8mm leadscrew with a 200-step stepper motor and 1/32 micro-stepping setting the calculation is as follows:

 Calculation for steps per millimeter

Leadscrews can be found here: https://www.cnconline.co.za/products/8mm-lead-screw-multiple-length-options

 

Second example – Using a GT2 belt which has a pitch of 2mm per tooth. We will also say the 200-step stepper motor has a 20-tooth pulley and a 1/16 micro-stepping setting on the driver. The calculation is as follows:

 Calculation for Steps per Millimeter

We will therefore enter this value (800 for example 1 or 80 for example 2):

$100=800
$101=800
$102=800

Or

$100=80
$101=80
$102=80

 

Just for interest’s sake you can use these values to calculate the theoretical accuracy achievable by your machine:

 CNC Machine theoretical calculation

The third parameter is the group $110, $111 and $112. It is the maximum displacement speed for each axis (X Y and Z in order). The speed is expressed in mm/min.

 

The fourth parameter is the group $120, $121 and $122. It is the acceleration for each axis (X Y and Z in order). The acceleration is expressed in mm/sec2

 

These parameters are machine dependant. Weight, rigidity, materials cut, and machine drive all play a part in determining the speed and acceleration of your machine. To start set your machine to the following conservative parameters:

$110=2000

$111=2000

$112=2000

$120=200

$121=200

$122=200

You can then start increasing the values until you are satisfied. If you increase the values by too much, the motors will either stall or lose steps.