A Grbl Raspberry Pi Hat

I have been making small scale CNC machines lately. I wanted a very small Grbl based CNC controller. I used the Eleksmaker Mana SE for the Coasty Laser. The big drawback was no access to the pins used for limit and control switches. I did like the modular approach.  The Stepstick style drivers are easy to find at less the $2 each and Arduino Nano clones can be found for less than $4.  There is no way I could even get the components for that price at the scale I am working at.

Edit: Now a few are available on Tindie.

(my hand tacked limit switch wires)

Raspberry Pi Real time Issues.

Raspberry Pi is great, but it cannot handle the real time requirements of CNC. Beagle Bone uses coprocessors (PRU) to get around this and there are some dual core devices like the UDOO NEO that have a second core that can be used for CNC. That got me thinking, why not just add the second processor myself. If I added an Arduino 328 processor connected by the hardware UART on the Pi, I would have an easy fix without any firmware development.

It’s a Raspberry Pi HAT…or not.

After taking Chris Gammell’s KiCAD lesson I wanted to make a Raspberry Pi HAT, but I typically don’t use a Raspberry Pi. I realized that the Nano could talk to either the USB or the Pi. The female header going to the Pi is out of the way and well protected from shorts if it is not used. You can therefore use it on the Pi or stand alone.

5V Power.

The 5V logic power can come from the USB connection or the Pi. There is a diode OR isolating the 2 sources. There is no on board step down supply, so this cannot be used if it is not connected to USB or a Pi.


The processor uses a standard Arduino Nano. This is a mini version of the Uno, but it actually exposes more of the I/O pins (A6 and A7).


3 Axis Drivers (+1 slaved)

The firmware is standard Grbl, so it is limited to 3 axes. I had room for 4 drivers, so there are 2 for Y. If you needed 2 on a different axis, you could simply edit the config file for Grbl. These use standard Stepstick / Pololu footprints. There are jumpers to select the microstepping value.


I added a big header for all of the I/O. All of the typically used signals have their own grounds to make wiring easier. A6, A7 and +5V are also on the header.


I added this at the last minute, just for experimenting. It is hooked to the Raspberry Pi PWM0 pin. If you wanted Grbl to use a servo for pen up type applications, you should hook the servo up to one of the Nano GPIO pins.

Using the Raspberry Pi serial port.

The standard GPIO header has UART Tx and Rx on pins 8 and 10.

This serial port is /dev/ttys0.  It is typically used for a serial console. You will need to disable this to use the serial port.  To disable type…

sudo raspi-config

To get the configuration screen. Select Advanced Options.

Select Serial.

Disable the serial login shell.

There are several ways to use the serial port with a basic terminal session. The most basic is ….

screen devttys0 115200

If you want a more interactive GUI, use …

cutecom.  You will probably need to install it

sudo apt-get install cutecom



Next Steps

  • I want to experiment with running full featured sender programs like BCNC on the Pi.
  • I will release the source and might sell some on Tindie if there is some demand. Unfortunately I did the layout in Diptrace, but I can release the Gerbers too.

Documentation (more coming soon after complete testing)






Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  1. No Comments