CNC Electronics and Wiring
Most of the tutorials on this site are created in response to the difficulties I see users having with machines mechanics, structural dimensions and the electronics that drive their CNC machines. Overwhelmingly, I have noticed the electronics pose the most difficulty with new users. I have put together another set of wiring instructions that demonstrate a methodology that begins with a simple and straightforward wiring of only one driver and motor and follows with the remaining drivers while testing throughout. The steps per inch for many forms of mechanical option are also explained in depth.
We still don't know if the motor will turn. The steps per inch must be known. If the steps per inch is too high, the motor will stall immediately. If the steps per inch is too low, the motor will barely move. This, along with the velocity and acceleration can get very complicated and frustrating. It is best to do the calculations early. These calculations are not difficult and I encourage everyone to get their feet wet (soaking wet). I show the calculations in very easy to understand steps.
So, with the first driver and motor turning and making noise, it's time to connect all of the drivers. It is important to think through the placement of the drivers so the wires are short and the power wires are far away from the signal wires. Why is this important? Signals have a somewhat narrow range of voltage within which they are allowed. The power wires, can disrupt (or influence) the signal voltage, pushing it outside of its comfort zone. This can cause unpredictable results.
In summary, all of the electronics have been connected. Two power supplies are connected supplying 36 volts for the motors and 5 volts to condition the signals. The breakout board is connected and powered by the 5 volt supply. The software is correctly setup and the parallel port is showing the correct signals. All of the drivers are connected to the breakout board and are getting 36 volts of power from the main power supply. A single motor has been tested and turns, so we know that the breakout board is working and the driver and motor function properly, so the remaining motors can be connected confidently. With this new knowledge, you will be armed with the necessary experience and information to troubleshoot an possible problems that may exist.
Beginning with only one driver and motor eliminates most of the complexity that typically scares the timid folks out there. But first, the power must be establish. The electronics require two forms of power: the high current and high voltage DC power for the motors and the low DC voltage power for the signals.
In these videos, the motors are being fed by 36 volts and a max of 8.8 amps of current. However, various levels of voltage and current can be used. An explanation of the requirements of motors and drivers will be explained in a future tutorial. The main power supply is dedicated to maintaining a constant 36 volts and permitting a maximum of 8.8 amps and is directly connected to the drivers at the VCC and GND terminal connections. The main line from the wall is connected to the neutral, live and ground connections on the power supply. There are three connections labeled +V and COM which are the connections for the 36 volt DC, which is connected to the drivers.
The breakout board requires 5 volts of power to condition the signals. Signals are received by the parallel port as inputs and are sent from the breakout board as outputs. Outputs are generally to control the motors, router operation, coolant operation or various other machine peripherals. The inputs are signals that are sent by the limit switches, home switches/plates, or for closed loop control for the motors using various means (optical sensors, encoders, laser positioning, etc.). The latter is outside the scope of this tutorial as this is aimed to get the basic electronics established. This 5 volt power to the breakout board can be sourced using a couple of methods: a wall adapter, small power supply, or USB power. All of these supplied must by rated for at least 400 milliamps or .4 amps of current. This power is connected directly to the breakout board's 5 volt terminal, EN terminal and the GND terminal.
After the power supplies have been properly connected, the output of power should be tested to determine if the correct voltage is being produced. A standard millimeter can be used to test the voltage from the power supplies
The breakout board in next in line to be connected. The breakout board is simply a way to access the individual pins of a parallel port. The breakout board also conditions the signals to and from the parallel port so the signal is clean and contains the current needed. Some pins are dedicated to outputting a signal and some for inputting a signal. This is, to some degree, customizable using the jumpers on the board.
Before the breakout board is connected to the computer, it would be nice to know that the software and parallel port from the computer is functioning properly. The only way a breakout board is going to receive the signals, or allow the signals to be sent to the computer properly is if the parallel port is working, the software is set up to communicate to the parallel port and the correct type of parallel port cable is used. I show the testing at the back of the computer to eliminate the possibility that the cable is the culprit. A bare metal paper clip comes in handy for this test.
Once the power is established and the parallel port is connected to the breakout board, a driver can be connected from the output pin terminal. The driver request a pulse for the step (pul or CP) signal and a high or low signal for the direction (dir). The step pulse is a single voltage change to the driver that tells the driver to move the motor one position. The direction pin will tell the driver to move in one direction if the signal is high and move in the opposite direction if the signal is low as is demonstrated in the testing portion of the video. The driver takes these signals and translates them into coil firing sequences.
To get power to the motors, the 36 volt power from the main power supply is connected to the driver. This power is distributed to the individual coils of the motor in special sequences that relate to moving in a particular direction and at a single step. The stepping motor must be connected in a special way. The datasheet for the motor illustrates three different ways that the motor can be connected to the driver: unipolar, bipolar serial and bipolar parallel. On the datasheet, there are a few numbers that are important to understand. The torque and the power requirements that enable this torque. For the power supply that I am using, wiring the motor in parallel is the best option. This will allow the motor to have the most torque at a high speed. The motor is connected in parallel to the terminals labeled A+, A-, B+, B- on the driver.
To make sure that we are delivering the proper signals strength and resolution to the motors, the dip switches are set. In general, I recommend lead screw be set for 1/4 microstepping and timing belt, roller chain or rack and pinion mechanics be set to 1/16 microstepping to allow more resolution.