1. Running Grbl Controller on Raspberry Pi

Grbl Controller 3.2 on Raspberry Pi

(Thanks to bobt on the Shapeoko forum for providing the basis for these steps)

Assuming you have the Raspberry Pi running in the GUI, open a command window (LXTerminal) and perform the following commands. Bob suggests a 8GB card, but this works on a 4GB fine – I started with about 40% SD card space in-use using the df command and ended up at about 60% use after I got it running. He is running the older 256MB, I am running the newer 512MB pi:

NOTE: All these steps in sequence may take close to two hours to complete due to the slow processor on the Pi.

  1. sudo apt-get update (required for AlaMode)
  2. sudo apt-get install xrdp
  3. sudo apt-get install arduino (required for AlaMode) [For normal Pi, this step is optional, but good to have. NOTE: I got an error that not all items could be downloaded. I tried to repeat command by adding a --fix-missing, i.e. sudo apt-get install --fix-missing arduino but it didn't help. UPDATE: The latest download as of May 2013 doesn't have this problem]
  4. sudo apt-get install libudev-dev
  5. sudo apt-get install qtcreator [This step takes quite awhile to complete. Note: I got an error downloading as in a previous step. If you get an error, repeat command but add a --fix-missing, i.e. sudo apt-get install --fix-missing qtcreator, in this case the --fix-missing worked.]
  6. sudo apt-get install git
  7. mkdir github
  8. cd github
  9. git clone https://github.com/zapmaker/GrblHoming
  10. curl http://www.shapeoko.com/wiki/images/6/6a/Coaster.txt > Coaster.nc
  11. cd GrblHoming
  12. qmake GcodeSenderGUIthreads.pro
  13. make
Make sure that you have your Grbl/Arduino plugged into the pi prior to running the last command:
Pick /dev/tty/USB0 as your port and click Open. The status window should report the Grbl version.
If you wish, you can connect to your Raspberry Pi via RDP from a Windows PC (or Mac):
  1. Determine the pi’s IP, open a terminal window and type ifconfig
  2. In the Windows PC, open Remote Desktop Connection and enter the IP that is associated with eth0 (or the wifi interface, if using that).
  3. You should see a login screen that originates from the pi. Enter pi as the user and raspberry as the password.
  4. This is not like VNC, which means you have separate sessions for each RDP connection in. If you are not running headless, you first need to close any GrblControllers that are running, such as on the monitor connected to the pi, then in the RDP window, open LXTerminal, go to the GrblHoming folder and type ./GrblController as noted above

To update your code with the latest version, open a terminal window to the existing GrblHoming folder and perform these commands:

  1. git pull
  2. qmake GcodeSenderGUIthreads.pro
  3. (optionally perform a make clean)
  4. make

then run as usual.

How to tell if you need to make clean? Usually sub-minor build number increments (i.e. 3.3.2->3.3.3) do not require make clean. But minor revs probably will. If in doubt, make clean. Compiler errors definitely mean do a make clean.

Possible Hookup Configuration

I’m using a Belkin F5U234 hub which is rated by elinux to support powering the Raspberry Pi and also provide USB hub capability. This is evident in the picture below where the hub is connected to the pi in two places. Check out this site:


52 thoughts on “1. Running Grbl Controller on Raspberry Pi

  1. Hi,
    Congratulations for realizations.
    Now I work to finish my first CNC. My machine use grbl and shield with pololu drivers
    I have a Raspberry board with 258MB and I have a question.
    You powered the arduino from usb port from raspberry?

  2. Hi Florin-

    Yes, it is possible to power the arduino from the usb port of the raspberry pi. According to this page the pi passes the power straight across. The page implies the pi’s power requirements are a maximum 300 mA for your model, 700 mA for the 512 MB. Ideally, find a power adapter that can deliver 5V at 800mA or more. Best be safe and have a 1A supply.


    This page indicates the pi uses about 500 mA of that:


    Thus, for a headless approach (you RDP into the pi via Ethernet), you need about 500 mA for the pi, 50-75 mA for the arduino and 100-200 mA for the shield (it is probably less than that). I personally like the idea of using a hub as it provides protection between the pi and the arduino, but I understand that it raises the cost and complexity of the hookup.

    Note – I haven’t personally tried such a configuration because I use the hub, but others on the shapeoko forum have and they are running fine.

    • Thanks for your ideea.
      I have an usb hub with power.
      I have in plan to use arduino+grblshield connected at rapsberry pi where I run xrdp or another vnc server and an tablet with android conected at raspberry pi using wireless network.

  3. What you say for this setup?
    Arduino+grbl with bluetooth and tablet pc with grblhomening ported at android with necessitas http://necessitas.kde.org/

    • Very cool – I like the idea of running it on Android and it has QWidget support, which is a big deal. I just need to find someone to try porting it :-) Kind of busy these days.

      • Look this
        I am not very good programator but not was very hard to ported.
        Was necessary to make some modifications:
        define tcdrain in termios.h

        static __inline__ int tcdrain(int fd)
        return ioctl(fd, TCSBRK, (void *)(intptr_t)1);

        change line 18 in rs232.h

        #if defined(Q_WS_X11) || defined(Q_WS_MACX) || defined(Q_OS_ANDROID)

        change line 36 in rs232.h

        #if defined(Q_WS_X11) || defined(Q_WS_MACX) || defined(Q_OS_ANDROID)

        • I have it compiling properly in Qt Creator for Android. Now I just need to build the apk and test it. I like the screen capture you linked, it needs a little tweaking and probably needs to have the bluetooth com port figured out, but other than that, may not be too much work, I hope.

          • For *.ui is not more work.
            In screenshoot I use aplication compilated with lib static. With ministro instalated the background is black. Now I tested with my Samsung Galaxy Tab 2 7.0 and aplication start. For this device I use api 14. Now I make update to my device to android 4.1.1. I have also as “istoric” device with android 2.3.3 and 256MB memory with this device aplication not start.
            Now is necessary to put posibility to choice the bluetooth device (port).

  4. Just tried “git clone https://github.com/zapmaker/GrblHoming” and after login it says “https://github.com/zapmaker/grblhoming/info/refs not found”

    I’m using a Pi as headless but I really don’t know what I’m doing with github and Linux. A link to my build if you want to see what people are using. [zapmaker edit - I removed the link as it responds with "The requested topic does not exist."]

    • Hi Jason-

      For a public git repository like mine, you should not be required to login when doing a clone! That may mean you mistyped a character (the URL is case sensitive, but what you have looks correct).

      Are you getting a “Username for ‘https://github.com’:” ? If yes, that is a symptom of an incorrect URL.

      I did a test and git clone https://github.com/zapmaker/GrblHoming worked on my pi just now.

      Also, your link to your site came up with an error, requested topic does not exist. Thought you might like to check and see why.


  5. I had no idea that this was case sensitive. Upon fixing my error it ran perfectly until qmake.
    Command: qmake GcodeSenderGUIthreads.pro
    Failure to open file: /github/GrblHoming/Makefile and Unable to generate makefile for: GcodeSenderGUIthreads.pro

    I don’t know why my thread wasn’t showing up right. It came off the local makerspace site. Anyway, I’m running the Panucatt CNC controler, 12v 30a supply from amazon, belkin 12v usb charger for Pi power, and of course the Pi running TightVNC via Wifi.
    I can’t find my calipers so the pipe cleaners and cardboard are a temp base.

    • I do see one odd thing in the output – it is saying it is having trouble opening a file /github/…. If there is no period in front of /github, that means you placed the files at the root of the drive (sdcard). To do this you must have done a sudo mkdir github because the pi won’t let you just do a mkdir at the root level. If this is true, may I suggest you create your github folder in your home folder, i.e. cd ~ then mkdir github then cd github then git clone https://github… etc. and follow the rest of the instructions.

      I did some investigating and the thread isn’t showing up because Dallas Makerspace forum is private, so you have to log in to see content. Let’s not bother with that – instead, I like what you are doing with the pi. For long term use, make sure you keep it and the controller dust free (put it in a case). I haven’t done that yet with my controller, but hope to soon.

      • oddly enough I I just tried the qmake and make steps and it worked perfectly. I have no idea why as I didn’t change anything. THANK YOU ZAPMAKER!!!!!!

  6. hi, i’ve built a 3 axis cnc, i was going to use a db25 paralel connection to connect the (windows) pc (running kcam) to the stepper driver, but that would necessitate a lot of fans and pc parts to get gunked up in the workshop.
    i resolved to use a raspberry pi, with the default distro to send gcode to the arduino by usb. the ardunino, running grbl then sends signals to the stepper drivers.

    i haven’t recieved the arduino or the motor drivers yet (they’re in the mail), so i haven’t done any testing.
    the only thing i’m not clear on is a decent linux native cad/cam software which can be used to do some basic designs, then support pushing this data out usb, are yyou doing any of this in your project?

    • I’m not the best person to ask as I do my CAD on Windows (mainly use CamBam but also happy with HeeksCNC, once I figured out how to use it – HeeksCNC actually handles 3D STL more accurately than CamBam, but CamBam has a nicer interface and works great for 2 1/2 D).

      The reason I’m harping on these is that there is a Linux port for CamBam, but it does cost $ and it isn’t technically officially supported (you kind of have to be technically knowledgeable). HeeksCNC is free, but not sure how much work to get it running on Linux.



      I strongly recommend you use a reasonably powered Linux PC, don’t use the raspberry pi for your CAD designs! It is not powerful enough. Check out this topic:


      And of course, don’t forget Edward’s makercam…worth a look

      Visit some forums and see what users are saying about these and other Linux tools. Hope you find the right software.

  7. Hi, Is there a way to add a custom port name ? I’m using a Raspberry-Pi with our Alamode and grblshield v4 as a controller for my ShapeOko CNC mill build. The Alamode is on ttyS0. I managed to follow your excellent instructions and GrblController works on my Pi, but can’t make it talk until I can set the correct Port.
    PS: I’m a hardware guy, so my knowledge of Linux is pretty limited at the moment.

  8. I will add that capability in the next version. If you are desperate, I have branch code that Florin helped modify on github that allows manual entry of the port. It is fairly new code so it should work fine for your purposes.

    It is in a branch called qt5. To get it, do the following and build as usual. I’ve built and run it on Windows using the older qt4 and it works – not sure about the pi, hopefully it will work for you.

    git clone https://github.com/zapmaker/GrblHoming
    cd GrblHoming
    git checkout qt5

    • I have modified the code to allow optional manual editing of the com port field. Pull down the latest changes and build and see if that works for you. The version will show 3.3.7. The above instructions are no longer necessary. Note- It is only in the source tree. I haven’t created a Windows versions, so it will only work for self-built code like the pi.

  9. I had to pull your qt5 branch in order to build it on my xubuntu 13.04 system. It was giving me build errors on the master branch.

    • Thanks for the heads-up. It is possible that either your system has a newer Qt that requires the changes in my qt5 branch or there are localization problems with the master branch. A user helped me fix the localization problems in the qt5 branch. That is a good branch, but doesn’t have the latest features.

      Also, the latest beta is in the to34 branch that incorporates the code in the qt5 branch. I don’t know if it will compile on the pi, but probably will compile on xubuntu and Windows with Qt5. This has the latest and greatest code that hasn’t been fully tested. I mention it in case anyone wants to beta test as I add features for my upcoming 3.4 release. I’ve added a z-slider jog capability that is mostly working.

  10. Hello,
    do i really need an alamode or an arduino?

    I want use one of these two boards:

    I just need it for a 2D laser plotter

    Is it possible to run grbl with one of these boards?

    Thanks for answer :)

    • You don’t need the Alamode. The picture on this page shows a normal Arduino Uno connected to the Pi via USB. The Alamode eliminates the USB cable and having the additional board floating by itself.

      If you want to run grbl on an arduino, those boards won’t help. You need a stepper shield for the arduino like Grbl Shield (https://www.inventables.com/technologies/grblshield-v4–2). Also, you will need to change the firmware on the arduino chip to use grbl.

      If you want to run straight on the pi without an arduino, you will need boards something like the ones you linked, but I have no experience in what software to use with them (LinuxCNC? Check out this link http://wiki.linuxcnc.org/cgi-bin/wiki.pl?action=browse&diff=1&id=RaspberryPi).

      So to summarize: A known working solution is that you need a standalone arduino uno with a stepper shield attached to it. Then connect the pi to the arduino via USB. You can then run Grbl Controller on the pi to control the arduino.

      [EDIT] – technically it is not an UNO in the picture, but an older board. The preferred board to use is the UNO.

  11. Thank you for your great work!
    My mill is running perfectly using grbl on an arduino uno and Raspberry Pi with your software streaming the g-code.
    My question is: Is it possible to change GUI’s size? I would like to use a simple VGA LCD display connected to Raspi by an adapter. Unfortunately my monitor only supports 600×480 resolution.

    Using my laptop everything is working perfectly!

  12. Pingback: How to create an Open Source CNC | Alan C. Assis

  13. HI.

    Just installed this on one of my pi’s and it work 100% without any problems.
    Thanks for your great work.

    Running on pi with Freetronics Eleven (100% Arduino Uno Compatible) and Arduino CNC Shield from (http://blog.protoneer.co.nz/arduino-cnc-shield/), ShapeOko cnc router


  14. Hey, I really like what I see here. But when trying to install I get an error:
    “PROJECT Message: Warning: unknown QT: widgets”
    What can I do about this? And why does is work for everyone else?
    I followed the steps exactly as described.

    • Turns out that is not an error, everything should still be ok if you continue the steps. That is a problem between Qt 4 and Qt5 which I don’t have a fix for at this time, so you will have to view the warning whenever doing that step.

      However, if it is really is failing to build when trying to complete all the steps, please let me know and I will investigate, just provide me some more info on exactly where it doesn’t complete compiling.

  15. I’ve just tried to download this, but I’m having problems. Every time I try to do all of this, the pie stops responding, or doing anything. I can’t move the mouse, type or anything. I have to unplug it, but when I try to redo it the next time, it tells me that dpkg did not execute right or something, and to manually enter that command. I do so, and most everything works up to “qmake” where it tells me that it cannot find the command.
    I have never really used Linux before, any idea what’s wrong?

    • Make sure you have enough SD space. Open a terminal window and type df
      You should see rootfs with Use% of 90% or less.

      Then type free
      You should have about 328000 MB free for Mem and you should have about 102000 for Swap (these are rough numbers, give or take 20%)
      When you first setup the pi, there was an option to ‘expand file system to fill available space’, make sure that you did that otherwise your SD card could be partially used squeezing all your apps.

      Another possibility is that something has changed with the qt distributions. When i get a moment I will test and see if the steps work from a clean slate.

  16. Pingback: Shapeoko | Versatile Inventions

  17. Hi Zapmaker! Nice work! I just wanted you to know that Grbl Controller 3.5 is not working with grbl_v0_9a_edge_328p_16mhz_9600_build20121210.hex on the Arduino. It said “No Data From COM Port After Connect.Expecting Grbl Version String” no matter what I did. But after i flashed my Arduino with grbl_v0_8c_atmega328p_16mhz_9600.hex it worked! Just wanted you to know. Am I doing something wrong or is the Grbl Controller 3.5 not supporting grbl version 0.9a?

    Best Regards / Axel

    • Unfortunately I can’t find that build of grbl on the grbl site at https://github.com/grbl/grbl. The one I’ve tested with is 0.9c from 2013-03-19 and it works on Windows and Raspberry Pi Grbl Controller version 3.5.

      Are you able to try the newer version? Alternately, can you send me a link to the version you are using and I’ll try it out? Thanks.

        • My apologies, I meant 0.9a, however, if you look, the version they have on https://github.com/grbl/grbl is newer than the version you have because the date in the filename is newer. Can you try that? I can’t find the dated version of 0.9a you have.

  18. Hi
    Can you help? I have grbl controller v3.6.1 running on a pi and just updated to latest version using git pull etc. It all seems to work except the homing.
    I have $17=1. The hard limits work. I enter $H in the command line and nothing happens. I have to reset to enable G code entries to work again and I get a message saying $H is a bad command. I was hoping that it would automatically home on switch on also. what am I doing wrong??

    • I ran some tests with both grbl 0.8c and 0.9a and am able to home using $H with mechanical limit switches. Running Grbl Controller 3.6.1 on the pi.

      I was able the get the Bad Command for $H when I set the invert mask for homing ($18) to be the same as for the normal mask ($6). I would try setting $18 to 0 and see if that helps.

      In general before setting up homing: Make sure that your settings are all correct, i.e. the steps per mm, etc. i.e. if you tell X to move 10 mm, measure to see if it really moved 10 mm. I had problems when I just used defaults causing my steppers moving too short a distance, which caused everything to run too slow, which caused homing to be flaky.

      And it can cause problems if the invert mask is wrong. What should happen is the Z stepper will move the spindle up until you hit the upper limit switch. Then immediately it will turn on both X and Y steppers and move the spindle to the back right and stop on each limit switch. Then immediately it will do a backoff for a few seconds and stop.

      Look at section $17 on this page for more info on how the spindle is supposed to move:


    • There is another situation where you get Bad Command – if grbl has entered into either a limit or command lockout condition (see $17 in the grbl manual). To solve, first do a unlock $X followed by a soft reset (Ctrl-X) – which correspond to Unlock Grbl and Soft Reset Grbl buttons on the Advanced tab of Grbl Controller – before issuing a G command or $H command.

      It is possible to get into the state if you get some electrical noise on the input pins from the limit switches. Try using shielded wires with the shield tied to ground. I have tried using capacitors of 100pf from input to ground which seems to help for unshielded cables. If the capacitors are too large I have trouble getting a com port connection to succeed. Basically avoid unshielded cables.

      I am putting it on my list to improve detection of this condition and improve homing/limiting handling in Grbl Controller overall.

      • Hi,
        I have tried the points you mention and still no joy!
        To recap, I open the port, soft reset, and I get a line, “$H” $X to unlock. I input $X and get “caution unlocked”. I then input “$H”
        At this point nothing happens, no drive outputs. “$H” stays in the command line and is also in the log page below.
        I then have to do a soft reset to recover control and I get a message “$H bad command”
        I have been using $18=0.
        I have tried changing $6 but normally set this to 192. I have tried various settings for $6 and $18.
        I tried using a laptop instead of the pi and I have reloaded the code in the pi and adruino but always have the same result. I understand your point re interference but all the other functions work ok, even the hard limits. Not sure where to look now but will keep trying. I am a plc man and not great with C but it seems to me that the drive output enabled by the $H command must be conditional on something I am not supplying. Help!

        • What I’ve found is that you have to do a $X and then follow immediately with a control-X (which is done via the button). It is possible you are trying to issue $H before the control-X.

        • I am considering this a top issue because it is causing confusion and grief with grbl – I don’t know why it is coded the way it is so hopefully I can work aout a way to automate the recovery within Grbl Controller.

      • Just a bit more info.
        If I set $17=0, homing disabled.
        Then if I enter $H. Then I get a message “setting disabled”.
        So clearly the command $H is not a bad command as it is recognised.
        So why is it not recognised when $17=1
        I am using controller version 3.6.1 and grbl 0.9a

  19. Hi there
    Just wondered if there was any progress regarding the homing. It’s really
    a fundamental requirement for an absolute position system without feedback.
    Regrettably my knowledge of C prevents me from helping but would be interested in looking at the section of code that does the homing if you could point me in the right direction!

  20. Pingback: Raspberry Pi Alamode CNC Controller -Use Arduino for Projects

  21. Hello

    Thank you for everything so far, looking forward to further development.

    I am just starting out with CNC. My eShapeoko is on pre-order, I already have some of the electronics wired to RPi and Arduino to test out various build options for the controller. Early versions used my MacBook in place of the RPi, however RPi is my favoured permanent solution due to its size and price. I have a small touchscreen TFT on order for the testing as the ‘input’ device for this and other projects. I’ll probably only be able to use the jog arrows for proof of concept, due to the size of the screen, but hope a larger screen might be available soon.

    I wanted to add my vote for any development you might be planning for use of Grbl Controller with RPi, particularly anything needed to support touchscreen control.


  22. using Raspi Jessie, I kept getting errors on the qmake step, until i found a solution

    Under some distros like Debian Jessie Stable you can do the follow :

    sudo apt-get install -y qt4-qmake qt4-dev-tools
    sudo update-alternatives –install “/usr/bin/qmake” “qmake” “/usr/bin/qmake-qt4″ 40
    sudo update-alternatives –config qmake

Leave a Reply to smerwin Cancel reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>