Chapter 6. The Electronics

Your CNC machine consists of two parts: the MDF (and the bolts, bearing, nuts, and other hardware) and the electronics. The majority of the chapters in this book will cover the building of the CNC machine-cutting, drilling, and bolting together various MDF pieces to make the physical frame of the machine. The other part of the machine is the electronics. Three motors will be used to move the router and allow your CNC machine to do the job you want it to perform. These motors are controlled using some additional electronics, which we'll talk about shortly. It is these electronics that will connect to your computer and receive instructions from the special software you'll be using to tell the machine where to cut, drill, and perform other actions.

There are numerous options available for the electronics used in your CNC machine. This means it is simply impossible to cover every type of electronic device and how to incorporate it into your machine. Because of this, we are going to be using a readily available set of electronics that you can purchase directly from one of the authors (Patrick) or from a couple of vendors. We'll give you exact part names (and/or numbers) so you'll be able to purchase the exact hardware used in the instructions provided in this chapter.

If you choose to purchase different electronics for your CNC machine, be sure to read through all the documentation available. You may find that some electronics use different wire colors or different labels for various parts, but with some careful examination of the documentation and schematics, you may be able to figure out how the differences match up to our instructions.

Caution

The electronics are sensitive to improper wiring and most of them aren't going to survive when improperly provided the wrong amount of voltage. Use a multimeter (volt meter) whenever you can to verify voltages and always read any documentation provided with your electronics for proper wiring and configuration.

The Required Components

You're going to need to purchase the following nine items (in addition to the wire, solder, and other small electronics components mentioned later in this section):

Three stepper motors
Three stepper motor drivers
One breakout board
One power supply
One 5V DC transformer 400mA (6V is OK)

Three stepper motors will be required, one per axis. Each motor comes with a wire bundle containing eight wires of different colors. The stepper motor we will be using in this chapter is model KL23H286-20-8B from www.kelinginc.net. You can see one of the stepper motors in Figure 6-1.

A single stepper motor with wire bundle

Figure 6-1. A single stepper motor with wire bundle

You'll also need to purchase three stepper motor drivers; each motor will receive electrical signals from a stepper motor driver that tells the motor how fast to spin, as well as controls the direction of spin of the motor's shaft. For our CNC machine, we're using the Keling KL4030 stepper motor driver shown in Figure 6-2.

Finally, you'll need to purchase a single breakout board. The breakout board connects to your computer via the parallel port. The special CNC software installed on your computer sends signals over a standard parallel printer cable to the breakout board. Each stepper motor driver also connects to the breakout board. When wired properly, the computer software will be able to control the individual stepper motors (sending signals to the stepper motor drivers through the breakout board). The breakout board we're using is the Keling C10, and looks like the one shown in Figure 6-3.

One stepper motor driver is required for each stepper motor.

Figure 6-2. One stepper motor driver is required for each stepper motor.

The breakout board connects to your computer and all three stepper motor drivers.

Figure 6-3. The breakout board connects to your computer and all three stepper motor drivers.

To provide power for the stepper motors and the cooling fan, you'll need to purchase a power supply. We're using Keling's KL-350-36 36V/8.8, as shown in Figure 6-4.

The power supply provides the proper voltage to all the electronics.

Figure 6-4. The power supply provides the proper voltage to all the electronics.

In addition to these nine items, you'll also need the following items:

  • 50 feet of black 18-gauge wire

  • 50 feet of red 18-gauge wire

  • 10 feet of green 18-gauge wire

  • 10 feet of white 18-gauge wire

Tip

You can save some money on wire by purchasing 50 feet of AWG 4-conductor PVC cable; this cable consists of an outer sheath covering four 18-gauge wires inside. You can slice open the sheath and pull out the four wires to trim them to whatever length you need. If you're not able to locate this cable, contact www.acksupply.com to order it. This may very well be cheaper than purchasing the four colors above in various lengths.

Solder gun and solder

Wire strippers

Multimeter

Plastic wire conduit (not required, but extremely helpful-we used 1" diameter) 8' extension cord for power supply (the kind with three prongs-the smaller of the two rectangular-shaped prongs is the hot wire, the larger is common/neutral, and the rounded one is for the ground) Shrink tubing (for covering the solder connections) 120V fan (the kind that can be installed in a computer case to cool it) Two-prong 5' extension cord (for the 120V fan)

Preparing the Stepper Motor Wires

The first thing you're going to do is separate the wires on each stepper motor. For the KL23H286-20-8B stepper motor, strip about 3/4" from the end of each wire and pair up the following wires by twisting the ends together.

Red/white-striped wire and blue/white-striped wire (RW/BW)

Red wire and blue wire (R/B)

Black/white-striped wire and green/white-striped wire (BkW/GW)

Black wire and green wire (Bk/G)

Figure 6-5 shows one of our motors with the eight wires paired up. In addition to twisting the ends of each pair together, we've also used some electrician's tape to hold the wires together.

Twist together the eight wires to make four pairs on all three stepper motors.

Figure 6-5. Twist together the eight wires to make four pairs on all three stepper motors.

Do the same thing for all three stepper motors and then set the motors aside. Next, cut off approximately 8' of wire in four colors (we used black, white, red, and green), as shown in Figure 6-6.

Cut 8' of wire in four colors for each motor.

Figure 6-6. Cut 8' of wire in four colors for each motor.

Each of these four wires will be soldered to one of the wiring strands coming out of the stepper motors. Try to be consistent with the colors if possible. We chose the following pattern for soldering the 8' lengths of wire to the stepper motor wire pairs:

  • Black 18-gauge wire soldered to the Bk/G pair

  • Green 18-gauge wire soldered to the BkW/GW pair

  • Red 18-gauge wire soldered to the B/R pair

  • White 18-gauge wire soldered to the RW/BW pair

Tip

You don't have to solder the wires together, but soldering will make a more durable connection between the wires. If you choose not to solder, use the proper size wire nuts to twist the wires together.

Figure 6-7 shows one of the wire pairs (B/R) being soldered to the red wire.

After applying the solder, we also used a small piece of heat-shrink tubing to cover the solder. Simply cut a small piece of the tubing, slide it over the soldered connection, and apply a little heat to it (keep moving the lighter back and forth to prevent burning). Figure 6-8 shows us using a lighter to shrink the tubing.

Solder a wire pair to its matching 18-gauge wire.

Figure 6-7. Solder a wire pair to its matching 18-gauge wire.

Apply some heat to the heat-shrink tubing to cover the soldered wire.

Figure 6-8. Apply some heat to the heat-shrink tubing to cover the soldered wire.

Do this for all four pairs on each of the three stepper motors. Figure 6-9 shows one of the motor's wire pairs after soldering the 8' wire strands.

All four wire pairs soldered to their matching 8' wire and covered in shrink tubing

Figure 6-9. All four wire pairs soldered to their matching 8' wire and covered in shrink tubing

Go ahead and set the motors aside for now. Up next, we'll prepare the power supply.

Preparing the Power Supply

The power supply does not come with a power cord, so you'll need to cut the female end off of a short extension cord (8' should be enough length) and strip approximately 3/4" from each of the three wires. Figure 6-10 shows the extension cord with the exposed wires.

It's important for you to identify the hot wire, the neutral (or common) wire, and the ground wire. For most extension cords, the ground wire corresponds to the circular metal post, as indicated in Figure 6-10. The hot wire corresponds to the smaller of the two rectangular posts, and the neutral wire corresponds to the larger rectangular post.

Separate the three wires found in a standard extension cord.

Figure 6-10. Separate the three wires found in a standard extension cord.

Use your multimeter to determine which wire corresponds to a post. It may be helpful to label the wires with colored tape. As you can see in Figure 6-10, we've also applied a little solder to each wire (called tinning) to keep the small copper strands from fraying.

Grab your power supply. Make sure the extension cord is not plugged in, and connect the wires to the power supply by screwing them down as follows:

  • Hot wire to L (see Figure 6-11)

  • Common wire to N (neutral)

  • Ground wire to the symbol for ground (again, see Figure 6-11)

Plug in the extension cord and use your multimeter to take a voltage reading. Connect the red probe to one of the +V screws and the black probe to one of the -V screws. You should receive a reading of around 36V, as shown in Figure 6-12. Test all three +V screws (and matching -V screws) to make sure approximately 36V is being supplied at each of those terminals.

Connect wires to the power supply by screwing them down to the proper slots.

Figure 6-11. Connect wires to the power supply by screwing them down to the proper slots.

Test the voltage being supplied by your power supply.

Figure 6-12. Test the voltage being supplied by your power supply.

If you're not getting close to 36V (+/-1 volt should be acceptable), unplug the extension cord and check that you've wired up the power supply properly; check to make sure that the proper wires are screwed down on the N, L, and ground terminals. Set the power supply aside and grab your breakout board next.

Preparing the Breakout Board

Next, take your 5V adapter (6V is acceptable) and cut off the end indicated in Figure 6-13. You should find a black wire and a black/white-striped wire. Strip 3/4" off the ends of the two wires.

Tip

Strip the ends of the two wires and check the DC voltage using your multimeter. The black probe on the black/white-striped wire and the red probe on the black wire should give a DC voltage around 5 to 6V.

A 5- or 6-volt adapter will power the breakout board.

Figure 6-13. A 5- or 6-volt adapter will power the breakout board.

Next, screw the two wires into a screw terminal, as shown in Figure 6-14. Screw the hot wire (the black/white-striped wire for our adapter) into one of the screw terminal ports, and screw the neutral wire (black wire for our adapter) into another one of the screw terminal ports.

The screw terminal will help provide power to the breakout board and other devices.

Figure 6-14. The screw terminal will help provide power to the breakout board and other devices.

Next, cut one black piece of wire and one red piece of wire to a length of approximately 10". From this point forward, we'll be trying to use red wires to indicate the hot wires and black wires to indicate the common or neutral wires. Strip these wires on both ends (about 3/4") and use some solder to tin them if you like.

Screw the red wire into the wire terminal opposite to where the hot wire from the 5V adapter is connected (our black/white-striped wire). Screw the black wire into the wire terminal opposite to where the common/neutral wire from the 5V adapter is connected (our black wire).

Grab your breakout board and connect the red wire to the 5V terminal indicated in Figure 6-15. Connect the black wire to the GND terminal (also indicated in Figure 6-15). Finally, cut a 2" piece of red wire, strip both ends, and daisy-chain the wire from the 5V to the ENABLE terminal, as shown in Figure 6-15-simply insert one end into the 5V terminal (it will share the terminal with the hot wire from the wire terminal) and screw down the other end into the ENABLE terminal. Figure 6-16 shows a closeup of the breakout board after the wires are connected.

Wire up the breakout board by connecting the wires from the screw terminal.

Figure 6-15. Wire up the breakout board by connecting the wires from the screw terminal.

Closeup of the breakout board with wiring from the screw terminal and jumper cable.

Figure 6-16. Closeup of the breakout board with wiring from the screw terminal and jumper cable.

Now grab the three stepper motor drivers and place them as indicated in Figure 6-17.

Place the stepper motor drivers so they can be supplied with power.

Figure 6-17. Place the stepper motor drivers so they can be supplied with power.

Tip

You can cut a piece of MDF or plywood for mounting all these electronics so they don't move around. We used a piece of plywood with dimensions of 9"×14" to lay out all the parts shown in Figure 6-17.

Providing Power to the Stepper Motor Drivers

Cut a piece of red wire (hot) and strip both ends (3/4"). The length of this wire will depend on the distance from the hot (black/white-striped) terminal on the screw terminal to the PUL+ (+5V) terminal on the first stepper motor driver. Cut a 2" piece of red wire, strip both ends, and daisy-chain it from the PUL+ (+5V) terminal on the first stepper motor driver to the DIR+ (+5V) terminal. You can see this in Figure 6-18.

Cut another piece of red wire-this wire will be daisy-chained from the DIR+ (+5V) terminal on the first stepper motor driver to the PUL+ (+5V) terminal on the second stepper motor driver. Cut another 2" piece of red wire, strip the ends, and daisy chain it from the PUL+ (+5V) terminal on the second stepper motor driver to the DIR+ (+5V) terminal.

Finally, cut another piece of red wire-this wire will be daisy-chained from the DIR+ (+5V) terminal on the second stepper motor driver to the PUL+ (+5V) terminal on the third stepper motor driver. Cut another 2" piece of red wire, strip the ends, and daisy-chain it from the PUL+ (+5V) terminal on the third stepper motor driver to the DIR+ (+5V) terminal. When done, your three stepper motor drivers should look like Figure 6-19.

Wiring the first stepper motor driver for power

Figure 6-18. Wiring the first stepper motor driver for power

All three stepper motor drivers wired for power

Figure 6-19. All three stepper motor drivers wired for power

Wiring Motor Drivers to the Breakout Board

Look closely at the long row of terminals on your breakout board (it should be the longest run of screw terminals). You will see that these terminals are numbered 2, 3, 4, 5, 6, 7, 8, and 9. In between some numbers you should also see COM. We're only concerned at this point with the numbered terminals. For this section, you're going to cut a series of black wires (the length of the wires will vary) and connect them from the breakout board to terminals on the motor drivers. Cut one black wire that will run from the breakout board's 2 terminal to the third motor driver's PUL- terminal. Cut a second black wire that will run from the breakout board's 3 terminal to the third motor driver's DIR- terminal. Figure 6-20 shows these two wires running from the breakout board to the third motor driver.

The third motor driver connected to the breakout board

Figure 6-20. The third motor driver connected to the breakout board

Perform the same operation for the first and second motor drivers. For the second motor driver, you will connect the breakout board's 4 terminal to PUL- and the 5 terminal to DIR-. For the first motor driver, you will connect the breakout board's 6 terminal to PUL- and the 7 terminal to DIR-. Figure 6-21 shows all three stepper motor drivers wired to the breakout board.

All three stepper motor drivers connected to the breakout board

Figure 6-21. All three stepper motor drivers connected to the breakout board

Connecting Power to Motor Drivers

Next, you're going to connect wires from the power supply to the stepper motor drivers. This is the power that will drive the actual stepper motors that will be wired up shortly. Start by cutting a piece of black wire that will run from one of the V+ terminals on the power supply to the VCC+ terminal on the first stepper motor driver. Cut a second piece of black wire and run it from one of the V- terminals on the power supply to the GND- terminal on the first stepper motor driver. This can be seen in Figure 6-22.

Next, cut a small piece of black wire that will be daisy-chained from the VCC+ terminal on the first stepper motor driver to the VCC+ terminal on the second motor driver. Cut another piece of black wire and daisy-chain it from the GND- terminal on the first stepper motor to the GND- terminal on the second stepper motor. Perform the same daisy-chaining operation between the second and third stepper motor drivers-connect their VCC+ and GND- terminals using pieces of black wire. Figure 6-23 shows all three stepper motor drivers with the power supply connected to the first motor driver and daisy-chained wires for connecting the second and third motor drivers.

Connecting the first stepper motor driver to the power supply

Figure 6-22. Connecting the first stepper motor driver to the power supply

All three stepper motor drivers connected to the power supply

Figure 6-23. All three stepper motor drivers connected to the power supply

Connecting Stepper Motors to Motor Drivers

Now it's time to connect the stepper motors to their respective drivers. Earlier in the chapter we told you that it would be helpful to use specific colors for wiring up the wire pairs coming out of each motor. Here's where that will become useful.

Take a close look at a motor driver and you will see four terminals on it, labeled A+, A-, B+, and B-. You will be connecting the four 8' wires you soldered to the motors to these terminals.

Caution

It is very important that you connect the proper wires from each motor to the correct terminal. Connecting a wire meant for A+ to B+ or B- is bad . . . it can cause immediate damage to a motor when power is supplied. Double-check all your wiring when done with this section.

Take a look at Figure 6-24. We've labeled each of the four wires coming from a motor and also indicated the proper terminal to connect them.

The motor wires must be connected to the correct terminal on a motor driver.

Figure 6-24. The motor wires must be connected to the correct terminal on a motor driver.

Your wiring colors may be different, so remember that according to our wire color scheme, the following connections are made:

White 18-gauge wire soldered to the RW/BW pair goes to A+

Red 18-gauge wire soldered to the B/R pair goes to A-

Green 18-gauge wire soldered to the BkW/GW pair goes to B+

Black 18-gauge wire soldered to the Bk/G pair goes to B-

In order to keep our 8' wires from getting tangled, we used plastic conduit (the kind that's cut down the middle so you can insert the wires easily). Figure 6-25 shows one of our three motors connected to the motor drivers and all the wiring safely tucked into the flexible conduit.

Next, you'll need to configure eight small dip switches (toggles indicated in Figure 6-26) on each stepper motor driver. Each switch is numbered, left to right, from 1 to 8.

Conduit will keep the wire from getting tangled.

Figure 6-25. Conduit will keep the wire from getting tangled.

Configure the dip switches on each stepper motor driver.

Figure 6-26. Configure the dip switches on each stepper motor driver.

If a toggle is in the down position, this indicates a value of 0. If the toggle is in the up position, this is a value of 1.

For our CNC machine, we're going to use a microstep setting of 1/4 and a current of 3 amps-each stepper motor has a small diagram printed on its top that gives a 0 or 1 value for each of the eight switches. If you look carefully at Figure 6-24, you can see that a microstep setting of 1/4 corresponds to a value of 101 (for M1, M2, and M3, respectively) and a value of 111 (for M5, M6, and M7, respectively). (Switch 4 and 8 are not used and are set to 0-the down position.)

So, as shown in Figure 6-26, from left to right will be up, down, up, down, up, up, up, down-or 10101110. Be sure to configure all three stepper motor drivers with these toggle switch settings.

Wiring the Cooling Fan

The stepper motor drivers can get quite hot when the machine is in use, so we suggest that you wire up a simple little cooling fan like the kind you would install in a computer case. For ours, we stripped the ends off of a 120V fan, cut the end off of a 5' extension cord (with just two prongs), and then stripped about 3/4" from the ends of the two wires. We then soldered the fan's wires to the two extension cord wires (it doesn't matter which wire is soldered to which); you can see the final result shown in Figure 6-27. The fan will plug into a power strip and can be moved around to get the best air flow to the stepper motor drivers.

The fan will help keep your stepper motor drivers cool.

Figure 6-27. The fan will help keep your stepper motor drivers cool.

Testing the Electronics

The last thing we need to do in this chapter is simply test our wiring. Before you plug in anything, pick up each of your three motors and rotate the shaft by hand. You should find that each motor shaft can be turned easily. Next, go ahead and plug in the 5V (or 6V) adapter-you should see the red LED light on the breakout board light up. If it does not, go back and check your wiring carefully, especially the wiring going into the screw terminal and coming out of it and into the breakout board. You should also see a red LED light up inside each of the motor drivers.

Next, plug in the extension cord that provides power to the power supply. You may or may not hear one or all of the motors "energize." When we plugged our power supply in, each motor "jumped" a fraction of an inch as the motors engaged. Once power is supplied to the motors, you will find that you cannot rotate the motor shafts by hand. Do not try and rotate the motor shafts-this could damage the motor. If all three motor shafts are "locked" and cannot be turned by hand, you've wired them up properly and they are receiving power. Congratulations.

If one or more motors can rotate by hand, power everything off and check your wiring again, especially the wiring done in this chapter's "Connecting Stepper Motors to Motor Drivers" section. Make sure you've connected all the A+, A-, B+, and B- terminals to their proper wire pairs (RW/BW, R/W, BkW/GW, B/G).

Once you've verified all the wiring, power everything off and put all the electronics somewhere safe for now.

Tip

For a more detailed wiring diagram, visit www.buildyourcnc.com/book.aspx and download the PDF file by clicking the Chapter 6 link.

What's Next?

OK, that's enough wiring for now. We're not quite done with the electronics yet-there's a safety stop switch (also called a kill switch or eStop, for "emergency stop") that can quickly disable power to your machine that we'll be adding in later in Chapter 19. But now it's time to get cutting, drilling, and assembling the CNC frame.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset