Grbl Gcode Interpreter

grbl is rs274/ngc (g-code) interpreter, CNC controller, readout and exerciser for AVR microcontrollers
Inspired by the Arduino GCode Interpreter by Mike Ellery

Status:

  • Runs on atmega168/arduino.
  • GCode interpreter complete
  • Linear interpolation machine control complete
  • Arcs and helical interpolation complete
  • Buffered, non blocking, asynchronous stepping so the rest of the system is free to generate new steps and parse g-code while the steppers are still steppin'
  • Basic serial protocol complete
  • Stepper pulses verified on scope and tested with stepper motors, motion and rates verified with simulator,

but not tested on real CNC-rig. Still waiting for my micRo kit from Lumenlab.com

Pending:

  • Optional support for a alphanumeric LCD readout, a joystick and a few buttons for program control
  • Optional support for automated cutter length calibration when milling
  • Support "headless" fabrication by buffering all code to SD-card or similar
  • Smooth feed rate interpolation

Limitations:

  • Limited GCode-support. Focus on the kind of GCode produced by CAM tools. Leave human GCoders frustrated.
  • No rotation axes, only x, y and z.

Installation Description

The following description has been made for a Linux system (Ubuntu 9.10 64bit). It should be adaptable to Win and Mac OSX. All tools are Open Source and available for all this platforms. Several different tools are also available including GUIs. I choosed to describe the console way, because it works on all platforms and shows effectively the way how it works.

Downloading grbl

grbl is hosted on git://github.com/simen/grbl.git
If you haven't installed 'git' get it at Git - distributed version control.
Change in command line mode to the directory where you want to install 'grbl' and execute

git clone git://github.com/simen/grbl.git

Enter the new directory 'grbl' and execute (prerequisite: GCC, the GNU Compiler Collection)
make

The interesting result will be 'grbl.hex'

Programming your ATmega microcontroller

For the following you will need avrdude and an AVR programmer like USBtinyISP AVR Programmer from adafruit. This can also be done with any other AVR programmer. A satisfying description of avrdude can be found here and for the USBtinyISP can be found here

  • Connect your AVR programmer to your computer
  • Connect the programmer cable of your AVR programmer to your Arduino
  • You are still at the command line in the directory where 'grbl.hex' is located
  • Upload 'grbl.hex' to your ATmega with for ATmega168
avrdude -p m168 -c usbtiny -e -U flash:w:grbl.hex

for ATmega328
avrdude -p m328p -c usbtiny -e -U flash:w:grbl.hex
  • You will see
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip
avrdude: reading input file "grbl.hex"
avrdude: input file grbl.hex auto detected as Intel Hex
avrdude: writing flash (14228 bytes):

Writing | ################################################## | 100% 8.06s

avrdude: 14228 bytes of flash written
avrdude: verifying flash memory against grbl.hex:
avrdude: load data flash data from input file grbl.hex:
avrdude: input file grbl.hex auto detected as Intel Hex
avrdude: input file grbl.hex contains 14228 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 6.45s

avrdude: verifying ...
avrdude: 14228 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.
  • You are done!

I didn't test grbl until now, because I don't have my system working. Feel free to make corrections to this description and discuss it in Contraptor talk

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License