CNC

GRBLling a STEPCRAFT CNC

last updated: 26/03/20

Introduction

I bought a new toy :). A STEPCRAFT-2/D.840 construction kit to built a CNC milling machine. The mechanical part of the construction was no problem due to the good assembly instructions.

Naturally I want to use open source software. I use FreeCAD to draw and I should be able to generate GCODE directly with Freecad to feed the machine. I also found interesting information on bCNC.

I didn't want to use an old PC with parallel port and I love Arduino, so the first choice was GRBL. And finally I had seen the MaXYposi project with the MaXYpulti :) in the German Make magazine.

But...

After a successful assembly of the mechanical parts I now wanted to connect the GRBL board with the stepper driver board included with the kit, and ran into understanding problems, first because of being a CNC Newbie and second due to a lack of information in the STEPCRAFT manuals. I know that stepper driver have a DIR, STEP and ENABLE signal, but what should I do with an error signal, and only one XYZ limit signal, GRBL needing three of them. And why do I need relays, and are we dealing with negative or positive logic?

So to understand this, I needed a deeper insight, and I needed a plan :) meaning a circuit diagram.

Circuit and wiring diagrams

I looked at the driver board and tried to understand what's going on. Here is an incomplete circuit diagram drawn far enough to understand what the main signals do:

stepcraft connections DB25

stepcraft driver circuit

STEPCRAFT to GRBL (MaXYposi)

The parallel port of the STEPCRAFT machine (DB25 male X1, respectively 2x13 pin header SV1 on the PCB) gets the signals normally from a PC with parallel port (e.g. from LinuxCNC). We will use the GRBL board to generate the machine signals (DB25 connector male). The GRBL board gets its information over an USB to serial converter (FTDI, PL2303,CH340) from the PC. Unfortunately there is no standard for the signals, so it is not possible to connect both boards 1:1.


steppi2posi front        steppi2posi back

The signals on the STEPCRAFT driver board (DB25 X1 or 2x13 header SV1):


stepcraft emergency stop


emergency<em>reset</em>1         emergency<em>reset</em>2

GRBL (MaXYposi) to MaXYpulti

I will use the DB25 connector of the STEPCRAFT parallel board to connect the MaXYposi with the MaXYpulti. The easiest way is to recycle an old DB25 cable even if we get only 16 pins.


posi to pulti

posi2pulti front        posi2pulti back

Serial to USB

To access the GRBL board I soldered a spare Serial/USB converter with CH340 chip on a board. This board takes the place in the STEPCRAFT, where a 4th axis board would be. The DTR line (pin 13 on CH340) needed by Arduino to RESET the chip while programming is connect through a capacitor to RESET (pin 2 on header).

The pins on the right are only there to hold the board.


serial2usb front        serial2usb back

Changing the GRBL parameter with bCNC

Tweaking the different parameter for the STEPCRAFT machine could be done with a terminal program, but it is much more comfortable to use a GUI program like bCNC.

Install bCNC

Donload bCNC from https://github.com/vlachoudis/bCNC and extract the zipped file. Read on git how to install it. On my Kubuntu I chose not to install it but changed to the bCNC subdirectory and started the program with

    python3 __main__.py

First I needed to customize the program because of it's tiny icons and font size (I'm not the youngest anymore :(). In the CAM tab there is Config icon, displaying the Machine configuration for bCNC parameter. Here we find a checkbox to double the icon size. The Fonts icon helps to get a bigger font.

Screenshot bCNC font

Now we will change the Controller parameter. Click on the Controller icon. The following parameters are to change. The other parameters stay on default values. For more informations on the parameter yoz can lock in the GRBL wiki.

Config:

Double size icon Feed max x Travel x Spindle min (RPM) Spindle max (RPM)

Screenshot bCNC config

Getting Gcode using Inkscape

For my first tests, I want to draw something with the help of a pen. I like Inkscape a free and open source vector drawing program. The extensions for Inkscape are really cool and I use them e.g. for my egg-bot. The extension Gcodetools generates Gcode for Lasercutter/Engraver or Plotter. Unfortunately it is not well documented (look here).

Because of the bad documentation and the unpredictable results, using Inkscape to generate G-code for CNC mills is dangerous! Better use more professional software.

Let's try to write Hello World with the CNC machine used as plotter. In Inkscape we select the text tool and write the text in Comic Sans MF, bold, size 72. As we need the outline, add a stroke paint (shift + click on black color in the palette bar). Delete the fill (click on cross in palette bar).

Next we scale the object to 100 mm in width and 10 mm from x and y:

Screenshot Incscape

The object needs to be in an own layer. Create a layer called "Text" and put it there (right click, move to layer...).

Screenshot Incscape

As we need a vector graphic and not a text object, we duplicate the layer (right click: Duplicate Current Layer) and get a Layer with the name "Text copy". Now we toggle the visibility of the "Text" layer to invisible. It is only needed again if we want to change the text. In the "Text copy" layer we select the text and use Path > Object to Path to get a vector graphic.

To avoid that the G-code generation freezes up or takes too long, we want to have less than 3000 nodes. If we have too many nodes, we can simplify the object by pressing ctrl+L as many times as necessary. The node count is showed in the status bar. As our text has less than 3000 nodes, so we don’t have to simplify.

Now we we need to choose a tool. Click on Extensions > Gcodetools > Tools library…. For our need (laser engraver and plotter) we choose the cylinder option and than click on Apply.

A green text box pops up in our drawing. We close the "Tools Library" window and position the green box above our drawing. The box is part of the image with the text tool we adjust the parameters. We set the tool diameter to 1, the feed rate to 400 mm/min and penetration feed to 10000 (arbitrary high number to quickly turn on and off the laser).

Next we need some orientation points. Select Extensions > Gcodetools > Orientation points….

In the window that pops up we select the top option, set the Z surface to 0, the Z depth to -0.1 (we just want it to barely go below zero to turn on the laser quickly) and the Units as mm. Then we click apply and close the window. It is best to leave those arrows with the numbers in parenthesis that pop up where they are and don’t mess around with them.

Extensions > Gcodetools > Path to Gcode…. In the Preferences tab we name the file hello.ngc. We set a low safe height such as 0.1 since we’re not actually moving along the Z-axis at all. Units: mm and Post-processor: None. The rest is blank.

Under Options we leave everything as they are by default.

In the Path to Gcode tab we make sure Subpath by subpath is selected and that Sort paths to reduse (yeah, we know) rapid distance is checked. The rest is as it is by default. Make sure that only the object you want to generate G-code of is selected (in our case: the dinosaur) and make also sure that you have the Path to Gcode tab selected before pressing apply (you will, believe it or not, get an error message if you have a different tab selected).

If we don’t encounter any errors, our dino will look like this after the generation process is done: