In order to set it up, first you have to find it on your computer. Long long ago, almost all computers had two serial ports, called 'COM1' and 'COM2', one a with a nine pin and the other with a 25 pin connector.
Now times have changed and the serial port has vanished.
Don't give up hope, however. The USB to serial converter has arrived, and it can be used instead. It is usually a dongle which plugs into a USB port, with a nine pin male connecter at the other end.
On my desktop computer, the motherboard has two built in serial ports. The third seial port, here labelled COM4, belongs to the USB to serial adapter I have plugged in.
So, to find the serial port on your computer, scout around its back. If you find a nine pin male connector (two rows, five and four, pins sticking out inside a metal shell) it has a serial port built in.
Or get a USB to serial converter and plug it in.
Open up Device Manager. Right click on 'My Computer' and select properties (at the bottom of the list that pops up). Click on the 'Hardware' tab. Click on the 'Device Manager' button and a something similiar to this picture should appear.
Click on the '+' sign on the left of the 'Ports (COM & LPT) to expand it. The list of printer and Serial ports available will be shown. Make a note of those, you will need them in the steps that follow.
Serial RTU is the most common protocol used with Mach3, although Modbus/TCP is gaining popularity. Both Protocols may be used simultaneously with Mach3. It should be noted that Serial/ASCII is not implemented in Mach3. Figure 1 below illustrates an Architecture Overview of a Mach3 Modbus setup. Modern PCs generally don’t come with a parallel port. Usually this isn’t a problem as USB generally works really well, but not if you’re running a CNC router that uses a TB6560 control board like my Zen Toolworks model with Mach3 control software (see all my CNC posts here).). Here’s a little tutorial about adding a PCI parallel port and using it for CNC control.
The gShield is awesome. You can build a 3 axis DIY CNC Controller for less than $80!
This post will walk you through the step-by-step process of setting up your own DIY CNC Controller. If you want to dive right in download the Quick Start Guide here. If you get stuck check back here to find the detailed setup instructions. Happy making!
Introduction
I love the gShield from Synthetos! No, they are not paying me to say that. As a die hard gear head, electronics intimidate me. I cannot say why, they just seem like a mystery. Mechanical stuff I get. I see how it works. I can’t see the electrons in the printed circuit board or the 1s and 0s in the software.
Enter the Arduino. This created a completely new world for me. It’s nearly indestructible. I mean I have been trying to let the manufacturers smoke out of the device for years now. (The long running joke is that manufacturers pack smoke in electrical components that is let out when someone screws up and they fry the chip as demonstrated by the smoke coming out.)The combination of Arduino with grblShield allowed me to create a DIY CNC Controller for less than $80! That’s crazy! And the best part is, I am not tied to a boat anchor of a PC with a parallel port typically required to run stepper motor drivers.
Correct me if I am wrong but I do not know of any industrial CNC controller that uses anything other than a parallel port. I mean come on! I don’t know of any printers that still use a parallel port. Please, someone put it out of its misery. Ok, my rant is done.
One huge advantage of the grblShield with the Arduino is the ability to use a regular old USB connection. Welcome to the 21st century. I know don’t fall out of your chairs. My harbor fright mini mill isn’t all that big. I really didn’t want the controller to be bigger than the mill. If I was to use a parallel port that means finding an old PC with a stable version of windows and probably using Mach3. I didn’t want to mess with that.
Click here to watch the video on YouTube.
The following is a step by step guide to create a 3 axis DIY CNC Controller. Let’s walk through the setup starting with a list of hardware you will need followed by a list of tools that will make the job easier.
Note several of the links below are affiliate links. If you choose to purchase through one of the links below, I will earn a small commission which helps maintain this site. If not, that is fine too. Either way your the price you pay does not change. You can read more about my affiliate disclosure here.
Required Hardware…
- Arduino UNO or clone I am partial to the SparkFun RedBoard – Programmed with Arduino
- gShield available here from Synthetos
- Power supply (12 or 24 volt) Mean Well SE-200-24 Single Output Switching Power Supply 24V 8.8A I used a 24 volt supply because the grblShield is rated for 30 volts and 2.5 amps per driver. I want to push as much power as I can recall P = IV where P = power, I = current and V = volts. If I say double the voltage from 12 to 24, I double the power if the current I is held constant.
12 volt example – 2.5 amps x 12 volts = 30 watts
24 volt example – 2.5 amps x 24 volts = 60 watts
Also, most 24 volt power supplies have a voltage adjustment screw which will let me get about 28 volts and drives the power per stepper motor up even more.
- Stepper motor(s) NEMA23 425oz/in 2.8A Stepper Motor ¼” Dual shaft
- PC or laptop with USB port ASUS Netbook
- Hookup wire (14 or 16 gauge stranded) 18 AWG 4 Conductor Shielded Cable (25ft.)
- Plug end for the power supply AC Power Cord 6 Ft 18 AWG 3 Prong
You will also want to have the following tools on hand…
Setting Up Mach3 Software
- Multimeter – I have fluke meter that I picked up on sale a few years back for other stuff. They work really well but you can get a nice meter for 10 -20 bucks.
- Small screwdriver
- Soldering Iron – Depending on the age of your Arduino, you may need to move a jumper
- Wire cutters
- Wire strippers
- X-acto knife or equivalent
Get the Quick Start Guide Here
Overview
- Download and install the grbl software on your Arduino
- Download and install the Universal Gcode sender on your PC
- Wire your power supply (confirm polarity of power supply and set to 110 VAC)
- Connect the power supply to the grblShield and test
- Connect the grblShield to your Arduino
- Test the connection
- Wire your stepper motor to the grblShield
- Test the stepper motor
Step 1 – Download and install the grbl software on your Arduino
The following method uses the Arduino IDE (Integrated Development Environment) to load the grbl software to the Arduino. The process is very similar to loading a “sketch” to your Arduino. If you are not familiar with loading software to the Arduino or do not have the latest Arduino software on your PC then take a few minutes to load the latest IDE available by clicking here.
- Go to the grbl home page on GitHub by clicking here.
- Click on the “Download ZIP” button on the right side of the screen. See the picture below.
A screen shot of the GitHub page for the grbl software.
- Save the file to your computer and unzip to create a grbl-master folder. I placed the grbl-master folder in my Arduino folder. The file structure will look something like …/Arduino/grbl-master (Note default Arduino installation path is “C:Program Files (x86)Arduino”)
- Open the Arduino IDE and confirm you have at least version 1.61 (You can check which version of the Arduino IDE you have by going to the “Help” drop down menu and then selecting “About Arduino”)
- Click the “File” drop down menu then “Examples” then “grbl” and finally “grblUpload”. This will open a new sketch.
- Connect your Arduino & upload the grbl sketch. Select the “Sketch” drop down menu then “Include Library” then “Add .ZIP Library…” In the file browser window navigate to the “grbl” folder located in the “grbl-master” folder.
6A. If you are using Arduino IDE version 1.7.10 click the “Sketch” drop down menu then “Import Library” then scroll to the bottom of the drop down menu. Select “GRBL” which is located on the bottom. Be sure to select your com port by using the “Tools” drop down menu then “Port”.
Step 2 – Download and install the Gcode sender on your PC
This software gets loaded to your PC and will send the Gcode to the Arduino. The UniversalGcodeSender is a Java based software and will require a least Java 7 be installed on your machine. You can check to see if you have Java installed on your computer by going here.
Click on the “Activate Java” button in the center of the screen to detect if Java is installed on your machine.
To download the latest Java version go here. Be sure to pay attention during the installation. There is a check box that is set to change your search engine and home page to “Yahoo.” If you don’t want that to happen make sure you uncheck the box. See the screen capture below.
Be sure to uncheck this box during the Java install otherwise your default search engine will be set to Yahoo.
Now onto installing the Universal Gcode Sender…
- Go to the Universal gCode Sender home page on GitHub by clicking here.
- Scroll down the page to the “Downloads” section. I like to work from the latest stable build in the case
1.0.81.0.9 - Click on the version number you wish to download.
- Unzip the folder and place it in your “Program Files” folder.
- Finally, create a desktop shortcut of the UniversalGcodeSender.jar extension by right clicking on the file and selecting “send to” then “desktop (create shortcut)”.
- Double click the UniversalGcodeSender.jar
That’s it! The software bit is finished. Now let’s put some hardware together. You are well on your way to getting your DIY CNC Controller running.
Step 3 – Wire your power supply (confirm polarity and set to 110 VAC)
WARNING – Use extreme caution here. You are dealing with 115 volts alternating current (household power) which can be very dangerous. If you don’t know what you are doing find a licensed professional to help you.
- Find the input power selector switch on your power supply and set it to match the AC line voltage you plan to use. This is really important. If the switch is not set correctly, you will destroy the power supply. In my case I set the switch to “115 VAC”. See the picture below.
AC voltage input selector switch located on the side of the power supply.
- Locate a donor power cord for your power supply. I used an old PC power cord and cutoff the female end.
- Remove approximately 1.5” (inch) of the outer cable sheathing. Be careful not to nick the conductors inside the cable. I used a sharp Xacto knife with a few light passes. I don’t cut all the way through. Instead, I take then end and split the cable sheathing along my cut line.
- Strip back the insulation approximately 1/4” on each of the green, black and white wires.
- Next, connect the green wire (ground) to the ground terminal labeled “⏚” on the back of the power supply.
- Connect the white wire (neutral) to the terminal labeled “N”
- Finally connect the black wire (line) to the terminal labeled “L”
- Double check all of your connections and make sure the DC voltage terminals are clear.
- Plug in the power supply and confirm its working. You will see a green LED light up near the terminals. Do not touch any of the terminals!
Click this link for the MeanWell SE-200 datasheet to learn about the power supply I am using. I purchased mine from Mouser for a total of $46.10 including tax and shipping. I know you can get cheaper power supplies but I have always had good luck with MeanWell products.
Step 4 – Connect the power supply to the grblShield and test
Now that you have your power supply all wired up, it’s time to connect it to the grblShield.
CAUTION – the grblShield does not have reverse polarity protection. If you hookup the supply voltage backwards, you will destroy your grblShield and need to send it back for a replacement.
- Using your multimeter confirm the output voltage and polarity of your power supply. You should see approximately 24 volts.
- Unplug the power supply.
- Connect the V+ terminal on the power supply to the Vmot screw terminal on the grblShield. I used 16 AWG stranded wire.
- Connect the V- terminal on the power supply to the GND screw terminal on the grblShield.
- Confirm you have the wires between the power supply and grblShield connected properly. I don’t want you to be slowed down by having to send your grblShield back to Synthetos.
- Plug in the power supply and confirm your grblShield is working. You will see a blue LED light up near the screw terminals. Again, do not touch any of the terminals!
- Unplug the power supply.
Click here for more details about getting started with the grblShield.
Step 5 – Connect the grblShield to your Arduino
If you have the latest version of the Arduino UNO rev 3 (R3) you can simple plug the Arduino into the grblShield. The Arduino R3 version has 8 pin header socket as the power. If you have an R3 just skip to Step 6.
However, if you are like me and you have an older Arduino, then you will need to make a quick mod to the grblShield that involves cutting a trace on the PCB and adding a jumper. It sounds daunting but it takes just a few minutes. The following process walks through the modifications required if you have an older Arduino.
- Disconnect all power from the grblShield.
- Cut the far left trace in the J11 power jumper section using a sharp x-acto knife. See the image below. The power jumper section is a 2×3 arrangement of plated through holes in the PCB below the Z axis stepper motor drive.
- Add a jumper wire to the far right pair of plated through holes in the J11 power jumper section. These are closest to the J5 and J6 markings on the PCB. I used a scrap piece of wire cut from a resistor and soldered the jumper in place.
Click here for additional logic power settings on the grblShield.
Moving the grblShield power jumper to accommodate older Arduinos.
Step 6 – Test the connection
Now it’s time to see if your PC, Arduino and grblShield are all playing nicely together.
- Connect the USB cable to your Arduino and PC
- Plug in the power supply for your grblShield
- Power on your PC and launch the Universal gCode Sender by clicking on the desktop shortcut
- Set the communication baud rate in the Universal gCode Sender to 115200. (Note if you are using grbl version v0.8 or lower set the baud rate to 9600.) See the picture below.
- Next select the COM port used to connect to your Arduino. if you do not know which one is, try the first COM port listed.
- Press the “Open” button next to the Baud rate selection box.
- If all systems are go then you will see a welcome message in the console window “grbl v0.9 [‘$’ for help].”
- If you received the welcome message, unplug your power supply and disconnect your Arduino from the PC.
Select the baud rate using the dropdown menu. For grbl version v0.9 use 115200.
Step 7 – Wire your stepper motors
The following process is for the 425 oz-in stepper motors available from Automation Technologies Inc.
These are 8 wire stepper motors. But wait the grblShield only has 4 connection points for each motor. These stepper motors have 4 coils. We need to configure these coils in such a way that we end up with 4 connection points. There is a bunch of data that describes the optimal way to wire a stepper motor. I chose the Bipolar (parallel) configuration. This will allow me to get the most out of these motors. In this configuration the motors will draw 2.8 amps (just slightly above the 2.5 rating of the grblShield) but based on the information from Synthetos, these work really well.
The motors have the following 8 wire leads each color coded:
Blue/White, Blue, Red/White, Red, Green/White, Green, Black/White, Black
You can use the data sheet to confirm the following wiring pattern.
A+ = Blue/White & Red/White
A – = Blue & Red
Mach3 Serial Port Setup For Windows 7
B+ = Green/White & Black/White
B- = Green & Black
I twisted the wire pairs together before installing them in the grblShield. The terminal clamps use tiny flat head screws and you will need a nice small screwdriver.
Serial Port Arduino
- Ensure all power is disconnected between the grblShield and Arduino. This includes the USB cable that connects the PC to the Arduino. Make sure this is removed before connecting the stepper motors.
- Connect the wire pairs to the X axis stepper motor terminals in the order listed above. See the picture below
Step 8 – Test the stepper motor
Now let’s bring it all together and make some noise!
- Find the current limit potentiometer on the grblShield for the axis you are using for your testing. I used the x axis.
- Gently turn the potentiometer counter clockwise until it stops. Forcing the potentiometers beyond the stop will make the axis inoperable.
- Power on your PC and launch the Universal gCode Sender by clicking on the desktop shortcut.
- Plug in the power supply for your grblShield.
- Next connect the USB cable to your Arduino and PC .
- Confirm your PC is talking to the grblShield by checking for the welcome message in the console window “grbl v0.9 [‘$’ for help].”
- Next type “G0 X1000” in the command window. This is a g-code command that tells the x axis to move 1000 mm from its current position. (The grblShield defaults to mm but this can be changes to inches if you are more comfortable in that unit system.)
- Gently turn the potentiometer clockwise until the motor begins to turn. Keep going until the motor runs smoothly. Note you will likely need to repeat this step one the stepper motors are installed in the machine.
- Send a few more g-code commands or play around with the buttons under the “Machine Control” tab.
The good folks at Synthetos have a nice getting started page for the grblShield here.
Final Thoughts
Wow, that’s a bunch of information to digest. If you have any questions or get stuck along the way feel free to e-mail me Tim@diymachining.com
Don’t forget to download the Quick Start Guide here. If you are a visual person, this is more your style.
Good luck with your project. I would love to hear what you are building with your DIY CNC Controller. Leave a quick note in the comments below.
Thanks for reading. Until next time… Tim
Like What You Just Read?
Enter your name & email address below to join our mailing list & receive the latest updates and information from us.