GRBL Settings 101: A How to Guide

A picture of a gShield

Once your gShield is powered on and you have the stepper motors moving. It’s time to dial in the machine movements to create the desired motion by updating the GRBL settings. This is done using the command line interface which in my case is accessed through the Universal Gcode Sender.

Start Here

If you don’t already have Universal Gcode Sender and GRBL installed, click here for a step by step guide to setup your DIY CNC Controller.

grbl settings: Universal Gcode Sender Main Screen

Universal Gcode Sender Main Screen

Display Current GRBL Settings

There are quite a few GRBL settings that we can adjust to get our CNC machines to do exactly what we want. I found it was easier to refer back to a single sheet while setting up my machine as opposed to going back and searching the GRBL wiki page. To download a copy of this cheat sheet, click the link below.

Get Your GRBL Pocket Guide Here

 

The first step is to see your current settings. Type “$$” to display the available user defined settings in the console window.

For a complete list check out the GRBL wiki available by clicking here.

Here, we are interested in the “Steps/mm” settings.

$100=314.961 (x, step/mm)
$101=314.961 (y, step/mm)
$102=78.740 (z, step/mm)

Note these were not the default settings on my system. How did I get 314.961? Good question. All it takes is some quick math and a few pieces of information.

     Lead Screw Pitch = .200 inches (inches per revolution)

     Stepper Motor # of Steps per Revolution = 200 (steps/revolution)

     Micro Stepping Setting = 8X

I am using .200 inch pitch lead screws, my stepper motors are 200 steps per revolution and my stepper motor controller is set to 8X micro stepping for the x & y axis.

Calculating the “step/mm” Value

Lets break it down one step at a time.

Example calculations demonstrating how to find the step/mm value for your grbl settings

Example calculations demonstrating how to find the step/mm value

After a few quick calculations you have the values you need. Update the GRBL settings by typing the following into the command line.

$100 = 314.961

This will set the X axis steps per mm. Repeat the process for the Y and Z axis using $101 and $102 respectively.

Note the Z axis setting is different because I am running a lower micro stepping count of 2x to get a little more power to lift the head of the mill.

Final Thoughts

Remember, these are just initial values to get you int the ball park. We will need to use a dial indicator and tweak the values to get the most accurate motion. More on that in the future.

Are you building a CNC mill? Are thinking about building one? Are you simply fascinated by CNC machines like me? Tell us what you want to make in the comments below.

Thanks for reading. Until next time…

Tim

12 Comments

  1. GARY

    MY GOAL IS TO BY A MINI MILL AND CONVERT TO CNC. I HAVE A ARDUINO/CNC SHIELD WITH A COUPLE OF STEPPERS THAT I AM PLAYING WITH. USING CAMBAM FOR GCODE & CHILIPEPER FOR DRIVER. I HAVE SUCCESS IN MANUALLY TYPING IN GCODE AND GET STEPPER MOVEMENT & JOGGING. BUT NO SUCCESS IN GETTING A LOADED PROGRAM TO RUN?
    I AM SURE IT IS A SIMPLE SETTING, BUT SO FAR IT IS BAFFLING ME. I AM TOLD ITS IN THE GRBL CONFIG SETTINGS, BUT I YET TO GET THE RIGHT COMBO.
    GARY

    Reply
    1. Tim (Post author)

      Gary,

      I appreciate the comment. Nothing worse than getting so close to finishing a project and one little setting is keeping it from working. I have never used CAMBam or Chilipeppr, however, I did not need to make any changes in my GRBL settings to run a gcode program. Have you tried running the sample circle code from the GRBL GitHub site? https://github.com/grbl/grbl/wiki/G-Code-Examples Scroll all the way to the bottom of the page. Copy and paste the gcode into a text editor and save as a .nc file. Try opening this and running it with Chilipeppr. If it works, we know there is something that needs to be adjusted in CamBam. If my explanation of the .nc file creation was not clear, just send an e-mail to me Tim@diymachining.com and I will reply with the file attached. Let me know how it goes.

      Reply
  2. udaykumar

    hello tim
    nice work it make me very easy to understand about grbl and i am having a doubt when the jumper are used to short to get the microstepping so how can we programm in grbl to get microstepping
    i mean i need 0.8mm per rotation so how could i accomplish that after shorting the ms1,2,3 etc and i would like to learn about limiting current for a4988

    Reply
    1. Tim (Post author)

      Udaykumar – I appreciate the feedback. You are right to want to set the microstepping first. Keep in mind, microstepping is a hardware setting and cannot be changed in GRBL. You will need to know your microstepping setting to enter your steps per mm value in GRBL. You will also need to know the mechanical setup of your machine. Feel free to email the details to me and I can walk you through the calculations.Tim@diymachining.com
      To set the current, you use the trim pot on the board that holds the A4988 driver. I simply increased the current by adjusting the trim pot until my machine ran smoothly at the maximum speed and acceleration I wanted.

      Reply
  3. Gururaj

    Hi Tim,

    Thanks for this explanation. It helps a lot. I have constructed CNC m/c with Arduino Grbl shield and DRV8552 controller. Following are few details.

    1) I have used T8-2-D8 T8 screw 8mm, 2mm picth, 8mm lead trapezoidal screw.
    2) Stepper Motor is 1.8 Deg/Step or 200 Steps/revolution.
    3) No micro-stepping used. So micro-stepping = 1.

    When I rotate the lead screw by hand and make one complete revolution, I measured my axis is moving 8mm. That’s matching the “lead” information given point 1) above.

    My question is if 200 steps gives me 8mm, then 25 Steps would give me 1mm. But according to the calculation given in this site it will be

    200 steps/2mm pitch = 100 Steps/mm.

    So $100= ? 25 or 100? Please suggest me.

    Reply
    1. Tim (Post author)

      Gururaj – Congrats on building your machine! You are correct, your $100 setting should be 25. Unfortunately, the terms lead and pitch are often used interchangeable. This is fine if you have a single start screw. However, that does not work when you have a multiple start screw. As you correctly pointed out, we are interested in the lead. The amount of linear distance per revolution. I will update the post to clarify lead, pitch and starts. In your case you have a 4 start lead screw. Lead/Pitch = # of Starts

      Reply
      1. Guru

        Hi Tim,
        Thanks for reply and clarification provided..
        I found one issues in my setup. I was using grbl_v0_9a_edge_328p_16mhz_9600_build20121210 and the configuration are completely different. I reinstalled grbl 0.9j Atmega328p 16MHZ 115200 17 04 2016 _2.hex now I can see X,Y,Z max limits, enabling soft limits etc…

        Tim, if I set $100=25, its moving very slowly which does not look normal to me.
        But if I set $100=100 axis is moving quite rapidly.(I have not measured the distance its moving.) I am still wondering which is correct setting for x,y,z step/mm… Now learning how to get homing, soft limit and limit switches working.

        Ya I agree with you. It will be great help if you could post few information about lead, pitch, # of starts and how that will effect steps/mm.

        I wanted to post pics of my machine and the lead screw, but did not find file upload option here. If its available please let me know..

        Regards,
        Gururaj

        Reply
        1. Tim (Post author)

          Gururaj – Good catch on the software version. I am confident the $100 = 25 is correct. Once you verify the setting by measuring how much the axis actually moves compared to the commanded distance you can adjust the speed. To change the speed you will want to play with the $110,$110 & $112 settings. Sounds like you are making great progress. Currently, there is not an upload option. However, if you email the picture(s) of your machine to me, I will post them. Tim@DiyMachining.com

          Reply
  4. TheKvc

    Awesome Teaching skills!! I really appreciate your work alot.

    I’m making a small CNC Setup using arduino, but here in INDIA, I can’t find GRBL sheild for direct converting everything into CNC. SO, I need to make the whole layer of code by my own. And your explanation helped me alot. I’m still working on it. But, i think it needs more time than i thought.

    Can You help me in any aspect?
    Any suggestion about my situation, would be highly appreciated. 🙂

    Reply
    1. Tim (Post author)

      TheKvc – Glad to hear you are going to build a machine. The GRBL code which is stored on the Arduino should be available world wide. Sounds like what you need is the hardware layer (stepper drivers) to connect the Arduino to the stepper motors. There a any number of drivers that will work with GRBL and the Arduino. There are several stepper driver options provided here… https://github.com/grbl/grbl/wiki/Connecting-Grbl

      Reply
  5. Hamid

    Dear Tim,

    I am so happy to relationship with you.
    I have an Arduino Due board and i want to make a 3 or 4 axis milling machine?
    Can i use of Due,for your suggested Grbl controller?

    Thanks and regards,
    Hamid Rafiee

    Reply
    1. Tim (Post author)

      Hamid – Thank you for the comment. While not traditional, it seems like it works. Check out this discussion for more details https://www.synthetos.com/topics/limit-switches-with-tinyg2-arduino-due-gshield/

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *