Grbl (Arduino G-Code Processor) – Pin Layout

Grbl is an opensource software that turns your Arduino development board into a full blown G-Code interpreter.

Below the layout of the pins on the Arduino board. Each Stepper Motor Driver needs to be connected to the following pins:

  • Stepper Driver Enable/Disable – Pin 8
  • Direction – Pin 5-7 depending on the Axis(X,Y,Z)
  • Stepping Pulse – Pin 2-4 depending on the Axis(X,Y,Z)

Limit Switches prevent the machine for over extending each axis and are connected to Pins 9-11.

Grbl also allows for Spindle control with Pins 12 and 13 and  coolant control with Pin A3.


UPDATE!!! We have given back to the GRBL project and developed a ARDUINO CNC SHIELD that is 100% GRBL compatible.(Click here for more details)

If you are interested in making your own CNC machines we recommend you have a look at the following books:

  1. I built it. I connected it. It doesn’t work. I took the DRV8824, connected it independently, and got just a hum noise (no motion). So I know the driver is trying to do something, but when placed in the sockets of the shield it doesn’t twitch or hum or anything indicating a spark of life.

    What am I missing here?

    • Hi. The drivers will usually not make a sound on the shield while they are not stepping. (Its a setting in GRBL that switch them off while not being used.) are you running GRBL?

  2. In case of use with a laser, which Pin do you use for switching on/off the laser, can you adjust the power of the laser with PWM and which software do you use for creating such G-Code (including power on/off and PWM).

    Thanks 🙂

    • Hi Thomas. I use the Spindle Enable pin to switch a relay that controls the laser. At this stage I have not use PWM because my cheap laser does not have an input for it but ther are a few poeple on the Github GRBL site that has done and PWM implementation. I think switching the Spindle enable pin is M5 and M0 stops it.

  3. Hi! i wish to know if this shield supports the coreXY configuration… anoter question, is avaiable any version made on single side PCB?.

    Thanks you very much!!!

  4. I have another question for you. My A4988 drivers don’t drive the motors unless the sleep & reset pins are connected. How do I do that? Using the code for the enable pin, high or low, doesn’t help.

  5. Does this work with Arduino Uno only or does it work with Arduino Duemilanove and other boards?

    I am looking to use Arduino with three DRV8825 drivers along with GRBL and Universal GCode Sender. Would this work?

    I have also seen some clone boards with CH340G USB to Serial chips, would this code work with these boards as well?

    Thanks very much.

    • Hi. This works with the Duemilanove as well. The DRV8825’s will work but I recommend that you add heat sinks as they do run very hot. The boars with the CH340G work fine.

  6. No good luck so far. I can’t get it to do anything. The motors don’t hum, buzz or move. I’ve downloaded grbl 9 and flashed it, I’ve downloaded your library and nothing.Do you know of any way to test the individual pieces? I even used a breadboard for the drivers and nothing.

    • okay, the best way to debug this is to use a multimeter. Start by testing the power supply. Be sure to always have the steppers connected tot he drive before powering up. test if the enable pin is the correct level. Test it the direction pin is not floating(Needs to be 0v or 5v). Next start pulsing the stepper pin on and off.

  7. Success! I connected one of my RC plane Lipo batteries and the motors turn.

  8. I have built a cnc drilling machine which works well using your pages as a guide, but this morning I decided to add the travel limit micro switches. Earthing pins 9 to 11 makes no difference. Does anything else have to fitted or a setting changed?

      • HI, Just discovered although I changed the enable to 1 I didn’t press return to save it. Thanks for your advice.

  9. I am planning on using GRBL to convert a mini-mill to CNC by connecting external NEMA 23 Stepper drivers through a breakout board to the Arduino running GRBL. I’ve standardized on using the MEGA 2560 and DUE for other projects and would prefer to use one of these.

    1. I presume the DUE is not GRBL compatible as it has no EEPROM.

    2. Can the MEGA run the basic GRBL code set without mods?

    Other thoughts…I thought I would build a DUE with a small LCD screen into a front end as a manual simple operator control panel that would drive the MEGA serial port (just like a PC would) I want to include a few basic milling functions as part of the panel. Also,It would be fairly easy to iinclude an SD memory card reader to eliminate the need for a PC to drive the system. You throughs?

    • Hi Ed. There is an option to compile GRBL on the Mega if you go to the config file. You are right about the Due not being the perfect fit… A bit of a shame but that’s life. I don’t want to say anything yet, but I would suggest you subscribe to my mailing list as I will be making some announcements soon…

  10. I have made an X-Y plotter using grbl flashed in Uno.I have connected the motor pins with step and direction and have kept the enable pin open.My plotter doesn’t draw straight vertical or horizontal lines other than that it works perfectly.Is this problem coz of the enable pin?If Yes,what should I connect with the enable pin?

    • Hi. If the steppers are moving it would indicate that the enable pin is working. Not sure what you setup is like, but it sounds like an mechanical issue. Using two motors on one axis could also cause this if they are not totally synced.

  11. hi Bertus Kruger
    First, thanks for all the nice tutorial!!

    I have a CNC shield v3, arduino uno, DRV8825 and 2 phase stepper

    I want to control the stepper through the CNC shield but with the arudino stepper library (Stepper.h).
    I have a little problem with the pin setting, e.g. if I want to control the x axis do I just use pin 2 and 5?
    e.g. Stepper stepper(STEPS, 2, 5);

    Or I cant really control the CNC shield by the stepper library, I have to use GRBL?

    Thanks for your kind help

  12. Hi Bertus Kruger
    Could you please teach what pin (e.g. XYZ axis). do I need to use if I want to use arduino stepper library “Stepper(steps, pin1, pin2)” to control CNC shield
    Thank you!!

  13. Hello.
    Can i use arduino mega 2560 to replace arduino uno?
    How about the code and where the pin i used?
    Thank you…

  14. Pingback: GRLB ARDUINO Flash – rc0