Assembly step 15

From ShapeOko
Jump to navigation Jump to search

These are the instructions for the SO1 and are here for historical reasons only.

If you are building an SO2, please see the instructions at



It is outside the scope of the general build instructions to give step by step tutorial on how to use CAD/CAM packages. We will cover a specific set of opensource packages in succeeding sections (16, 17 and 18) with further discussion in a separate page and additional options in the sidebar. For now, we want to verify that your machine is assembled correctly and is operating as expected.


Grbl is a free, open source, high performance CNC milling controller written in optimized C that will run on an Arduino. (source: GRBL wiki)

While many DIY CNC machines rely on LinuxCNC (aka EMC2) or Mach3 these approaches require you to dedicate a PC to controlling your CNC machine. GRBL on the other hand runs on an Arduino which provides a much simpler and more compact solution.

Downloading GRBL

If your Arduino did not come pre-loaded w/ Grbl, the link below will allow you to download a pre-compiled hex file with default Shapeoko Values. These values are based on a few assumptions:

  • 200 step/rev stepper motors
  • 8x microstepping on the X and Y axis
  • 2x microstepping on the Z axis
  • MXL belting (.08" pitch)
  • 18 tooth MXL pulleys on the X and Y axis
  • 8mm threaded rod (1.25mm pitch) on the Z axis.

Version 0.8a of the hex file(s) for Grbl are available here: File:Grbl08 basic.txt. Other versions, including 0.8c which is used in the newer screenshots is available from Github.

Grbl defaults

Grbl 0.8a
'$' to dump current settings
$0 = 43.74 (steps/mm x)
$1 = 43.74 (steps/mm y)
$2 = 320.00 (steps/mm z)
$3 = 30 (microseconds step pulse)
$4 = 500.00 (mm/min default feed rate)
$5 = 500.00 (mm/min default seek rate)
$6 = 0.10 (mm/arc segment)
$7 = 28 (step port invert mask. binary = 00011100)
$8 = 25.00 (acceleration in mm/sec^2)
$9 = 0.05 (cornering junction deviation in mm)

Calculating values

See the About page for details on calculating these values as well as Calculating Z-axis. There's an on-line tool ShapeOko Grbl settings calculator for doing this.



GcodeSender by Otto Hermansson is a simple to use application that we'll use to send our first G-code program to the Shapeoko. Gcode Sender will take a G-code program and send it line-by-line to the Arduino. You can also execute individual commands to test your setup. Install GcodeSender on your PC to prepare for your first job.

File:G-code sender.jpg
Gcode Sender for Windows by Otto Hermansson


Download from github. gcode sender by Otto Hermansson

Installation and configuration

Save the .EXE somewhere you'll be able to find it. I like to keep things nice and neat, so I saved it to c:\Program Files\G-code_sender\gcodesender.exe

Arduino Uno Drivers

You will need to install the Arduino Uno drivers, this will happen automatically on some systems. If it doesn't:

  • Please see the Arduino website for instructions on how to do this (note that the Arduino may appear as Other devices | Unknown device --- you may want to familiarize yourself with your machine's Device Manager before plugging in the Arduino), but STOP AT STEP #5 of the instructions shown at this link:
  • If you proceed past step #5, you will erase grbl.
  • We will verify and troubleshoot at the end of these instructions on the wiki.



  • Plug in your Arduino before launching GcodeSender or you'll get an error that GcodeSender can't find a com port.
Select your COM port from the pulldown menu.
  • Click 'Open' to establish a connection with the Arduino.
  • If you press the reset button on your arduino after you've opened the port, grbl will spit back it's version number.
GRBL says hi!

Verifying Settings


  • Type '$' into the text box at the top of the program's window, followed by the enter key.
  • After pressing enter, [grbl] will spit back it's current settings.
  • For right now, we don't need to know what each of those mean, we just need to make sure they're set correctly.
  • The image below shows the correct default settings for a Shapeoko with the following Characteristics:
    • 200 steps / revolution stepper motors with 8x microstepping on the X and Y axis
    • 200 steps / revolution stepper motor with 2x microstepping on the Z axis
    • 18 tooth MXL timing pulleys on the X and Y axis
    • mxl belting
GRBL default settings

If your settings are not correct, see the Specifications section of the About page for details about the threaded rod and # of steps and the ACME Z-axis page for the formula to recalculate, which is:

Steps * Microsteps / Pitch = Steps per mm

Note that if your machine moves in the wrong direction(s) that one may either alter the software settings (below) or re-wire the machine as noted in Assembly Troubleshooting --- Direction.

Testing Template:Box2P


  • In the 'Command' box, type 'X5' to move the head 5mm in the x-axis. If all goes well, your x-axis will move 5mm to the right!
  • Type X0 - your x-axis should move back to where it started before entering the previous command.
  • Type X-10 - your x-axis should move to the left 10mm


  • Type Y10 - your gantry should move away from you (toward the back)
  • Type Y0 - your gantry should come back towards you (toward the front)
  • Type Y-10 - your gantry should move 10mm towards you (toward the front)


  • Type Z10 - your gantry should move UP 10mm.
  • Type Z0 - your gantry should move back down 10mm
  • Type Z-10 - your z-axis should move down 10mm

(note: if any of your axis moved in the wrong direction, [click here])

The quick cheat sheet of 'axis reversal settings' is:

 None = 0, X=32, Y=64, X+Y=96, Z=128, X+Z=160, Y+Z=192, X+Y+Z=224

Sending G-code

  • Click "Browse" to load your G-code.
  • Click "Print" to send the G-code


Universal-G-Code-Sender by Will Winder can be used. After installing the usage instructions are the same as the Windows program.

If you are using TinyG as your controller, this is not compatible with Universal-G-Code-Sender, so there is a fork available on Github that specifically addresses TinyG's JSON formatting at


To talk to the Shapeoko directly, you can use a serial terminal program such as cutecom or minicom.

The serial-over-USB port to the Arduino appears generally as /dev/ttyACM0

Configure it for 9600 baud, no parity, 8 bits, 1 stop bit. Setting either LF or CR/LF as the line terminator both seem to work fine.

I connected the motor wires in the following order on the GRBLShield connectors Red, Blue, Green, Black. This is from left to right, looking at the shield with the motor connectors towards you. This assumes that Red and blue are connected to one coil and Green and Black to the other coil (which is generally the case with NEMA steppers).

With this setup, I had to invert the X and Z channels by software. To do so, enter $7=160 ($6 in GRBL 0.8c) in the serial terminal. Your mileage may vary.

The inversion variable $7 ($6 in GRBL 0.8c) has one inversion bit for each axis with X=32, Y=64, and Z=128. Setting $7 ($6 in GRBL 0.8c) to 160 (32+128) will invert the X and Z axis. This configuration is stored in the flash memory of the Arduino, hence you only need to do this once.

Alternatively, Universal-G-Code-Sender by Will Winder can also be used. After installing the usage instructions are the same as the Windows program.

If you are using TinyG as your controller, this is not compatible with Universal-G-Code-Sender, so there is a fork available on Github that specifically addresses TinyG's JSON formatting at

Mind your Motors

In case you don't have standart 200 Steps/rev Motors, you need to adjust GRBL Settings $0 and $1. I bought 400 Steps/rev motors so I had to double from

  • $0 = 43.74 (steps/mm x)
  • $1 = 43.74 (steps/mm y)


  • $0 = 87.48 (steps/mm x)
  • $1 = 87.48 (steps/mm y)

Now everything is correct.

Next: Assembly step 16