In general, all CNC electronics are broken down into 3 different areas: controller, stepper drivers, stepper motors.
The controller is the brains of the CNC machine. It can be a PC or an embedded controller like Arduino Mega or a stand-alone circuit board with chips on it. While a lot of variations exist, they are exchangeable and basically all do the same thing.
eCNC was designed and tested on an Arduino Mega 2560 board. Even if the code of the firmware can easily adapt to other Arduino boards, I opted for Arduino Mega 2560 because it provides a high number of connection and more feature that are useful in this development phase. All these things with a reasonable cost.
In order to simplify the connection of motors, switches and other components, I used a shield designed for the control of 3D printers, but it has all the necessary plugs for a simple CNC machine (for sake of precision a 3D printer is a CNC machine). The shield is RAMP 1.4, designed by the RepRap community.
More details about the ports provided by RAMPS 1.4 can be found in the schematic of the shield and in the port mapping scheme. You can also assemble one your own following the instruction here.
A stepper driver is a chip that acts as a kind of middle-man between a stepper motor and the controller. It simplifies the signals that need to be sent to the stepper motor in order to get it to move.
Sometimes the stepper drivers are on separate circuit boards that are linked to the controller via cables.
Sometimes the stepper drivers are on small circuit boards that plug directly into the controller itself. In this case, the controller will have space for at least 4 of these small circuit boards (one for each stepper motor).
Finally, sometimes the stepper drivers are soldered right onto the controller itself.
RAMPS is the acronym of "RepRap Arduino Mega Pololu Shield", indeed it was designed to operate with Pololu A4988 Stepper Moter Driver. This product is a breakout board for Allegro’s A4988 DMOS Microstepping Driver with Translator and Overcurrent Protection; please read the A4988 datasheet carefully before using this product. This stepper motor driver lets you to operate bipolar stepper motors in full-, half-, quarter-, eighth-, and sixteenth-step modes, with an output drive capacity of up to 35 V and 2 A. A drawback of this board due to its small dimension is that it could become very hot. If the boards get too hot, they will interrupt the current until it cools a bit. If the current is too high for the heat sinking, the motors will pulse as the current is interrupted and restored. To prevent it, I recommend to use metal heat sinks and a small cooling fan. You can find more details here about A4988 or you can refer to the datasheet.
A stepper motor is a type of electric motor that can be accurately controlled with the controller. A CNC machine has at least 3 motors, one for each axis (x/y/z axis). Sometime, one of these axes is controlled by two motors due to the need of more force to perform the work for which it is designed. More details on motors technology are in Motors section.
According the capacity of A4988, I chose the Nema 17 motors to move each axes, because they are an expensive solution to rapidly realize a CNC prototype to test the firmware.
I know that the stepper motor drivers and the motors chosen in this guide probably are not the best setup to realize a CNC machine enough performing that can work with hard materials such as iron, aluminum or hard woods, but the construction and dimensioning of a CNC machine is beyond the scope of this project.
The first step is to connect together the Arduino Mega and the RAMPS shield as shown in the below figure.
A microstepping driver such as the A4988 allows higher resolutions than 200 steps per revolution. Before connecting the A4988, you have to configure the microstep mode using a correct combination of jumpers (more details here)
The figure above shows the configuration of sixteenth microstep resolution mode.
Now, you can connect the A4988 stepper driver as shown below. Remember to perform the current limiting throw the potentiometer on the A4988, see here.
It should look like to the figure below. The number of connected A4988 depends on the number of stepper motors.
It remains to connect the motors, the fan to cool the motor drivers and if you use them, you can connect the limit switches and the spindle control (it can control only the powering on/off of the milling machine). You can follow the below scheme to connect all these components.
According the above setup, you can use the follow configuration file (config.h). More details on the configuration file are here
#define ROUTER_MX_STEPS_PER_ROUND 200.0 #define ROUTER_MY_STEPS_PER_ROUND 200.0 #define ROUTER_MZ_STEPS_PER_ROUND 200.0 #define ROUTER_MX_STEPS_PER_MM ROUTER_MX_STEPS_PER_ROUND/1.256 // 1.256 depends on the screw pitch, 1.256 mm/round #define ROUTER_MY_STEPS_PER_MM ROUTER_MY_STEPS_PER_ROUND/1.25 #define ROUTER_MZ_STEPS_PER_MM ROUTER_MZ_STEPS_PER_ROUND/1.256 #define ROUTER_MX_SPEED 2400.0 // steps/s #define ROUTER_MY_SPEED 2400.0 #define ROUTER_MZ_SPEED 2400.0 #define ROUTER_DOWN_LIMIT_SWITCH_X_INTERRUPT 1 // interrupt number #define ROUTER_DOWN_LIMIT_SWITCH_Y_INTERRUPT 0 #define ROUTER_DOWN_LIMIT_SWITCH_Z_INTERRUPT 4 #define ROUTER_UP_LIMIT_SWITCH_X_INTERRUPT -1 #define ROUTER_UP_LIMIT_SWITCH_Y_INTERRUPT -1 #define ROUTER_UP_LIMIT_SWITCH_Z_INTERRUPT -1 //#define ROUTER_MX_CONTROLLER_ULN2003A #define ROUTER_MX_CONTROLLER_A4988 #if defined(ROUTER_MX_CONTROLLER_ULN2003A) #define ROUTER_MX_COIL1_PIN 4 #define ROUTER_MX_COIL2_PIN 5 #define ROUTER_MX_COIL3_PIN 6 #define ROUTER_MX_COIL4_PIN 7 #endif #if defined(ROUTER_MX_CONTROLLER_A4988) #define ROUTE_MX_STEP_CONTROL_PIN A0 #define ROUTE_MX_DIRECTION_CONTROL_PIN A1 #define ROUTE_MX_ENABLE_CONTROL_PIN 38 #endif //#define ROUTER_MY_CONTROLLER_ULN2003A #define ROUTER_MY_CONTROLLER_A4988 #if defined(ROUTER_MY_CONTROLLER_ULN2003A) #define ROUTER_MY_COIL1_PIN 8 #define ROUTER_MY_COIL2_PIN 9 #define ROUTER_MY_COIL3_PIN 10 #define ROUTER_MY_COIL4_PIN 11 #endif #if defined(ROUTER_MY_CONTROLLER_A4988) #define ROUTE_MY_STEP_CONTROL_PIN 46 #define ROUTE_MY_DIRECTION_CONTROL_PIN 48 #define ROUTE_MY_ENABLE_CONTROL_PIN A8 #endif //#define ROUTER_MZ_CONTROLLER_ULN2003A #define ROUTER_MZ_CONTROLLER_A4988 #if defined(ROUTER_MZ_CONTROLLER_ULN2003A) #define ROUTER_MZ_COIL1_PIN 8 #define ROUTER_MZ_COIL2_PIN 9 #define ROUTER_MZ_COIL3_PIN 10 #define ROUTER_MZ_COIL4_PIN 11 #endif #if defined(ROUTER_MZ_CONTROLLER_A4988) #define ROUTE_MZ_STEP_CONTROL_PIN A6 #define ROUTE_MZ_DIRECTION_CONTROL_PIN A7 #define ROUTE_MZ_ENABLE_CONTROL_PIN A2 #endif // ***************************** // * UTENSILS * // ***************************** //#define _PLOTTER_SERVO #define _MILLING_MACHINE // ***************************** // * UTENSIL SETUP * // ***************************** #ifdef _PLOTTER_SERVO #define _PLOTTER_SERVO_PIN 5 #define _PLOTTER_SERVO_UP_POS 80 #define _PLOTTER_SERVO_DOWN_POS 136 #endif #ifdef _MILLING_MACHINE #define _MILLING_MACHINE_ENABLE_PIN 10 #define _MILLING_MACHINE_SPEED_PIN 11 #endif
Easy CNC by Francesco Giurlanda is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at http://sourceforge.net/projects/easycnc/support?source=navbar.