Chapter 11 - KRMx01 Electronics


I am excited about this chapter.  Getting the electronics installed just lets you know that you are getting close to a moving runnable machine.  However, I have just a little bit more to do to get them installed.  In the last chapter I built a small computer rack into the KRMx01 stand to house the computer and electronics.  I had a convenient slide out shelf for the computer, but I wasn't quite so lucky about the compartment for the electronics.  I did however have a pair of old slides I salvaged from an old computer and a piece of heavy sheet metal laying around, So I thought I would just make one.

Preparing the sheet metal

Cleaning the surface rust from the sheet metal. The sheet metal cleaned of loose surface rust and ready to bend. The first thing my son Zachary and I done was to install the rails into the rack and get a measurement between them.  Next we laid out a box on the sheet metal that would fit the width and go as deep as the piece of sheet metal would allow.  We made the box with 5" sides.  The piece of metal that I had has been sitting around my shop since I built the gas fired crucible furnace and had a fair amount of surface rust.  In the images to the left you will see Zachary using the air sander to remove the loose rust, and in the next you see the sheet metal prepared and ready to be bent.

Bending and riveting the box

Two sides and an end bent. Box bent and pop riveted together. For sheet metal you really need a brake.  Unfortunately I don't have one so I had to improvise.  I admit that the quality of the bends made from a break are far superior to what we done.  We made our bend by clamping the metal between a pair of angle iron pieces and slowly working it up with a mallet and a ball peen hammer.  The short sides were done with a piece of 3/4" MDF cut to width and clamped with a piece of angle on the outside and bent the same way.  Finally, with the box bent to its intended shape, two pop rivets were put in place at each seam on the corners.

Painting the box

Painting the box that will hold the electronics. The box that will hold the electronics completely painted. Before going any further it is time to paint the box before all the work that went into removing the loose rust goes to waste.  I decided on black since most of the stuff I have for my little computer rack is that color already.  The only drawback is that the black really shows off our poor bending job.  But it will be tucked away in the rack and no one will be the wiser.

Installing the Rails

The drawer rails for the slides are installed. The drawer rails for the slides are installed. In order to use the drawer we bent, it will need rails attached to it and some cable management.  I had a couple of options on attaching the rails.  I elected to use sheet metal screws, but could change to 1/8" pop rivets if the pointy ends of the screws prove to be a bit to hazardous.

Installing the cable manager

KRMx01 Electronics drawer with cable manager attached. KRMx01 Electronics drawer with cable manager attached. The cable manager was salvaged from an old rack mount computer from back in 04 or 05.  Now that I think about it, One of those old computer cases all gutted out may have made a decent cabinet for the electronics.  I will have to keep that in mind in the event that this idea doesn't work out so well.

Making and installing the drawer front

The rack blank being used to make the drawer front for the KRMx01 electronics compartment. KRMx01 electronics drawer with drawer front installed and in rack. The drawer for the electronics is just about complete.  It lacks a front and a pull hand to finish it off.  The front isn't really mandatory but will prevent the drawer from sliding too deeply into the rack and will give it a more finished look.  I am using an old rack blank to make the drawer front.  The notches in the corners are to clear the mounting for the slides.  You can see the finished drawer front in the second image and in the first image above under the "Installing the cable manager" section above.

The Electronics

I should start this section with a small treatise on the difference between the electronics called out in the KRMx01 book and what I am using here.  Although they are radically different in appearance, operationally they are much the same.  The KRMx01 book specifies the NEMA 23, 4 axis electronic kit supplied by CNCRouterParts.com.  This kit consists of (4) NEMA 23, 380 oz-in stepper motors, (1) 48V, 12.5A Power supply, (1) Gecko G540, 4 axis stepper motor driver and (4) cables to hook the motors to the driver.  Now, before I start, there is nothing wrong with this kit and if you have not purchased your electronics yet, perhaps you should consider it.  I, on the other hand, already have electronics that I purchased for my last CNC machine and plan to reuse them to save some money.

So I stated that what I am using looks radically different than the Gecko system, but is the same functionally.  Let me explain.  The Heart of the Gecko system is the Gecko G540 controller.  This controller is actually a parallel break out board and 4 individual controllers all packaged into one nice little box.  Really it is quite nice in that it takes less space and has all been configured internally for you.  But aside from that, I cannot say any more about it because I have never owned one or read the manual for it.

My electronic system will be configured using a separate breakout board and four individual controllers, think of these five devices like the single G540 device.  At least in the abstract.  I will talk briefly about each component and its use before talking about connecting them up.

The Breakout Board

CNC4PC C10R10 Breakout Board. The Breakout Board, sometimes called a BOB, allows you to attach to a computer parallel port and bring those signals to the outside world.  These discrete signals can be used for inputs and output to just about anything you can interface with TTL logic.  There are a bunch of manufacturers of breakout board.  Some better than others.  Some with LOTS of features and other with the bare minimum.  The particular breakout board I have is sold by CNC4PC.  You can find more information about this card on the cnc4pc website.  Some of the features of this card include pull up or pull down selection for inputs, buffered inputs and outputs and the ability to select either input or output on the bidirectional pins.  Additionally, the card has an external enable pin that allows you to enable or disable all the outputs at once.  This is like the charge pump on the G540.

Download the C!) parallel interface card spec sheet. Click the ICON to the left to download the specification sheet for the C10 Parallel Port Interface Card from cnc4pc.com.  You may have different hardware, but will be helpful to follow along and adapting to your own hardware.

The Stepper Drivers

CW230 Stepper Motor Drivers. The stepper drivers I have are CW230 2-Phase Micro-stepping Motor Drivers.  These drivers will run on an input voltage of 24V - 36V.  They have an programmable output current of 0.9 - 3A.  They will micro-step from 1, 1/2, 1/4, 1/8, 1/16, 1/32 and 1/64.  Unfortunately, there isn't much data on pulse lengths for hold times, stepping and reverse.  The only thing listed is that the step pulse is on the rising edge and that it must be greater than 10μs. This is where the better controllers give you more complete information.  But, when I bought these, I was green and didn't know any better.  I purchased these from buildyourcnc.com.

Download the specification sheet for the CW230 stepper motor driver. Click the ICON to the left to download the specification sheet for the CW230 Stepper Motor driver.  Again, having this will make it easier for you to follow along with what I am doing here.

The Stepper Motors

425 OZ-IN NEMA 23 Stepper Motor. The stepper motors I have are NEMA 23 type 60BYGH303-13.  These are 8 wire motors that can be wired in series, parallel and unipolar.  There are pros and cons to each set up.  These motors are 1/4" shaft and are rated at 425 oz-in holding torque.  These motors were purchased from buildyourcnc.com.

Download the stepper motor specification sheet. Click the ICON on the left to download the specification sheet for the 60BYGH303-13 Stepper motor.  Again, you may have different motors, but this will help you follow along with what I am doing here.

The Power Supply

The S-350-36, 36V 10A Power Supply. The power supply that I have was purchased from buildyourcnc.com and is a 36V, 10A supply.  The only label on it looks to be a company logo or something called HNR. The numbers on the supply are S-350-36.  One issue I will run into is that it may not be enough to run four motors.  But more on that later.

Download the S-350-36 Power supply specification sheet. Click the ICON to the left to download the specification sheet for the S-250-36 Power supply.

Mounting the electronics in the drawer

Break out board connector brought through the drawer. I tried to give some thought on mounting the electronic and another devices to the drawer to maximize space and still leave room for some expansion.  Here you can see that I have cut a hole to allow the parallel port connector of the breakout board to be accessed from the outside of the drawer.  I located the breakout board as close to the rear left of the drawer as I could.  I have a second parallel port in my PC and if I decide I need to expand, I would have room to add another board next to this one.  Also, the board is mounted to the bottom of the drawer by using plastic stand-offs to prevent it from being shorted by the metal drawer.

Stepper motor controllers and power supply mounted in drawer. Next came the power supply and the stepper motor controllers.  There is enough room that I can add an additional controller, a 5V power supply and perhaps a little more stuff.  I am thinking I will get a second 36V supply like the one I have as well.  With this supply I will have to wire the motors in series to reduce the current load, but I would rather wire them in parallel for the added torque.  More on that later.

AC plug added to the electronics drawer. Next I cut a slot in the top of the back right portion of the drawer to bring in the AC power.  This plug was salvaged from an old Genicom Printer that I scavenged stepper motors from way back in 2006 when I was first inspired to build a CNC router.  I made sure to leave enough room to attach the cable manager to the drawer.

Wiring the electronics

Wiring the AC socket and power supply

Wiring the power jack. To start the wiring, I need to get AC power to the 36V power supply.  To do this I had to connect the Line, Neutral and Ground wires to the AC plug that I located on the back of the drawer.  To find these, I first plugged a power cord into the socket and set my meter on continuity.  If you are looking at the plug of the power cord and orientate the ground pin (The round pin between the two blades) to the bottom the neutral blade will be on your right.  If the blades are different widths, it will be the wider of the two.  The other blade will be the line (or hot) leg of the plug.  Next I took my meter and held it to the ground pin of the plug and found the ground tab of the socket.  I marked this tab with the letter 'G'.  I done the same thing for the Neutral and Line blades of the plug and marked the tabs on the socket with 'N' and 'L' respectively.  You can see the markings in the photo.  Next I attached the wires to the plug.  Most of these are color coded.  Green is ground.  White is Neutral. Black is Line.  I connected them with crimp on insulated spade connectors.  I wired with 18 AWG stranded wire that would be long enough that when I fastened them down would reach the power supply.

AC power run to the 36V power supply. Next I re-attached the AC socket back on the electronics drawer.  I routed the AC wires to the 36V power supply.  These wires are neatly routed and fastened down to the bottom of the drawer with cable ties.  The wires are then connected to the power supply with insulated fork connectors slid under the mounting screws.  The black wire connects to the Line lug of the power supply.  The white wire will connects to the Neutral lug of the power supply and the green to the Ground lug.  The image shows the finished power supply wiring.  One thing to note here is that this supply will only handle 3 of the motors I have when wired in parallel.  The motors will draw 2.8 Amps each in parallel mode.  I will have to add an additional supply for the fourth motor.  More on this later.

Running power to the stepper motor drivers

Running power to the stepper motor drivers. Next power is run to the stepper motor drivers.  These drivers can operate on an input voltage of 24V - 36V DC.  The 36V positive voltage is run to the Vcc input of the driver and the Ground (-V) of the power supply id run to the GND (Ground) connection of the driver.  Again, I have only run three of the drivers because running all four on this supply would exceed the current output of the power supply.  More on that next.

Setting the DIP switches on the drivers

There are two sets of DIP switches on the stepper drivers.  One set sets the maximum current the driver will be able to deliver to the motors and the other set of DIP switches set the micro-stepping of the driver.  Setting these switches depends on two separate conditions.

Setting the current DIP switches.  The CW230 drivers have the ability to deliver 0.9A, 1.2A, 1.5A, 1.8A, 2.1A, 2.4A, 2.7A or 3.0A to the motor.  The setting that will be used depends on the current requirements of the stepper motor being used and its wiring configuration.  The 425 oz-in motors that I am using have 8 wires and four coils.  These coils can be wired in parallel, series or uni-polar.  There are pros and cons of each wiring scheme.  For example, wiring the coils in parallel will give you more torque and speed at the cost of higher current and more heat generated.  Wiring the coils in series uses less current and generates less heat but at a loss of torque and speed.  I have opted to run mine in parallel for the additional torque and speed.  The data sheet for these motors claim that the motor will need 2.8A of current to drive it.  So I set the DIP switches to handle 3.0A.  Now because I selected to run the drivers at 3.0A I have to make sure that I don't try to use more power than my supply can handle.  My supply reads that it is 36VDC and can deliver 10A of current.  Now you know the reason I only wired 3 of the drivers to the supply.  I will get an additional supply for the other driver and have power to spare in the event I want to add another driver for a 3D print head or rotary axis of some sort.

Setting the micro-stepping of the driver depends on the ratios of your drive train for the axis that the driver will drive.  In the case of the KRMx01, the lead screw is 2 turns per inch, and the motors in single step mode have 200 steps per revolution.  This means that in one inch of travel, there will be 400 steps to the motor.  If we take 1 inch and divide by 400 we get a travel of 0.0025" per step.  I want more resolution than this.  If the driver is set to half stepping, then it will take 200 * 2 = 400 steps per revolution of the motor and double that to travel 1 inch.  This means that each step moves 1" / 800 steps = 0.00125.  That would probably be fine in all practical purpose, but I still want a bit finer resolution.  And I could always bump back down if speed becomes an issue.  So 1/4 stepping means that the motor will have 200 * 4 = 800 steps per revolution and 800 * 2 revolutions per inch.  This calculates into 1" / 1600 steps = 0.000625 inch per step.  This is where I will set my machine for.  So the DIP switches are set to step at 1/4 step.

Wiring the I/O and motor wires

I/O and motor wires ran. I/O and motor wires ran. The next two images show the completed job and you can use them to follow along.  Next we will wire the control logic to the stepper drivers and bring the wires from the stepper driver to extend past the panel so that panel mount connectors can be added to them.

The motor wires is a pretty simple job.  The controller has a an output for two sets of motor windings labeled A+, A-, B+ and B-.  Wires of Green and Black are run from the A+ and A- and wires of White and Black are run from the B+ and B- connector.  These wires are left long enough to extend past the outside of the drawer so panel connectors can be soldered to them. (later)  If you look at the specifications of the stepper driver, you will see that the maximum current the driver can deliver is 3.0 Amps.  When selecting the wire to run your motors, keep in mind the amount of current they have to carry.  You can find wire gauge charts on line.  To safely carry the 3 amps that the driver can deliver, I will need in theory 24 AWG.  But like anything, you always want to play it safe.  ALWAYS select a wire at least twice the rated current you will draw.  I am using 20 AWG wire which is rated for 11 Amps for chassis wiring.  Smaller gauge wire will run hotter and produce more of a voltage drop than heavier wire.

The I/O connections for the stepper drivers is only a little more complicated.  Looking at the specification sheet for the controller, we see that the inputs for step and direction are opto-isolated.  This provides a layer of protection between the parallel breakout board and the drivers at the cost of some latency to switch the circuit on and off.  To make these work the STEP+ and DIR+ have to have 5 volts on them.  This can be done with a 5 Volt supply, or the breakout board if it is capable of supplying it.  If you look at the specification sheet for the breakout board, you see that pins 2 through 9 on the breakout board can be setup as either inputs or outputs.  I have the jumper set so they are outputs from the computer to the drivers.  Another jumper allows you to set the common leads between the outputs at either GND or +5V.  Because I need a 5V source on the drivers I will set the jumper to +5V.

Wiring is now a matter of running pins 2-9 on the breakout board to the controllers.  I used the following to wire mine.

PIN #    Controller Connection
Pin 2   STEP- for controller 1
Pin 3   DIR- for controller 1
Pin 4   STEP- for controller 2
Pin 5   DIR- for controller 2
Pin 6   STEP- for controller 3
Pin 7   DIR- for controller 3
Pin 8   STEP- for controller 4
Pin 9   DIR- for controller 4
+5V   STEP+ and DIR+ on all controllers

It doesn't really matter if you wire them the other way, for example PIn2 to DIR- and Pin 3 to STEP- because the actual use of the pin will be set up in software.  I would however pair pins together to each controller, pins 2 and 3 to a controller, 4 and 5 to a controller, etc.  Additionally, since these are signal wires smaller wire size is acceptable here.  I used the same 20 AWG wires that I used for the motor coils but smaller wire would have been fine here.

Additional components

I had to order some additional components for my electronics drawer.  For example, recall that the 36V power supply could not deliver enough current to run all four motors.  So I have ordered another 36VDC supply and some other stuff.  See below:

S-350-36 Power Supply

S-350-36 Power Supply (36VDC 9.7A). This is the same power supply as the one you see above.  It is a 36 VDC supply rated at 9.7A.  I could have purchased a larger supply and replaced the one above, but by looking on EBAY, I found this one.  It was $34.00 with free shipping.  It did have to ship from China though.  Interestingly enough, it only took 8 days to arrive at my door.  I will simply add this power supply to the drawer and run the other driver from it.  I also now have the capacity to run an additional stepper driver if I like.  You can download the specification sheet for this supply by clicking on the link above for the other supply.

S-100-5 Power Supply

S-100-5 Power Supply (5VDC, 20A). My breakout board requires 5VDC to enable it.  I had a lot of options here that I could have done.  For example, I could have used a wall wart or taken the 5VDC from the computers USB cable.  Instead, I just bought this supply, 5VDC, 20A to power the board and additional cooling fans that I plan on adding to the drawer.  This leaves me with enough extra capacity that I can run other electronic equipment.  For example, a TTL circuit or something.  Even if I don't use the extra capacity, this was a good buy from EBAY for $18.99 with free shipping.  It was shipped from the U.S.

Download the S-100-5 specification sheet. Click on the ICON to the left to download the specification sheet for the S-100-5 power supply.

4 Pin Chassis and in-line Mic Connectors

4 Pin chassis and inline Mic jacks. A lot of folks use 9 pin D connectors for their stepper motors, and if you have gecko hardware, the drivers have them on there to use.  Now these are a relatively cheap solution to be able to remove a motor and you can get pre-made cables at different lengths.  I decided to go with something a little different and will be using 4 pin microphone connectors like you find on CB radios.  These cost a little more but your less likely to bend a pin and they have a higher current carrying capacity.  The chassis mount males will fit firmly to the drawer and the females have a threaded collar that attaches to the male connectors.  The are also keyed so they cannot be connected wrong.  I purchased these from CB world and the information for them is:  Code: CBC4MX (4 pin in-line microphone connector) at $3.50 each and Code CBC4PX (4 pin panel mount microphone connectors) at $4.50 ea.  Here is a link to the CB World website.

2 PIn Chassis and In-line Mic Connectors

2 Pin microphone connectors. These are basically the same thing as you see above but with only 2 pins.  I will use these to run my signal wires for limit and home switches and a probe.  I purchased 5 pairs of these.  I do not know how many at this time I will be using.  I could have used 1/4" or 1/8" audio jacks and would have been cheaper, but these are a little more rugged and will go well with the motor connectors.  I purchased these from Vetco Electronics and the parts are GL-A286C (2 pin male chassis mount Microphone Connector) and PH-61-602B (2 pin female in-line Microphone Connector).  The price for both of these are the same at $3.99 each.

Wiring in the new power supplies

New power supplies have been mounted and wired. New power supplies have been mounted and wired. Here you see the two new power supplies have been mounted and wired up.  When I wired the first supply, I used 18 AWG wire, but have changed it out to 14 AWG because of the current load that could be produced by the supplies.  When I examined the data sheets for the supplies, the AC input current for the S-350-36 supplies was 6.5 Amps and the AC input current for the S-100-5 supply was 1.9 (2) Amps giving a total of 15 Amps.  Now this would be the current if all three supplies were dishing out the maximum DC current they can produce.  18 AWG has a chassis rating of 16 Amps putting it at the maximum.  The solution was to double the input current and then find the size wire that could handle that current.  Looking at the wire chart, 14 AWG can handle up to 32 Amps in chassis wiring.

The mounting plate for the microphone connectors

The mounting plate for the microphone connectors. I have to give all the credit to my son Zachary for this part of the project.  This plate will be used to mount the chassis mount microphone connectors pictured above.  Space was allocated for up to 12 connectors, although we only purchased 9.  Tape will be placed over the unused holes so as not to disrupt air flow when we add the fans and cooling vents.  My wife had surgery and I have nor had any time to mess with the project, but Zachary picked up the torch and ran with it.  The holes are spaced on 1.5" centers to leave enough room for my big hands to screw on the in-line connectors.  This probably could have been reduced to 1.25" and worked fine.  Good job son!

Wiring the motor outputs to the connectors

The connectors installed on the plate. Inline connectors attached to chassis connectors. Controller motor outputs wired to 4 Pin connectors. To start, the 2 Pin chassis mount connectors were installed in the bottom of the panel.  These will be used later to bring limit switches, probe, and other signals out from the electronics drawer.  The (4) 4 Pin connectors have the A+, A-, B+ and B- connections soldered to them and are attached to the stepper controllers.  It really doesn't matter how you wire these but you should be consistent.  I wired A+ to pin 1, A- to pin 2, B- to pin 3 and B+ to pin four.  I also made a not of it and when I make the top to the drawer, I will print my notes out and glue them to the lid.  This is a good way to remember what is what way down the road when you have to figure things out if it breaks.  The second image shows the in-line connectors attached to the plate.  I done this mostly so they would not get lost until I was ready for them.  But this gives you a good idea of what the finished product would be.  Just image the wires running from these connectors to the motors, switches and what have you.  Finally, the last image gives you a good view of the drawer up to this point.

Next, I will add a pair of 5 VDC fans and some vents.  To finish the drawer I will make a top cover.  This top cover is necessary so that air will be pulled across the electronics to help keep them cool.  The fans are ordered but have not arrived yet.

The cooling fans

5 VDC 16.6 CFM Fans. The image to the left is of the two 5 VDC fans i purchased from Jameco Electronics. According to the site, these fans can deliver 16.6 CFM (cubic feet per minute) of air movement and draw 0.37 Amps.  The fans are 60 mm (about 2.3 inches) square and 15 mm (about 0.6 inch) thick.  To determine the air exchange rate I must take the dimensions of the electronics drawer and convert it to cubic feet.  My drawer roughly measures 17" wide x 22" deep x 5" tall.  Multiplying these together gives me the cubic inches of the drawer.  17 * 22 * 5 = 1870 cubic inches.  To convert cubic inches to feed I need to divide this number by (12*12*12 = 1728) 1728 cubic inches to the cubic foot.  So the drawer is 1870 / 1728 = 1.082 cubic feet, or roughly 1.1 cubic feet.  Now the fans each deliver 16.6 CFM x 2 = 33.2 CFM.  So in theory, the fans will replace the air 33.2 / 1.1 = 30.182 times per minutes or roughly 1 per every 2 seconds.  That seams like a lot of air, but truthfully it will be something less than that because of the restriction of the air inlet and filter.  The idea here is to get enough air flow through the drawer to keep the enclosed electronics as cool as possible.  I may have been able to get by with a single fan but I think I will stick with overkill.