CNC Shield
Safety Statement
The author of this document is not liable or responsible for any accidents, injuries, equipment damage, property damage, loss of money or loss of time resulting from improper use of electrical or mechanical or software products.
Assembling electrical and mechanical CNC machine components like power supplies, motors, drivers or other electrical and mechanical components involves dealing with high voltage AC (alternating current) or DC (direct current) and other hazardous items which can be extremely dangerous and needs high attention to detail, experience, knowledge of software, electricity, electro-mechanics and mechanics.
BEFORE MAKING ANY CONNECTIONS OR DISCONNECTIONS POWER MUST BE REMOVED FROM THE DEVICE AND THE CONTROLLER. FAILURE TO DO SO WILL VOID ANY AND ALL WARRANTIES.
Before starting please read though all the instructions.
Note : Any Mains power connections must be installed by a Licensed electrician or suitability qualified person.
Errors and omissions excepted
Introduction
The CNC Shield was designed by Protoneer.co.nz to take advantage of the demand for a low-cost controller solution for DIY CNC machines. It was designed to be 100% compatible with Grbl, the Opensource G-Code interpreter, and fit onto the popular Arduino Uno. The CNC Shield can be used to control a number of different types of CNC machines, including CNC milling machines, laser engraving/cutting machines, drawing machines, 3D printers or any project that needs precision control of stepper motors. It uses Pololu and compatible stepper drivers, either the A4988 or the higher current DRV8825.
There are 3 main components needed to get the CNC Shield up and running, 1) CNC Shield; 2) Stepper Drivers, and; 3) Arduino UNO. Each of these will be mentioned below.
Version 3.0 of the CNC Shield is used throughout this guide.
The CNC Shield is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Please note: this document is a guide and not a manual. The CNC Shield and Grbl are Opensource and under constant development and modification. As a result, this document provides guidance but is by no mean comprehensive nor authoritative. It is essential that all users do their own research and find solutions that suit their application and requirements.
Features
Arduino UNO Compatible
- 14 digital input/output pins – 6 pins can be used as PWM outputs
- 6 analog inputs
- 16 MHz crystal oscillator
- Operates at 5V
- Recommended input voltage range: 7V to 12V
- Flash Memory: 32 KB (0.5KB used by bootloader)
- SRAM: 2KB
- EEPROM: 1KB
CNC Shield
- Version 3.00
- 4-Axis support (X, Y, Z , A-Can duplicate X,Y,Z or do a full 4th axis with custom firmware using pins D12 and D13)
- 2 x End stops for each axis (6 in total - each axis pair shared by same IO pin)
- Spindle enable and direction connection
- Coolant enable connection
- Uses GRBL as control software
- Power supply: DC 12-36V (only the DRV8825 drivers can handle up to 36V so if using A4988 do not exceed 24V)
- Uses removable stepper drivers (DRV8825 or A4988)
- Stepper Motors can be connected with 4 pin dupont/molex connectors
- Jumpers to set Micro-Stepping
DRV8825 Stepper Drivers
- Low RDS (ON) outputs
- Automatic current decay mode detection / selection
- Internal UVLO
- Mixed with slow current decay modes
- Synchronous rectification for low power dissipation
- Crossover-current protection
- Thermal shutdown circuitry
- 3.3 and 5 V compatible logic supply
- Ground Fault Circuit
- Load short-circuit protection
- Six microstepping modes: full, 1/2, 1/4, 1/8, 1/16 and 1/32
A4988 Stepper Drivers
- Simple step and direction control interface
- Five different step resolutions: full, 1/2, 1/4, 1/8 and 1/16
- Adjustable current control lets you set the maximum current output with a potentiometer, which lets you use voltages above your stepper Motor’s rated voltage to achieve higher step rates
- Intelligent chopping control that automatically selects the correct current decay mode (fast decay or slow decay)
- Over-temperature thermal shutdown, under-voltage lockout, and crossover-current protection
- Short-to-ground and shorted-load protection
Application
Suitable for a variety of small and medium sized automation equipment and instruments, such as: engraving machine, marking machine, cutting machine, laser typesetting, plotters, drawbots, CNC machine tools, handling the devices.
Notes for Some Compatible UNOs
Some compatible UNOs uses the CH340 USB to serial chip. In order for your computer to recognize the UNO you may need to download the latest CH340 driver:
http://www.wch.cn/download/CH341SER_ZIP.html
Read more here:
http://www.arduined.eu/ch340-windows-8-driver-download/
http://www.microcontrols.org/arduino-uno-clone-ch340-ch341-chipset-usb-drivers/
Grbl on the UNO
Before connecting the UNO to the CNC Shield it is best to load Grbl onto the UNO. For a full description and complete details of Grbl please see the Wiki on the Grbl project pages:
https://github.com/grbl/grbl/wiki
There are many conversations about which version of Grbl to use with a v3.0 CNC Shield. Protoneer say that only Grbl v0.8 is compatible, but later version can be used with slight modification to the config.h file. For more details about the difference between v0.8 and v0.9 see:
https://github.com/grbl/grbl/wiki/Connecting-Grbl
To use v0.9 and higher just comment out the “#define VARIABLE_SPINDLE” line in config.h. For example, in v0.9 this is on line 247:
243 // Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle 244 // enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled. 245 // NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch! 246 // The hardware PWM output on pin D11 is required for variable spindle output voltages. 247 #define VARIABLE_SPINDLE // Default enabled. Comment to disable.
Change line 247 to:
247 //#define VARIABLE_SPINDLE // Default enabled. Comment to disable.
For v1.1 change line 339 to:
339 //#define VARIABLE_SPINDLE // Default enabled. Comment to disable.
So given the above, choose the version of Grbl that suits your application and build and download as per the instructions in the Grbl Wiki page.
There are many settings that can be defined prior to loading Grbl onto the UNO. For more information on what each of the settings mean see the Wiki page:
Loading Grbl on the UNO
The best and easiest way to load Grbl onto the UNO is to use the Arduino IDE. This can be downloaded from:
https://www.arduino.cc/en/Main/Software
Install and follow the instruction as detailed on the Arduino website.
To load Grbl onto the UNO:
- Open the sketch (from the Arduino IDE menu File/Examples/grbl/grblUpload)
- In the IDE make sure you have all the settings correctly set for the type of board, port and etc.
- Click the “Upload” button.
- The IDE will report “Done Uploading” when it is finished uploading:
- If you get errors, then please read the Arduino IDE help and/or the Grbl Wiki.
Confirm Grbl on the UNO
- Open the IDE serial monitor (Tools/Serial Monitor)
- If Grbl is loaded correctly then it will report the version in the Monitor window:
Wiring and Connections Guide
Safety and Handling Requirements
Before wiring it is essential to note a couple of safety issues and handling requirements.
While the voltages on and around the CNC Shield are low (5V for the Arduino and up to 36V for the CNC Shield and steppers) it is still possible to hurt both yourself and the components if handled incorrectly or without care. The following points are critical and cannot be emphasized strongly enough. Read carefully:
- NEVER connect or disconnect any stepper motor to the CNC Shield while power is on or connected.
- ALWAYS disconnect the power before connecting or disconnecting the stepper motors.
- When installing the driver make sure to correctly orientate the driver so the enable pin (EN) matches the EN pin on the CNC Shield (top left). Note that the small potentiometer is on the bottom of the A9488 while it is on the top of the DRV8825 – so take care not to confuse the two drivers.
- ALWAYS connect a stepper motor to the CNC Shield when testing or using the CNC Shield and driver. This is very important because the stepper drivers are designed to ramp up the current until it reaches the current needed to run. Without a stepper motor connected there will be nothing to consume the current and you can end up damaging the stepper driver if it over-heats in the process.
- When affixing a heatsink to the drivers it is critical not to short out any of the pins. Place the heatsink in the middle. Failure to correctly place the heatsink can lead to the driver shorting out and failing. This a common cause of driver failure and is a very common handling error.
Component Assembly
Below is a general outline process for connection of the various components:
- Taking normal static electricity precautions, insert the CNC Shield into the Arduino Uno making sure the correct pins of the CNC Shield are inserted into the correct UNO headers.
- Decide on the micro stepper setting for your application and place the jumpers as required
In the tables below High indicates that a Jumper is insert and Low indicates that no jumper is inserted.
A4988 Stepper Driver configuration
M0 | M1 | M2 | Microstep Resolution |
---|---|---|---|
Low | Low | Low | Full step |
High | Low | Low | Half step |
Low | High | Low | Quarter step |
High | High | Low | Eighth step |
High | High | High | Sixteenth step |
DRV8825 Stepper Driver configuration
M0 | M1 | M2 | Microstep Resolution |
---|---|---|---|
Low | Low | Low | Full step |
High | Low | Low | Half step |
Low | High | Low | 1/4 step |
High | High | Low | 1/8 step |
Low | Low | High | 1/16 step |
High | Low | High | 1/32 step |
Low | High | High | 1/32 step |
High | High | High | 1/32 step |
- Insert the stepper drivers into the CNC Shield paying special attention to match the enable pin (EN) to the enable socket (EN).
- Connect the stepper motors to the header pins. Take care to check your stepper motor to make sure the correct wiring sequence. Different stepper motors have different colour wires, so use the stepper’s Technical Specifications sheet to determine the sequence.
- Unordered List ItemReferring to the details on the Protoneer website, set jumpers for slave axis and connect additional limit/home switches and probes as per your application requirements, see:
https://blog.protoneer.co.nz/arduino-cnc-shield-v3-00-assembly-guide/
Testing
Protoneer has published what they call a “Pre-Flight Checklist”. This is a great resource for testing the CNC Shield. See:
https://blog.protoneer.co.nz/arduino-cnc-shield-v3-00-assembly-guide/
Configuring Grbl
There are many Wikis, blogs and posts about how to configure Grbl, see the links section below for some. For Grbl v0.9 see:
https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9
Connect to the UNO using a serial console program like Putty or a Grbl GUI (see links below for some examples) and enter “$$” to see a list of settings:
$0=10 (step pulse, usec) $1=25 (step idle delay, msec) $2=0 (step port invert mask:00000000) $3=6 (dir port invert mask:00000110) $4=0 (step enable invert, bool) $5=0 (limit pins invert, bool) $6=0 (probe pin invert, bool) $10=3 (status report mask:00000011) $11=0.020 (junction deviation, mm) $12=0.002 (arc tolerance, mm) $13=0 (report inches, bool) $20=0 (soft limits, bool) $21=0 (hard limits, bool) $22=0 (homing cycle, bool) $23=1 (homing dir invert mask:00000001) $24=50.000 (homing feed, mm/min) $25=635.000 (homing seek, mm/min) $26=250 (homing debounce, msec) $27=1.000 (homing pull-off, mm) $100=314.961 (x, step/mm) $101=314.961 (y, step/mm) $102=314.961 (z, step/mm) $110=635.000 (x max rate, mm/min) $111=635.000 (y max rate, mm/min) $112=635.000 (z max rate, mm/min) $120=50.000 (x accel, mm/sec^2) $121=50.000 (y accel, mm/sec^2) $122=50.000 (z accel, mm/sec^2) $130=225.000 (x max travel, mm) $131=125.000 (y max travel, mm) $132=170.000 (z max travel, mm)
It is essential to modify these settings to suit your application, machine and requirements.
Images
Links and Credits
Designer of the CNC Shield: | https://blog.protoneer.co.nz/arduino-cnc-shield/ |
Grbl to v0.9: | https://github.com/grbl/grbl/wiki |
Grbl from v1.1: | https://github.com/gnea/grbl/wiki |
Grbl GUIs: | https://github.com/gnea/grbl/wiki/Using-Grbl |
Driver Details: | https://www.pololu.com/category/120/stepper-motor-drivers |
Wikipedia Arduino entry: | https://en.wikipedia.org/wiki/Arduino |
Arduino IDE: | https://www.arduino.cc/en/Main/Software |
PuTTY serial console: | https://www.putty.org/ |