# Homemade Tools > Basic Homemade Tools and Tips >  Crash Course on GRBL public licence CNC control.

## MeJasonT

Im sure there are many newbies out there who are looking at projects on homemadetools.com and wondering how the hell do they do that, I was one of those people.

I came across Jon Saunders at NYCCNC




Jons description is absolutely bang on, he is a really approachable guy and self-taught as a machinist who started working out of his apartment in NYC.

His videos are really easy to understand and he doesnt hold anything back, he is without doubt the greatest ambassador for engineering on the planet. I like to impart knowledge where ever I can but Im nowhere near his level. So this post is really just to show you what you need and to provide some background on where to start.

When I started building my CNC machines I didnt have a clue about Computer Numerical Control (CNC), well ok I knew that somehow coordinates were generated form lines and arcs in a drawing and used to drive axis to a desired position. I could produce a CAD drawing bot had no clue about post processors at all, the magic thing about 3D printers is that firmware like marlin and operating software such as Pronterface make the whole process of going from drawing to machine really easy.
To go from professional CAD to machines is a whole new ball game which Im pleased to say is getting easier with fusion 360 and the new version of solidworks; unfortunately it comes at a price.

So you want to build a cnc machine, lets start with a bit of top down approach.


Image taken from 
https://okelectronic.wordpress.com/category/grbl/
all Credit toOakkar7

This is perfect as its based on the Arduino Uno as a controller.
So you have 3 stepper motors and drivers for each axis, limit switches to stop the machine wandering off piste and thats enough to get you started really.

The Arduino Uno is just a development board, its dumb and has no operating system/firmware on it.
This is where GRBL come in, Grbl is Open Licence firmware (computer code to you and me) which is loaded onto the Arduino uno to turn it into a cnc controller.

The easiest way to do this is to upload the code directly to the board using a hex uploader, you could use the arduinos design development environment but you want to build a CNC not learn to program.

So to achieve the code upload you need the latest grlb firmware file and the hex uploader

Xloader is a self executing program which will connect to your Arduino Uno
XLoader

and download the file (grbl_v0_9a_edge_328p_16mhz_9600_build20121210.hex) from
https://github.com/grbl/grbl/downloads
Its at the top of the list

The assumption is that you are able to load a device driver to your PC for this stage, you will be prompted to do so by windows if its not on your machine already, it just like plugging in any other piece of hardware to your PC. You may also need Net 4.5.2 

Plug in a usb lead between your PC and The Arduino
Open xloader, 
Sett the correct port settings for the location where your device is installed
point it to where the grbl_v0_9a_edge_328p_16mhz_9600_build20121210.hex file is located and press the upload key.

Be patient its not obvious its doing anything, at the bottom of the Xloader there is a text box which tells you what its doing and will report back when its finished.

You now have a CNC controller

Next step is to find some software to operate the controller from your PC and enable you to send files to it.

I use and would recommend GRBL panel

https://github.com/gerritv/Grbl-Pane...s/tag/V1.0.9.3

You are looking for GrblPanel-Release-1.0.9.3.zip its at the bottom of the page above where it says Downloads. The two options below are the source code and very scary, do not go here.

Install GrblPanel-Release-1.0.9.3

You should get a screen like this



In the top centre of the screen you can select the port where your Arduino is connected and underneath the baud rate for the communications this must be set for 115200.
When you press the connect button it should connect and make the remaining parts of the screen active.

I personally think there is a bug in this software when it comes to entering your machine setting,
Click on the settings tab and you will see a list of machine settings

$0=10 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=7 (dir port invert mask:00000111)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.010 (junction deviation, mm)
$12=0.002 (arc tolerance, mm)
$13=0 (report inches, bool)
$20=0 (soft limits, bool)
$21=1 (hard limits, bool)
$22=1 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=25.000 (homing feed, mm/min)
$25=500.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$100=4750 (x, step/mm)
$101=1500.000 (y, step/mm)
$102=50.000 (z, step/mm)
$110=500.000 (x max rate, mm/min)
$111=350 (y max rate, mm/min)
$112=500.000 (z max rate, mm/min)
$120=20.000 (x accel, mm/sec^2)
$121=20.000 (y accel, mm/sec^2)
$122=20.000 (z accel, mm/sec^2)
$130=330 (x max travel, mm)
$131=135 (y max travel, mm)
$132=80 (z max travel, mm)

Now what you are supposed to do is type in your values and just hit enter, I cant honestly say it worked so the alternative is to go back onto the Interface tab/button and enter the command manually ie type $130=330 into the manual command text box at the top of the page and click on the send button.

A description of the commands is here
https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9

ignore the getting started paragraph at the beginning it only works for the grbl front end and not grbl panel.

This is outside of the scope of this instruction but is provided for further reference.

So you now have a controller for your machine unfortunately the Arduino Uno is not exactly easy to connect wires to so you may wish to consider buying something like a grbl shield

Adafruit Synthetos gShield (grblShield) V5 [ADA1750] | eBay

For Stepper motors and controllers you may wish to consider Drivers like:-
CNC Single Axis TB6600 0.2 - 5A Two Phase Hybrid Stepper Motor Driver Controller | eBay

And motors like:-

Nema 23 Stepper Motor 285oz-in 2,0Nm 6.35mm Shaft For CNC Lathe Control Driver | eBay

Please keep in mind the voltage, torque and amperage rating of both the motor and driver when purchasing your hardware

To get from CAD to Gcode for loading to your machine, I would recommend Cambam
CamBam CNC Software

you will need to search the internet for a GRBL post processor add in for Cambam to get it to produce the correct code for GRBL but the default one is sufficient to get you started, it just does not understand a few commands. These can quite easily be removed by opening the NC file from cambam using a text editor.

I wish to give credit to all those involved in bringing this fantastic controller to the public forum and for openly sharing their knowledge with us.

----------

C-Bag (Jul 28, 2016),

Paul Jones (Aug 25, 2016),

PJs (Jul 25, 2016)

----------

