Assembly step 15

From ShapeOko
Revision as of 21:17, 5 June 2013 by Edward (Talk | contribs) (Arduino Uno Drivers)

Jump to: navigation, search



It is outside the scope of the general build instructions to give a step by step tutorial on how to use a CAD/CAM package. We will cover that 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

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.

Download the hex files here: File:Grbl08 basic.txt

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)



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.

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. - Please see the Arduino website for instructions on how to do this, 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

Note: If you received an arduino as part of your kit from inventables, your settings will be pre-loaded. These default settings are meant to get your Shapeoko up and running.

After you have verified the machine is working, you can start tweeking the settings to adjust for performance.

  • 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 do not match what is shown in the image above, click here)


Note: GRBL returns lines ending with \r\n. Other programs might return lines ending with \n\r.


  • 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 in the serial terminal. Your mileage may vary.

The inversion variable $7 has one inversion bit for each axis with X=32, Y=64, and Z=128. Setting $7 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

Next: Assembly step 16