testing grbl with a mini cnc writter

A simple platform to test the use of grbl library

Some years ago i had the idea of making a small compact milling machine to produce pcbs .At the time i used pic microcontrollers and some of the shelve componets to make some tests in drawing using a pen

It was constructed using mechano parts and cartbord.The main body was made using dvd rom bodies and the head assemply , along with its stepper motors

Back then i didnt know anything about grbl code so i assumed that i could just convert a jpg image to array data in the same manner that you do when displaying in an lcd , so actualy the motors where scanning like raster the whole printing area and activate the servo motor whenever it was time to print something.

 This was just a test print of an array .I dont remember maybe i`ve found it somewhere. After that i started searching how are the big boys do it so after some searching i came across the whole grbl thing.So i decided to pause the whole thing for some time since new projects got my attention.

 

After some years i`ve decided to return to this project , this time using an arduino and the ready made – tested and well known grbl library .  So i took the old motors out from the old test device , printed a cnc writter design that i`ve  found in thingiverse to make things easy and faster… well …

 

..it needed some filing and drilling though and to tell yoy the truth it wasnt as solid as it could be , and so , assebled the board and everything and voila!I was all set

or so i thought…

The most problematic with this ready design , besides the time i had to consume to make the thing fit together , was that it doesnt work so well after all. The axis are kinda sticky , it doesnt go all the way up and it needed some tinkering to make it move smoothly. My regret of not designing my own  or not using  an allready assempled cd rom head slider came in an instant. In the end it worked for the tests i needed but its kinda tricky to set limit switches etc so i kinda abandoned the idea of adding those.

Anyway.

The next test will be a definitely larger structure with better motors. For electronics the board i made is actualy just a simpler copy of a typical grbl controler board (you know , the one that you fit the modules on top) without some pins so in the next version wil probably just get one of those to save some time.

 

Software
The first thing you gotta do is to load the grbl firmware in the arduino.
Im just copying the instructions from the official page (https://github.com/grbl/grbl/wiki/Compiling-Grbl).

NOTE: Before starting, delete prior Grbl library installations from the Arduino IDE. Otherwise, you’ll have compiling issues! On a Mac, Arduino libraries are located in ~/Documents/Arduino/libraries/. On Windows, it’s in My Documents\Arduino\libraries.

  1. Download the Grbl source code from https://github.com/gnea/grbl
  • Click the Download ZIP button on the Grbl home page.
  • Unzip the download and you’ll have a folder called grbl-master.
  1. Launch the Arduino IDE
  • Make sure you are using the most recent version of the Arduino IDE!
  1. Load Grbl into the Arduino IDE as a Library.
  • Click the Sketch drop-down menu, navigate to Include Library and select Add .ZIP Library.
  • IMPORTANT: Select the Grbl folder inside the grbl-master folder, which only contains the source files and an example directory.
  • If you accidentally select the .zip file or the wrong folder, you will need to navigate to your Arduino library, delete the mistake, and re-do Step 3.
  1. Open the GrblUpload Arduino example.
  • Click the File down-down menu, navigate to Examples->Grbl, and select GrblUpload.
  1. Compile and upload Grbl to your Arduino.
  • Connect your Arduino to your computer.
  • Make sure your board is set to the Arduino you have in the Tool->Board menu and the serial port is selected correctly in Tool->Serial Port.
  • Click the Upload, and Grbl should compile and flash to your Arduino! (Flashing with a programmer also works by using the Upload Using Programmer menu command.)

How to use it?

cnc machines can only read Gcode. Nothing else. Its just a text file with coordinates and other data that order the machine to do this and that.
This means that you have to translate your design to gcode and then load it to the grbl controller software.

Here you can find some cnc controllers and some information on what they do.

When you select and install your favourite controller you can start tinkering with the settings.These are send throught the console of the grbl controller and are stored in the EEPROM of the arduino.

The settings i`ve used are the following

$0=10
$1=25
$2=0
$3=0
$4=0
$5=0
$6=0
$10=1
$11=0.010
$12=0.002
$13=0
$20=0
$21=1
$22=0
$23=0
$24=25.000
$25=500.000
$26=250
$27=1.000
$30=1000
$31=0
$32=0
$100=10.000
$101=10.000
$102=13.000
$110=500.000
$110=500.000
112=500.000
$120=10.000
$121=10.000
$122=10.000
$130=50.000
$131=50.000
$132=100.000

The procedure to make it draw a design is the following

1.Find a design or design your own using a CAD programm,
2.Export your design to G-code or translate it using some other tool (you can find a lot out there , inkscape for example)
3.Load the gcode file to the grbl controler and connect to the machine
4.Press “Send” and admire! 😉

It was a fun and educational  experiment but there will be more to follow..