• SundayClosed
  • Monday10AM–7PM
  • Tuesday10AM–7PM
  • Wednesday10AM–7PM
  • Thursday10AM–7PM
  • Friday10AM–7PM
  • Saturday10AM–7PM
Call Us:    9404844825

CNC Controller with Arduino, TB6600 and GRBL

  • Difficulty Easy Moderate Difficulty
  • Share
  • Steps 8
  • Time Required 6hrs

Introduction

How to configure a new CNC? After building the C-Beam CNC which I got as a mechanical build from a Chinese maker it was time to start with the electronics. It took me a while to understand what components are required and how I should go about it. Because all these details were not available at one place I have decided to write this post in detail to explain them. Hope you enjoy it.

Step 1: Required components

  1. Stepper Motor: https://goo.gl/Qsu2Ba
  2. TB6600 Stepper Motor Driver: https://goo.gl/rryycT
  3. Arduino Uno: https://goo.gl/in5QcH
  4. Power Supply: https://goo.gl/3xigZV
  5. Emergency Stop Switch: https://goo.gl/b9Et5V
  6. Router & Power Switch: https://goo.gl/xtFt76
  7. 4 Pin Connectors: https://goo.gl/qcmXqr
  8. AC Power Connector: https://goo.gl/B2KnEJ
  9. C-Beam CNC Mechanical Build: https://goo.gl/qfn2FJ

Step 2: Explaining the compnents

Stepper Motors:

The stepper motors that I have used are Nema 23 stepper motors. But the same rules apply to all the different sizes of the stepper motors. Mostly they all work with 12v power and required different amperes. So its the amperes that you have to concentrate. In my case the power requirement is 3.0amps. And the angle of rotation is 1.8 degree which is very common.

We will be using these values in the stepper motor driver.

Stepper Motor Driver:

Since the power requirement of the stepper motor is around 3.0amps we need a stepper motor driver that can give at least 5amps. So the TB6600 stepper motor driver is perfect for this purpose.

This stepper motor driver has 6 switches on the sides and a tabular column printed on it. The first three switches manage the micro stepping and the last three switch manage the different current delivered. It may vary with the model of TB6600 stepper motor driver that you have. Because these come in different shapes and sizes. So please check before you use one.

In my case I went for the 16 micro stepping and set the driver to deliver around 3.0 – 3.2 amps of current.

Arduino Uno:

I prefer to use Arduino Uno because it comes with a lot of safety features. But you can use a Arduino Nano too if you have one. With Arduino Uno it is very easy to switch pins and get started with testing.

Power Supply:

A power supply that can deliver a voltage between 12v and 24v is ideal. The version of TB6600 stepper motor drivers demanded that I used just 12v so I went with that. Please check if your driver allows a wider range.

If we do the math for three stepper motors we need about 9amps. So a 10amp or a 15amp power supply would be enough for a CNC machine of this size.

The rest of the components used are a not absolutely necessary but its good if we could use them. So I have added links to them in the list above.

Step 3: Schematic Diagram.

 

Download the schematic Diagram: Download Here

The schematic diagram is well explained in the video. So please take a look.

A point to note in the schematic is that the DC power lines are the only connection that is made in parallel across all the stepper motor drivers. The rest of the wires are connected individually to its respective terminals.

The Arduino is powered when you connect it to the computer. So apart from grounding it there is no special power required for it.

If your stepper motor do not come with wire labels then there is an awesome video on youtube through which you can know which wires are pairs of A and B.

Watch the video here.

Step 4: Building the box

The CNC controller box is made out of 8mm waterproof MDF. I prefer to use the waterproof kind because I find them more strong. The box is made with glue and brad nails. No need to use the screw here because the brad nails hold plenty strong.

The stepper motor drivers are placed in a staggered format like steps. Stacking it like this will allow me to each reach the wires. Also the status LEDs which are on the top is visible at a glance. The box that I will build will be opened from the top. So this format is perfect.

After the four sides are put with glue and nails I can add the slanted face. I like this kind of design usually because it allows to me to mount the switches in a more accessible way. So attach this slanted face I first chamfer the edges to match with the sides. Then I can hold them with glue.

And after a thorough sanding I can spray paint it matt black.

Step 5: Adding components to the box

At the front and the back I want to attach the connectors. To do this I want to cut out some holes. But these holes are usually not perfect if you cut with a jig saw. So I decided to 3D print some face plate with which I can hide the cut outs.

At the back of the box I will have three connectors for the stepper motors, an AC power connector and a two pin plug for the router. And in the front I cut a whole to mount two 40mm cooling fans. This will allow air flow inside the controller box to cool the TB6600 stepper motor drivers.

And on the slanted face in the front I mounted an emergency stop switch, a power on switch and router switch. I will explain the safety mechanism of these switch further down.

Once all these components are attached to the box I was able to go ahead and do the connections based on the schematic diagram. This of course included a lot of wires so I took my time to make one single line of connections at a time so I made no mistakes. And I colour coded each line so there is no confusion. This kind of approach is slow but eliminates the changes to do mistakes.

Then I can move everything inside the box and cover it on the top with a 4mm acrylic sheet. Instead of glass this is a better choice.

Step 6: Switching on and Loading GRBL to Arduino

Now that the CNC Controller box is ready I can go ahead and switch it and connect the Arduino to my PC.

GRBL:

The first order of business is to upload GRBL to the arduino. Grbl as a language helps the computer communicate to the machine. GRBL is an extensive library and if you read through the documentation you can learn a lot many things.

But for the sake of this tutorial we just need to know two things. Download and upload the grbl and then set the X,Y and Z step values.

To download the GRBL please visit github at this url. Then download the git to the desktop. Once you unzip the folder you can see the folder named ‘grbl’. We need to copy this and place it in Arduino library. In mac the libraries is at the following location ‘user/documents/Arduino/libraries/’. Paste the folder named ‘grbl’ here. Then we need to restart Arduino to see the library.

Once Arduino is restarted go to File > Examples > Grbl and select ‘grblupload’. This will open up a page. Select the right board and port from the Arduino menu. Then hit the upload button to upload the Grbl to the Arduino.

Universal Gcode Sender:

The second order of business is to set the X,Y and Z steps. These steps mean that every revolution of the stepper motor how far it moves. Say if you want to move an inch then the number of steps determine if you are moving exact or not. To do that you need to a software called as Universal Gcode Sender. Gcode is a set of X co-ordinate values that the machine needs to move along its axis. And the Universal G-Code sender makes this happen.

You can download the Universal Gcode Sender from this url. Unzip the downloaded file. If you are unable to execute the .jar file then it means that you do not have java runtime. Please download it from the java website here. If you have the java or once you have installed it you can execute the ‘UniversalGcodeSender.jar’ file. This will open up an interface.

First we need to connect the Universal Gcode Sender to our CNC machine. To do that select the Port correctly and set the baud rate to 115200. Then click on Connect. This will show you a confirmation messages with ‘$ help’.

Now go to ‘Settings’ from the menu and select GRBL. This will give you a popup. It will have a lot of values. The main ones that we are interested are the $100, $101 and $102. In the video I have shown a detailed explanation on how I arrived at the value 400 for this. I believe the video is more explanatory.

With the GRBL and Universal Gcode Sender set the next is we can connect the machine to Easel and do some actual CNCing.

Step 7: Connecting to Easel

Easel is a free CNC software that is available from Inventables. You can access it from this url. You obviously need to sign in to use this service. So once I logged in you can see the ‘Carve’ button in green colour. But in case if you do not see it in green colour then it means that the Arduino port is being used by some other service, mostly like Universal Gcode Sender. So close that and Arduino and try it again. This may enable the green colour on the carve button again.

Once you click on the ‘Carve’ button you will be presented with a popup. On the right side in the popup you can see the machine controls. Using this you can move the CNC axis.

If you were able to reach till this place then it means you have done everything right. Teaching on how to use the Easel is out of the scope.

Step 8: Conclusion

In the CNC Controller box I have some security features. Mainly the emergency stop switch and router switch. The emergency stop is directly connected to the input power. If I push the emergency stop switch then it cuts power to the entire system so everything halts.

The second is the router switch. The router switch is connected to the power switch. So only after switching on the power switch the electricity is passed on to the router switch. So if the power switch is not switched on then the router switch wont work.

These kind of safety mechanism is required when dealing with CNC and router. These fast RPM machines are very dangerous. So these are mandatory.

I hope this article clearly explains every step in the process. Kindly let me know in the youtube comments if you have any questions.

Until next time. Happy Learning.