Setting up GRBL

OK. So iv been doing a lot of research, but i'm missing a few more pieces. Let me start from the beginning. I started off with the goal of making a cheap basic CNC machine, and have actually come pretty far. At the beginning I had just Arduino and some basic knowledge (how to blink an LED) and knew absolutely nothing about motors and other things that go into CNC's. Fast forward a few weeks, and I now have a setup of an Arduino flashed with grbl controlling 3 steppers using easy drivers. I don't know Gcode (I just learned what it was about a day ago), but I found this amazing program that I can upload pre-made Gcode files to, and it seems to work well. As of now, the steppers are not hooked up to my (half built) CNC rig so they just spin in different directions, kind of drawing in mid air. Before I set them up I want to know how I can zero all the motors, so that they move correctly within the dimensions of my machine. I assume i have to input the correct lengths of the XY, and Z accesses, but how do I do that?

Any help would be appreciated. Thanks!

You should probably look at the GRBL instructions.

I think it is the program that generates the G-Code that has to be configured to keep it within your machine's limits.

I've had a quick look at your link (because I may be interested in it myself). It looks to me like you can use the grbl-controller software to manually instruct the motors to move the tool to a start position. And, as @johnwasser said, the GCode just encodes the drawing that your part will be made from and the drawing size must match your machine.

I haven't quite figured out yet how one relates the initial tool position to the start point that the GCode assumes. I guess if the GCode is working with absolute coordinates it doesn't matter much what absolute coordinate you start from (as long as it's clear of the workpiece) if the machine is told, through the keyboard, what that is.

You could fit limit switches to the axes and arrange for the motors to drive until they trip the switches to establish a base point. I don't know how that relates to GRBL or to grbl-controller.


I myself have had my first play just recently with GRBL on Arduino, but have not actually controlled a machine with it. I just wanted to get a feel for it. I used the Universal G-code Sender software, which looks to be quite similar to the one you have linked, but I have no experience with your flavor. However, I also have operated a small 3-axis cnc router for a little more than a year or two, and can relay my experience.

As far as "zeroing the motors", I am a little confused by what you mean, so I will just explain what I do:

First, I draw the model in CAD in such a manner as to reference the model to the actual x,y,z zero point (origin) in the drawing. I typically create the model so that the origin falls dead center of the model in the x and y axis, and the top of the model lies at the z zero point.

So when it comes time to run the g-code program on the machine, I first simply jog each axis(I am assuming that this would be done under the "axis control" tab of the GRBL Controller software) to any appropriate location on the machine for the origin reference point, with strict consideration paid to the actual dimensions of the model to ensure the travel available on each axis of the machine will be sufficient.

I then re-zero the control software to that location (probably the "Zero position" button from the screenshot on your link), so that the machine control/machine now sees this location as the origin, and I run the program.

Now, I do realize that others use terms like "homing" the machine and I am not quite sure everyone's definition of this is the same. And as Robin2 said, you can use limit switches to tell the controller when each axis reaches its limits of travel, or some known reference point, but I have not used this process. My machine does not have the limit switches connected, and it is usually not a problem, although I have had the machine dig right down into the table until it snapped the cutter by accident several times.

"Before I set them up I want to know how I can zero all the motors, so that they move correctly within the dimensions of my machine. I assume i have to input the correct lengths of the XY, and Z accesses, but how do I do that?"

Again.....I am not quite sure exactly what you mean, but as long as the CAD models dimensions are smaller than the maximum travel of the respective axi of your machine, you should be good to go....There are lots of variables that change depending on the actual parameters of your machine, but in general, you can change the "tuning" of the machine via GRBL without having to re-flash the Atmega. You can find more on this information here: and
Configuring Grbl v0.8 · grbl/grbl Wiki · GitHub
... but I assume you are familiar with this if you are to the point of running steppers with GRBL. Basically, you can use the serial monitor in Arduino IDE to change parameters like steps per mm or maximum velocity,etc., by entering the appropriate number and $, and then changing the value. ...for example enter "$0=200" if your machine x-axis uses a 200 step per revolution step motor, full stepping, and the stepper directly drives a leadscrew that turns 1mm per revolution. So if you are microstepping at say...1/4 steps, then you would enter "$0=800", (4 x 200) provided everything else remains the same.

hope this helps,


Bill, that's really helpful information.

I have been searching without success for something similar in the CNC and Reprap forums for a month or two. I hope you don't mind if have more questions for you when I get back to developing my CNC micro lathe / 3D printer.


@ Robin2....Thank you for the kind words. I would be happy to assist if I am able.

Keep in mind that I am very new to this forum and may not check here often. But feel free to contact me via PM/IM if you like, so as to not hijack this thread from the OP, unless of course the content is related. I also use the same username at and and, if memory serves, I have those accounts set up to send email notification of any PMs received. I am uncertain of my settings on this forum, I will have to look.


GRBL supports the addition of limit switches and includes the code to make homing automatic.

Connecting Grbl · grbl/grbl Wiki · GitHub describes how limit switches are connected. Pins 9/10/11 would be connected to a normally open switch (when closed connects to ground). Typically a lever microswitch is used. When your moving (whatever) presses against the switches and closes them then GRBL uses that as your zero reference for that axis.

Configuring Grbl v0.8 · grbl/grbl Wiki · GitHub describes the homing process further.