Using The Grbl HAT

Getting the Kit

The kit is available in my Tindie shop.

Getting the plug-in modules

The kit does not come with the stepper drivers or Arduino Nano modules. The point of the design was to keep costs low by using modules. At this time I cannot sell the modules anywhere close to what you find them for at other retailers. You must get them on your own.

  • Stepper drivers: I think the company that first set this form factor is Pololu. There is also an open source version call the StepStick. They typically use the A4988 driver chip from Allegro, but compatible modules with other chips are also available. You should search Pololu, Amazon, eBay or AliExpress for StepStick or A4988.  Make sure it has the pinout shown below (as viewed from top) and will work at 12V. You should be able to find them for around $3 each. It is best to get ones with heatsinks, so they can run at higher currents.


  • Arduino Nano: The Arduino Nano is a small version of the Arduino Uno.  It uses the same microcontroller chip as the Arduino Uno (ATMega328p). You will need a USB cable, so make sure you have one. Depending where you buy the Nano, it could have a mini or micro USB connector. You can often find them for less than $4.

Arduino Nano

  • Power Supply. You need a 12V-24V power supply that can output at least 5A. The connector should be a 5.5mm x 2.1mm barrel connector. The center pin should be the positive voltage.

Assembling the Kit

All of the surface mount parts ship already assembled. You only need to solder the through hole parts.  It typically takes only a few minutes to solder them. Here are some assembly tips.

  • Raspberry Pi Connector: The connector is mounted to the back side (not silkscreen side), so it is probably best to do it first, so you don’t forget the side.
  • I find it best to just tack one pin of each connector first. You can flip over the board and see if the connector is mounted straight. If not, you just heat the pin again and straighten the connector.
  • Raspberry Pi Connector: The connector is mounted to the back side (not silkscreen side), so it is probably best to do it first, so you don’t forget the side.
  • Male Headers. Insert all the male headers on the top side. Place a small piece of cardboard on top of the connectors then flip over the PCB onto a table. Solder one pin per connector, inspect the straightness, then finish all soldering.
  • Female Headers: Repeat the last step with female headers.
  • Power connector. Solder this on the top side.

Install Grbl firmware on the Nano.

With the Nano not attached to the PCB install Grbl. You can get it here and there are instruction. Be sure to select Nano in the Arduino IDE Tools…Boards: menu

PCB Setup.

  • Determine the microstepping: Use the jumper blocks provided to set the microstepping level. You should look up the documentation on the driver chips to see how the settings work.
  • Install the Nano with the USB facing the edge of the board. See images.
  • Install the stepper drivers: Be sure to get the orientation right. Most will have the pins labeled. Match them up with the labels on the controller board.
  • Plug in your power supply.
  • Set the current: Most drivers will come with the current preset to a good value, but the pot on the driver can be used to fine tune that. You will need to use a meter and read the instructions where you got the driver.

I/O Connector

  • Limit and Probe Switches: The switches should all be setup as normally open and close to ground. A ground connection is provided for each switch to make wiring easier.
  • Control Switches (Start, Hold, Grbl Reset): These also should be normally open switches that close to ground. Grbl reset is a Grbl function to reset the planner, it is not a reset of the controller.
  • Spindle: This output is a TTL signal for a relay or speed controller. It cannot provide any power to run a motor or directly drive a relay.  That will break your Arduino Nano. Whether you use a relay or a variable speed spindle, I suggest Grbl be setup as a variable speed spindle (the default).
    • Variable Speed Spindle:
    • On/Off Spindle: Connect the output pin to the relay control circuit.  This can be used to control AC routers like a Dewalt 611.
  • Flood & Mist coolant: These should be connected to a relay control circuit. If you are using multiple relays, it is easiest to buy a multiple relay PCB like this one.

 

 

Stepper Connectors.

See the schematic to attach the servos, if you need (2) Y motors to turn in different directions just swap the (2) wires of one coil on one motor. You can also just rotate the connector of the motor you want to reverse by 180 degrees. If you want a different axis to use the 2 ganged motors you can change some setting in Grbl’s cpu_map.h file.  Here is the section of the file you change. The ganged drivers use pins 3 and 6.  Swap them with the axis you want.

// Define step pulse output pins. NOTE: All step bit pins must be on the same port.
#define STEP_DDR DDRD
#define STEP_PORT PORTD
#define X_STEP_BIT 2 // Uno Digital Pin 2
#define Y_STEP_BIT 3 // Uno Digital Pin 3
#define Z_STEP_BIT 4 // Uno Digital Pin 4
#define STEP_MASK ((1<<X_STEP_BIT)|(1<<Y_STEP_BIT)|(1<<Z_STEP_BIT)) // All step bits

// Define step direction output pins. NOTE: All direction pins must be on the same port.
#define DIRECTION_DDR DDRD
#define DIRECTION_PORT PORTD
#define X_DIRECTION_BIT 5 // Uno Digital Pin 5
#define Y_DIRECTION_BIT 6 // Uno Digital Pin 6
#define Z_DIRECTION_BIT 7 // Uno Digital Pin 7
#define DIRECTION_MASK ((1<<X_DIRECTION_BIT)|(1<<Y_DIRECTION_BIT)|(1<<Z_DIRECTION_BIT)) // All direction bits

 

Raspberry Pi.

This controller uses the TX and Rx on pins 14 and 15 of the Raspbery Pi header. These are typicall in use for a login shell. You will need to go in the raspi-confi program and stop the ligin shell and enable it for use by other programs.

Note: Arduinos use a trick with the USB to Serial adapter built into each one to reboot the CPU every time you connect. The Raspberry Pi cannot do that, because it has no access to the reboot pin . Grbl will not reboot each time you connect. This may confuse some senders. Also if you try to use the Arduino IDE to program the Nano via Raspberry Pi, it will not be able to trigger the bootloader. You will have to click the reset button on the Nano as the IDE is trying to upload the program. It is best to remove the Nano and program via USB.

Using a Servo.

Stock Grbl does not support servos, so the servo is wired to the Raspberry Pi header. The servo is using the 5V power from the Arduino or the Raspberry Pi, so you should only use micro servos to avoid drawing too much power and damaging something. You should use an external 5V power supply if you want to use a larger servo.

The servo is hooked up to PWM0 (Pin 12)

Using the Controller

You can use it via Raspberry Pi or standalone. If you use the Raspberry Pi, you should not connect the USB to the Arduino. That create a communications conflict and could damage something.

Documentation: (Current version 1.0):

The license is Creative Commons 4.0 Share Alike – Attribution.

Questions?

Please ask via the comments section. I’ll answer there and update this post as required.

 

I sell on Tindie

 

 

 

 

 

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

*