GRBL, installation and usage.
Although many forums and web sites give instructions on installing GRBL, they are mostly misunderstood. Newbies stand zero chance of ever being able to install GRBL successfully. And when these newbies post any questions on forums seeking help, they are usually rebuffed with “do some research before posting silly questions!” Perhaps they may be silly for experts; it is definitely not so those new to GRBL.
Ok, first things first. GRBL is simply in a nutshell just another cleverly designed Arduino sketch to control CNC Mills or similar which require GCODE as its controlling language. GCode is the standard language used to control steppers, servos, spindles and relays in these machines. That is all to it. Nowadays we simply use a CAD program to draw some item in 2D, save the drawing as a DXF file and then convert to GCODE. Some CAD programs will save or convert DXF files directly into standard GCODE.
GRBL Installation.
You will first need the GRBL source to upload as a library to your Arduino. Note very well. You get two versions of the source, one which will only compile on the UNO and the other which will compile on the Mega 2560. Search for the respective source on GiThub or elsewhere.
Unzip the file to some convenient folder. Open the Arduino IDE and select: Sketch-Include Library- Add .Zip Library. Select the folder “grbl”. (Arduino should at least be more specific about the Zip file, as it is not necessary to use a zip file). Done!
Next, select: File-Examples-grbl-grblUpload. (you will need to scroll down to find the grbl example folder). Run upload. (You have probably already set up your Arduino UNO or Mega). If everything goes well, you won’t get any errors. If you get an error, make note of it. It is a good idea to select: File-Preferences and check both boxes under “Show verbose output during:”
Next, open the Serial Monitor and some GRBL message will be displayed. If no messages are displayed, then the upload of the file grbl.h (loaded via grblUpload sketch) was unsuccessful.
The main problem is always the wrong source for the wrong Arduino. If that is corrected then you will definitely not have any issue. Also download the latest Arduino (current 1.8.10 as at Sept 2019).
Testing the GCODE from the serial monitor is not easy. Some codes will display OK and some will send Alarm:2, which means that that GRBL wants the “machine to be set up properly”. You will also need to unlock the GRBL after every reset. ($X and send). There are many resources on the internet to learn about the codes and settings of GRBL on the Arduino.
Now here comes the confusion. Some people thing that GRBL is a new fad for stepper/servo control. It is not. Like I said before, GRBL is strictly only for 3 axis mills, lasers, lathes etc. it is NOT meant to simply control steppers or servos within an Arduino sketch –that is NOT possible with GRBL.
There is no way that you can use an Arduino sketch to run GRBL. Whatever sketch you upload to your Arduino will overwrite the GRBL. You will have to reload GRBL (via grblUpload) or similar in order to use GRBL again.
If we want to control steppers, servos, relays etc within an Arduino sketch using GRBL commands, the sketch will NEVER upload- it won’t work (assuming you added #inlude grbl.h into your sketch). This is the confusion surrounding GRBL. Many people think that once GRBL library is installed, it could be used in any custom sketch. That is not possible currently. If you intend to run some steppers etc through some Arduino sketch, you will have to write your own code or use some stepper/servo libraries which are available on the internet. The Arduino IDE installation has some built-in stepper libraries which could be used.