You want to create your own CNC machine.
You have seen a CNC so you want to assemble your own machine.
Good news: you can have a low priced CNC with this PCB, simple and having fun doing it.
Designing the framework is not complicated. You can use 3D printer objects and an aluminium structure. All done using freeware like FreeCAD
Surprisingly, there are not many inexpensive electronic options. And we cannot find an open source code for Arduino (perhaps we are wrong). But we didn`t find anything in a quick search.
There is one at Ebay or Aliexpress called Arduino CNC Shield.
Doing some research, we found that the project authors didn`t like chinese manufacturing their PCBs without adding any newness (which I agree, the Open Hardware movement is about the comunity) . So I didn`d find the opensource files of this PCB.
I also want to learn KiCad (an opensource software for PCB design), we decided to create the PCB for this product using exactly the same pins as the original one and obtain a complete experience on a KiCad project.
And this is the final result. The SB CNC Shield for Arduino Uno, 100% compatible with GRBL.
We were following the same philosophy like the popular RAMPS 1.4 SB: branded components, such as the Molex connector, a nice design with a black PCB with gold finish, and a complete testing before the product leaves our factory.
What can I do with a SB CNC Shield for Arduino Uno?
The main idea of this PCB is that you can assemble your own functional CNC with an adjusted budget.
If you are interested on machines or robotics you should create your own CNC machine. There are many not too obvious issues at the beginning. Motors, drivers, warm, software, straps, spaces..
Even if you want to buy a more expensive machine and you haven`t any CNC experience, it is a better idea to create your own machine to learn.
SB CNC Shield is 100% Open Hardware. It is designed with KiCad and you can read the schematic, check the PCB design, learn about electronics, improve it, or doing what you want to do.
The most important part of the Open Hardware is that we can create a comunity sharing experiences, new ideas and solving problems.
This PCB is 100% compatible with the popular firmware GRBL. You don´t need to configure nothing special. Plug and Play.
And there is a big community behind this project. You can belong to it.
Why not a complete CNC PCB?
Well, you can search for a complete CNC PCB. If you are serious with the CNC, you should do it.
An integrated PCB is independent. You don´t need a computer to sending commands to the machine.
There are PCBs with open source code with a big community. This is very important if you want a proper support. But most of them, they are closed source or they have owned firmware.
And mainly we are talking about price. These PCBs are usually more than 100 euros. If you are preparing a casual project with a small CNC, this is too expensive.
What do I need?
To createt a complet CNC you will need:
- One Arduino Uno (or compatible PCB)
- One Arduino Uno (or compatible PCB)
- 3 motor drivers at least (you can use the popular a4988, or if you need more power, the DRV8825)
- 3 bipolar stepper motors
- One power supply. You can reuse the PC one with our ATX Board.
- A drill, demel, láser, or something you can use to cut the material.
- It is possible that you will need a drill controller or a relay to turn on the dremel.
- An aluminium framework (you can assemble it with aluminium profiles or a 3D printer)
- Nice design in black with gold finish, coloured pins and a blue reset button.
- Simple yellow jumpers to modify the configuration
- 15A Molex power connector. Remember that the chinese connectors can be burnt, melt and generate a disaster
- AWG22 cables support for the power supply
- 100% compatible with the GRBL firmware. Plug and Play.
- You can duplicate any axis or sacrifice the spindle to use an aditional fourth axis. Simply change the jumpers position and dupplicate any axis.
- 35V capacitors. You can use a 24V power supply without problem.
- Endstops for X, Y, Z. You can use a limit for the minimum and maximum path of each axis.
- External emergency button
- Designed to take advantage of the PWM capacity from GRBL and control the drill velocity.
- Jumpers to configure the microstepping separately for each driver so you can get a fluently and smooth motor movement.
- Output to connect external drivers, for example, the advanced Gecko.
- Additional GRBL pins, such as the refrigerant valve, Pause, Restart and Abort.
- UART Port. You can connect a Bluetooth device to get a wireless machine.
- I2C Connector. You can connect, for example, a temperature sensor or a display (but you will need to hack a little bit the GRBL)
How to begin step by step with the CNC Arduino Shield
I will help you step by step to assemble the electronics. In this guide I will probably forgot some details. That is why my compromise is to extend it constantly in the future. If you have any issues with the instalation, please let me know and send me a comment.
You will need at least:
- An Arduino Uno and a PC to upload the firmware.
- A bipolar stepper driver such as the DRV8825 or the A4988. You need one for each motor.
- A bipolar stepper motor, for example, the NEMA17 with a dupont connector with 4 pins.
- A power supply for the motors. Normally it will be 12V and at least 5A. I recommend a 30A one to power the drill as well so it won´t be forced.
- An endstop button. You will need one for each axis. I have written down a section specially for the endstops because many people has doubts about them.
- And of course, the gorgeous Arduino SB CNC Shield
The first step is to install the GRBL in the Arduino Uno.
I do it before connecting any driver or motor. Even it is not necessary to connect the shield.
Connect to the serial port. If you have Windows, you can use a program such as putty.exe. At this moment I don´t recommend you to use any CNC controlling app, such as bCNC. First you need to make sure that everything works and then you can install the controller app.
You should receive the
ok each time you press enter.
After that, you have everything to control the CNC from your computer.
Arduino SB Shield
Now we need to connect the Arduino CNC shield on the Arduino Uno. Please be careful to not bending the pins and that everything fits properly!
Then we connect one stepper driver. Please connect only the X axis driver to verify that it moves.
Make sure that you have the power supply disconnected.
Make sure that you are connecting them with the appropriate order and you are not connecting them on the other way around.
Now we connect the stepper motor.
The PCB allos you to connect two motors. You can connect them to anyone of the rows.
Now connect the motor electricity. Be careful about the positive and negative connection. It is possible that you burn the driver if you connect them in the wrong way.
At this moment, you have all the necessary configuration to do tests.
Movement and calibration tests.
With the Arduino connected to the serial port and the power supply turned on, type on the terminal:
X axis should be moving!
Turn off the motors and disconnect the Arduino. Don´t do anything before the power supply is turned off!
Connect the Y axis driver and motor. Repeat the operation with the command
An after the Z axis driver, the stepper motor and the command
Now you have all the motors connected.
It is time to configure the steps per mm. You need to connect to GRBL via console and type:
It means that the X axis has 400 steps per milimeter. It is an arbitrary number.
Then you can order it to move 100mm. It is easier to calibrate if you use long distances. The error will be less.
If you have a ruler, use it to measure how long it has really moved and perform a rule of three.
For example, if we have moved 35mm (it is just an example, don´t use it as reference)
If it has been moved 35mm with 400 steps, then if you want to move it 100mm:
(400*100)/35 = 1143 steps
So we type on the console:
and we repeat the calibration until we have the machine adjusted.
I have used the example with 400 steps per mm to begin with. The number of steps per milimeter can be calculated a priori if you know the details about the motors, drivers and strap or spindle specifications.
Here you can see a typical case with 200 steps per revolution motors and an 8mm spindle pitch.
(200 motor steps * 32 drv8825 microsteps) / 8mm spindle pitch = 400 steps per mm
When we have the X axis ready then we do it with the Y axis:
Then we configure the Z axis:
And finally you have the machine working!
Setup the limits
The electronics send commands so the machine moves from one position to another.
But how does it know which is the actual position?
At some point, we have to let the machine knows its initial position. When we turn on the PCB, the GRBL assumes it is the initial position. The position 0,0,0
We execute the command home. Then the machine moves the motors until the beginning (or the final) of the axis.
For that purpose, we use the endstop buttons.
When the machine touch the border, a button is pushed. Then everything stops and the machine knows it is the zero position.
In many cases, the X and Y position don´t need a super precision. But the height or Z is very important.
For example, a 3D printer has to place the plastic with an exactly height. If the extruder is half milimeter up, the plastic won´t stick. If the extruder is below then the base will block the extruder to work.
For this reason, we can use more precise sensors than a simple button, such as the inductive or capacitive sensors. We will back to them later.
For a simple machine, we don´t need such precision.
You can observe that an endstop has 3 pins.
We just need to solder two of them and the third is available.
If we look closer we will realize that one of the pins has marked with a C or COM. That means COMMON. You have to solder this cable mandatorily.
The other two has the caption NO, NC, from Normally Open, Normally Closed.
At this point you need to choose which one you want to solder:
- Normally Open: The button doesn´t allow electricity until we press it and it closes.
- Normally Closed: The electricity circulate until we press the button and it is open.
Normally Open configuration
By default, the configuration in the firmware is Normally Open. When we push the button then the electricity circulates, Arduino detects it and the movement stops.
So you can have a pair of endstops. One for the beginning and one for the endstop (the PCB uses the same pin for the minimum and maximum)
Where is the problem?
Imagine that for any reason, the cable is broken or it disconnects. Then the machine will move forward to the end and when you push the button..nothing happens! Because the cable is disconnected. The motor will continuously moving forward. Disaster.
Normally Closed configuration
In this setup, the endstop is always pushed. When we press the button, the electricity stops. Arduino detects there is no tension and the movement stops.
This is important. If for any reason the circuit is switched off, Arduino will stop the machine.
This will happen because the button is pushed or because the cable is disconnected.
This is the most recommended configuration and the one which is used on a professional machine.
But it has a problem. With the Arduino SB CNC Shield you can use only one endstop for each axis (minimum and maximum pins are connected)
Because of it, if you use to endstops, you will need to press 2 buttons to stop the circuit.
The solution is to connect the endstop in series. Instead of connect the limits directly to the Arduino CNC, you connect the endstop pin with the next one.
The idea is, if you have all the endstop normally closed in series and anyone of them is open, the machine will stop. You won´t be able to detect which one is failing, but this does not matter.
What you need is the machine stops at the limit.
Normally Open endstop setup
This is the configuration by default in GRBL.
The first thing is to know the actual state of the endstops. We connect with our Arduino thru a terminal (such as putty.exe on Windows)
We activate the data output:
This command is weird. But listen to me. With this command we are asking GRBL to print on the terminal all the information of the position and endstops.
To view this information, we have to press
? (you can press
? although the machine is moving).
Lim:000 all ok
Lim:001 X limit pressed
Lim:010 Y limit pressed
Lim:100 Z limit pressed
Lim:111 XYZ limits pressed
Do you understand the idea, don´t you?
We can make tests with the endstop pressed and typing
Now that we know the states of the buttons, we activate the Normally Open configuration (it is already activated in series but we go step by step.
With this, we are informing that all buttons are normally open, and when they are pushed the circuit will be activated. This means if we are not pressing anything we will view
Lim: 000 in the output.
It is time to activate the hardware endstops:
With this, when we push any of the endstops, GRBL will get attention and everything will stop. We will need to rest the machine to continue.
Now we order the machine to go forward, using a simple gcode (move forward 100 on the X)
The X motor will move forward. And when the endstop is pushed, then the machine should stop and GRBL will indicate we are in alert.
We reset the PCB and test with the next axis.
Normally Closed endstop setup
The difference is, you need to inform GRBL that the buttons run on the other way around. Closed means not pressed and open means pressed.
With this, GRBL understands that the button is normally closed and when this is pushed, the circuit open.
We test the state with the command
? and check that the limits are on
The yellow jumper EN_SETUP
By factory default, when a circuit is closed, the Arduino pin which detects the endstops is connected to GND. That is why it is called Active Low. It means that it is activated when the pin is set to 0.
But there are situations, more technically, that the people prefers to activate it when it is set to 1 (active high). Ins this case, we need a resistor to do the pull down, and change the yellow jumper to EN_SETUP.
In this configuration it makes sense if you are working at an electrical noisy environment and there are risks that the limits are enabled because of interferences.
My advise is don´t use it unless you know exactly what you want to do and maintain the Active Low.
- Schematic PDF
- https://github.com/staticboards/sb-cnc-shield : Github Repository
- http://blog.protoneer.co.nz/arduino-cnc-shield/ Original design with all the relevant information
- https://github.com/grbl/grbl : GRBL firmware.
- https://github.com/winder/Universal-G-Code-Sender Java application to control the CNC