last updated: 26/03/20
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.
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.
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:
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.
8x Direction (DIR) and Step (Takt)
Direction and Step signals are needed for every stepper. We get 3 stepper for 3 dimensions X,Y and Z, and stepper signals for a fourth axes or stepper called
C. This driver is not included on the driver board from STEPCRAFT, but an additionally PCB can be bought, so the signals are available on the 2x5 pin header (SV2 and on the PCB) and on the DB15 connector (external signals) X2. All DIR and STEP signals are interchanged on the pins of the DB25 connectors from the GRBL board and the STEPCRAFT PCB and have to be crossed.
Relay 1-3 and "n.a. out" aka PWM spindle
These 4 signals give the possibility to switch relays or other things connected to the DB15 connector (external signals) X2 of the STEPCRAFT machine if needed. This connector is also called STEPCRAFT system bus in the manual. I bought the STEPCRAFT spindle and saw in the spindle manual, that it is switched on/off with the pin 13. That is the relay 1 signal! The PWM signal is on pin 7 (PWM out). If we look at the circuit we see that this signal comes from pin 17 of the DB25 called "n.a. out" or "free out" (frei (Out))! So I connected "free out" pin (STEP 17) to REL SPINDLE of the GRBL board (14). With PWM connected the on/off signal is not needed.
This pin gave me the most trouble, mainly because the German manual was not clear, labelling the pin with error (Fehler), and I didn't know if I was dealing with an input or output. The pin is not buffered, but it seems to be an output, and it logical HIGH if the emergency stop connected to the the driver board is opened (normally closed (N.C. against GND). As the GRBL board has no information about the stop, I thought it would be good to pass the information by using one of the free pins on the DB25 connector (pin 16). On the GRBL side the logic of the signal signal had to be inverted. I used a transistor 2N7000 to so so.
Reference switches (X/Y/Z, 4th axis C)
The GRBL board has 3 inputs for X, Y and Z switches. On the STEPCRAFT side we get one XYZ switch signal and one 4th axis (C) switch signal. These signals are all LOW if the switches are closed, so we need to adjust the parameter $5 in GRBL (see bCNC). I connected the XYZ switch signal (STEP 12) to X (GRBL 10), Y (GRBL 11) and Z (GRBL 12). The C axis switch signal is connected to the free GRBL connector pin 17 and a on the GRBL board a wire connects the signal to the corresponding input pin.
Tool length sensor
We connect the GRBL input (13) with the STEPCRAFT output (10). If we use the external 3.5 mm jack the jumper on the STEPCRAFT board must be tucked in. It its only removed if both inputs (jack and internal screw header) are used simultaneously. The NC switch of the tool length sensor is connected to audio left and audio right! This was not clear in the STEPCRAFT manual.
The GRBL board (less than 100 mA) can be powered from the Stepcraft board. Fortunately 5 V are available on pin 26 of the 2x13 header and I used the free pin 15 of the GRBL DB25 connector to power the board.
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.
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.
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.
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
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.
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.
$5 Limit pins invert: The STEPCRAFT limit switches are normally closed (NC), expects normally open (NO), so we have to invert. Click the checkbox!
$6 Probe pin invert: Also normally closed (NC). Click the checkbox!
$21 Hard limits: We use them, so click the checkbox!
$22 Homing cycle: We need homing. Click the checkbox!
$23 Homing direction invert: The X axis needs to change the direction for homing. This is done with the number 1. Change zero to
$27 Homing pull-off [mm]: This is the distance to the limit switches after homing. I increased it to 3 mm.
$30 Max spindle speed [RPM]:
20000for the STEPCRAFT spindle.
$31 Min spindle speed [RPM]:
3000for the STEPCRAFT spindle.
$100 X steps/mm:
133.33for the STEPCRAFT motors (4003 steps/3 mm pitch of the trapezoidal thread spindles).
$101 Y steps/mm:
133.33for the STEPCRAFT motors.
$102 Z steps/mm:
133.33for the STEPCRAFT motors.
$110 X max rate [mm/sec]:
3000for the STEPCRAFT machine.
$111 Y max rate [mm/sec]:
3000for the STEPCRAFT machine.
$112 Z max rate [mm/sec]:
1000for the STEPCRAFT machine.
$130 X max travel [mm]:
600for the STEPCRAFT machine.
$131 Y max travel [mm]:
836for the STEPCRAFT machine.
$132 Z max travel [mm]:
130for the STEPCRAFT machine.
Double size icon Feed max x Travel x Spindle min (RPM) Spindle max (RPM)
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:
The object needs to be in an own layer. Create a layer called "Text" and put it there (right click, move to layer...).
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
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: