-
Notifications
You must be signed in to change notification settings - Fork 7
Hardware Setup
In order for a Gcode App to send commands to a CNC machine, some sort of hardware driver is needed in order to convert the GCode language into electric pulses that drives the CNC motors. There are two levels for this hardware. The interpreter that translates text GCode to electric pulses, and the power semiconductors that actually drive the motors. Most Chinese hobby CNC machines comes with the power drivers and relies on PCs with parallel ports to do the GCode interpretation. Software like LinuxCNC do exactly that.
Since most PCs and certainly laptops no longer have parallel ports, other ways must be used to do this work.
This can now be done using cheap, small micro-controller boards (much like Arduino)
The BluePill was selected for its relative high performance (32bit arm based), its built in USB connection, and its very low price.
An adapter PCB was also designed so the controller can be plugged directly to the CNC's parallel port input.
Although this was design to be used on a generic Chinese CNC3040, It can be used on any CNC with parallel port input.
For other DIY CNC machines, the controller board can be connected directly using wires.
- Download the latest release from here and unzip to an empty folder.
- Inside the folder you will find the pcb production file: gerbers_cnc3040_2Layer.zip
- Upload the file to SeeedStudion leave all parameters as default and make the order. You will get 10 pcbs for a ridiculously low price. Share the extra PCBs with friends!
- Another option (might be a better choice for US residents) is to order it directly from OSHPark, no need to upload anything...
you will need the following:
- BluePill Controller board. Very important note: Many of these boards ordered in china comes with non original ST chips. They will work with firmware as is, but if you want to make changes to the firmware and debug it, the STMCubeIDE will not let you. This link used to send me genuine chips, but the last batch was not. If you want to play with the firmware, make sure you find a genuine seller.
- DB25 right angle female connector - Only one needed
- 1/8w 47R resistors - Quantity depending on your CNC configuration. 17 max.
- STLink Programmer - needed for flashing the controller
-
Solder the pin header to the controller board. Make sure the pins are perpendicular to the board or it will not fit the PCB. A good way to do it is to solder only one of the pins, then hold the board in the air and straighten the pins while heating the soldered pin with the soldering iron. When the pins are straight enough, turn the board back and complete soldering all other pins.
-
Solder the controller to the PCB. Insert the controller board to the PCB taking care to insert it the right way. See the image for correct orientation, and also make sure the PCB is not upside down:
-
Trim excess pins:
-
Insert the DB25 connector: Turn the PCB arround and solder the connector, making sure it is all the way in. Again, better solder 1 pin, make sure the connector is fully in, adjust if needed, then solder all other pins.
This is where the adapter is customized to your CNC. From your CNC documentation find the function table of each pin on the parallel port input connector. for example:
X Step -> pin 2
X Direction -> pin 3
Y Step -> pin 4
.
.
etc...
On the back of the PCB there are the switchboard pads in 2 columns - the function, and the input pins.
You now need to attach 47 Ohm resistors from each function pad to the corresponding parallel pin pad. For example, lets say the limit pins in your CNC function table are:
X Limit -> Pin 9
Y Limit -> Pin 11
Z Limit -> Pin 12
You will need to solder the resistors as follows:
Do the same for all the functions your CNC supports. Pins without functions leave empty. If some of the resistors cross over other resistors, use insulation to prevent shorts. you can solder the resistors on both sides of the PCB, this can help reducing clutter. If pins and function pads are in the same line, you can use 0603 smd resistors to connect them directly.
Final result:
Assembly is finished, continue to firmware flashing.