Skip to content
Jens Dyvik edited this page May 12, 2020 · 1 revision

Machine setup using Universal Gcode Sender and Grbl

How to set up you machine.

Equipment

Test connections and configuration

  • Use the UGS setup wizard to calibrate the machine

OR

  • Test that you can drive the machine in all axis and all directions
  • Test measure that it moves the correct distance for all axis
  • Manually test that the limit switches trigger a response in the UGS interface
  • Make grbl firmware changes via the UGS interface if neccesarry until the above works.

Homing sequence

Before we can set up homing we need to make sure that some firmware settings are good enough:

Good homing feeds and distances in the firmware:

  • $24 = 500.000 (Homing locate feed rate, mm/min)
  • $25 = 4000.000 (Homing search seek rate, mm/min)
  • $26 = 250 (Homing switch debounce delay, milliseconds)
  • $27 = 20.000 (Homing switch pull-off distance, millimeters)

Set the CORRECT maximum travel distances in the firmware:

  • $130 = 2600.000 (X-axis maximum travel, millimeters)
  • $131 = 1300.000 (Y-axis maximum travel, millimeters)
  • $132 = 200.000 (Z-axis maximum travel, millimeters)

The z axis max travel should be the distance you can go down before an empty collet hits the work surface.

Activate homing and soft limits:

  • $20 = 1 (Soft limits enable, boolean)
  • $21 = 0 (Hard limits enable, boolean)
  • $22 = 1 (Homing cycle enable, boolean)

To enable hard limits you need limit switches in all directions.

Alternative 1: Homing with coordinates stored in the controller

Storing the work area home position in the controllers permanent memory:

  1. Insert a bit in the machine, preferably a pointy one so that it makes it easy to aim.
  2. Run command $H This command runs GRBL homing cycle. (It's speeds and distances are configured in the firmware settings via UGS.)
  3. Jog the machine so that the bit is pointing to the corner where you want the work area zero point to be:
  4. Run command: G10 L20 P1 X0 Y0 This command stores the X and Y position in the P1 (aka G54) memory.

Storing the probe plate position in the controllers permanent memory:

  1. Run command $H to home the machine. (The previously stored G54 work coordinate system is then chosen as default.)
  2. Jog the machine to above the probe plate.
  3. Run command: G30.1 to store the probe plate position in memory G30

Measure the probe plate height relative to the work bed:

  1. Run command $H to home the machine.
  2. Run command G30 to rapidly travel to the previously stored probing position
  3. Test the probing connection by holding something conductive between bit and the probe plate, you should see a reaction in UGS.
  4. Run command G38.2 F300 Z-130 this probes up to -130 mm in Z direction at speed F300 mm/min.
  5. The machine stops when it hits the plate
  6. Run command G92 Z0 to temporarily store the probe plate height
  7. Jog the machine so that the bit is just resting on the top of the work bed surface.
  8. Note down the Z position value from UGS. (Take a picture of the screeen.)

Make a home and probe cycle:

  1. Create a blank notepad file
  2. Paste these things in:

$H ;run GRBL homing cycle
G30 ;Go to probe position
G38.2 F300 Z-130 ;start probing downwards
G92 Z0 ;make probe surface z zero
G0 Z2 ;move up 2 mm
G38.2 F50 Z-5 ;probe again with extra slow speed for maximum precision
G92 Z### ;make probe surface Z zero again but with the offset we measured before!
G0 Z100 ;move up off the plate to be safe

  1. Find the ### characters and replace them with the offset you noted down in step 8 before.
  2. Save the file as home_and_probe.gcode, this file is your home and probe procedure.

To use a home and probe cycle, either:

  • Run the home_and_probe.gcode before each job
  • Create a macro by removing all the comments and adding the commands to the macro menu in UGS. Click that macro before each job
  • Add the code to your post-processor.

Limitations are that you need to keep track of what the Z offset value changes to after you plane the bed.

Memory slots and commands:

  • Work area zero position. Store: G10 P1 X0 Y0 Set as active: G54
  • Probe position: Store G30.1 Jog to position: G30
  • Tool change position: Store G28.1 Jog to position G28

Alternative 2: Homeing with all coordinates stored in a file

This method uses work-coordinates stored in a file and they are set each time you run a homeing file and stored as a G92 temporarly work coordinate offset.

This can be done by running a macro through UGS or running a gcode file containing the homeing procedure. This gcode can also be pasted into the start custom of post-processors so that it is run automatically before each job (which is safest).

Reference Gcode for homeing cycle

Future improvement ideas

  • The probe plate could be wired to the z limit switch pin, then grbl could be compiled to support homing of individual axis and run a second homeing towards the plate. Then a new coordinate system could be used to store the difference between the probe plate and the leveled bed surface.