[Home]Best Wiring Practices

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Good Wiring Practice

Written by Joe Hildreth - www.myheap.com

When I built my first CNC machine, I didn't have a cabinet and really ran nothing more than the stepper motor controllers and power to the parallel port break out board (BOB). Later I added a touch off plate to make setting up the tool to the surface of my material easier. Wires were all over the place, components mounted to a board and away I went.

When I built my second machine, I thought I would do a neater job of things and I made a metal drawer that would slide into a computer rack and mounted all my components to it. I carefully bundled all the wires together. I even used zip tie squares to hold the wiring to the enclosure. It sure was “purdey”!

Then I decided, I would make a series of tutorials on how to locate an input pin, write the G-Code and everything else related to setting up a touch off plate for the new guys and gals out there trying to figure all this stuff out. It was during this exercise that I learned my neat and pretty wiring job was not conducive to a properly operating CNC Machine. I discovered this when I was trying to run a G38.2 linear probe command and it would stop and some random position along the way. I would restart it and it would stop again. I had to run the commands several times before the probe command would finally complete. I knew that something wasn't right, so I made a video and posted the question to the LinuxCNC forums. Within a few hours, a couple of folks on the forum had given me enough information to understand what was going on. A HUGE thank you goes to ArcEye? and Andy Pugh for all the advice and suggestions they gave me. The culprit it seemed was noise.

So what is noise. Electrical noise comes from a couple of things. First is EMI (Electromagnetic Interference) caused by current flowing through wires and the second is electrical mechanical noise cause by physical switches bouncing when they open or close. Both of these conditions can cause you problems with the daily operation of your CNC machine. The mechanical noise can be dealt with pretty easily, but the EMI noise on the other hand requires a little work to help reduce and prevent it. The guidelines that follow are some things that you can do to reduce this problem. Before we get to the list of things to do, let's first discuss a little more what EMI is.

EMI as I stated above is caused by current running through a wire, but there is a little more to it. When current runs through a wire a magnetic field is created. As the current builds the magnetic field gets stronger. Then when the current ceases to flow through the wire the magnetic field collapses. This in itself isn't too bad, but if this magnetic field happens to cross another wire it will induce a voltage across it. This is how a transformer works. It uses a magnetic field in one coil of wire to induce a voltage in another coil of wire. If a wire is able to induce a voltage across another wire that we are using for a signal at logic level voltages, it may drive the voltage level in that wire to some state that the logic circuits reading it cannot understand. To be clear, 5V TTL work on distinctive voltage ranges. An input voltage of 0V to .8V is considered a false or low logic level. A voltage level of about 2V to 5V is read as a true or high level input. If however a voltage somewhere in between the .8V and 2V is on the input then we do not know what the output will be. When an input in this range is given the output could be either a high or a low level and this has to be avoided for a reliable circuit. Knowing the above information we know that a magnetic field crossing our signal wires could drive the input voltage to a TTL circuit into this band resulting in unexpected operation. But this is only half the story.

When current is switched on and off in a circuit we know that it creates a magnetic field but when current is switched on and off repeatedly it is possible to create another kind of noise. If the rate the current is being switched on and off is fast enough, it can generate radio frequencies that can interfere with other equipment nearby. The strength of these radio frequencies again depends on the amount of current that flows through the wire.

Now that we know what EMI is and the effects that it can have let's discuss what we can do about it by giving some general wiring tips.

AC Line Voltage

The AC that you use can inject noise into your power supplies and other equipment. If you have motors running on the same circuit for example, can create noise on the line if it is running on the same circuit as your CNC components. RF signals can also be superimposed onto AC line voltage. Years ago, this fact was exploited in some home entertainment systems to provide music to a remote speaker over the AC line. In-line filters are made to attenuate (reduce or block) this type of noise from the AC line voltage before it is run into your equipment. AC Line Filters can be found at electronic supply houses. LinuxCNC forum user “lead_injection” recommends Medical Grade filters as they have the lowest leakage current.

PSU's (Power Supply Units)

1. AC Grounds

A typical CNC machine may have a few different power supplies installed and in use on the system. Make sure the AC inputs to your power supplies are properly grounded. Tie them all to the same ground. Many power supplies have a metal case and the case is usually tied to the AC ground as well so keep this in mind when you are fastening them down. In my case I have a metal drawer that I am using, so when I fasten down the power supplies, I need to keep in mind that the AC ground will be attached to this drawer as well.

2. DC Grounds

There are two trains of thought when it comes to the DC ground. Some folks say that you should ground it to the AC ground and others suggest that you should create a separate isolated ground plane for the DC power. I don't know if one style is better than another but if you are interested a Google search you can find folks that will defend either side of the argument.

Additionally, many suggest that you keep the ground for any supply providing logic level voltages segregated from any other DC supply to prevent ground loops which could create new additional problems. A ground loop exists when the grounds of two different devices are at different potentials. For example, if the PSU for your drivers were at a different potential than your supply for your logic and you tied them together, you could corrupt your logic signals by a small voltage change. If this difference in voltage is enough to push your signal into the unknown state we discussed above, then your equipment will be unreliable or possibly erratic.

In my controller drawer I have three PSU's. Two of them are 36VDC and one is a 5VDC. The 36V supplies are meant to run my stepper controllers while the 5V supply will provide power to my BOB (Break Out Board) and TTL signal level voltages. My intention is to give the 36V their own ground plane and to isolate the 5V supply for the logic.

Stepper Motor Controllers

When wiring the controllers up, the following list should be helpful.

1. The metal housing of the controller should be grounded. You can verify this with a multimeter set to check continuity. Best practice is to mount your controllers directly to your ground plane. The ground plane as you recall from above is an isolated piece of metal that you will attach the ground from your PSU that supplies your controllers. A simple way of doing this is to use a piece of aluminum plate for the ground plane and mount it to your enclosure using insulated standoffs. Mounting your controllers to this plane allows any noise the controller might generate to be diverted to ground rather than emitted through the air and possibly affecting surrounding equipment.

2. The controllers that I have experience with have two sets of connectors. They are divided into two groups. The first group is power supply and motor leads. The second group are control signals. When wiring your controllers keep these two groups separated. Run your power and motor leads to one side of the controller and the signal wires to the other if at all possible. Again, using shielded wire will take you a long way in avoiding extraneous noise.

3. DC Supply wires

When running power to various pieces of equipment in your electronics box, using twisted pairs will aid in negating noise from neighboring wires. The twist in the wire creates a canceling effect on any magnetic field that passes across them. For additional protection use twisted wire that is housed in a shielded jacket. This type of wire typically has a metal foil or braid wrapped around the wire along with a stranded wire that runs beside it. The foil or braid will absorb the magnetic field that a neighboring wire produces as current runs through it. For best results, attach the stranded wire to the DC ground. Doing this will prevent the field from passing beyond the shielding to affect the wires contained in the cable. When grounding the shield wire, only ground at one end. Grounding the shield wire at both ends can create a loop that can effectively negate the ground allowing noise to be injected back into the wire.

4. When making power connections to the controller use a twisted pair of wires. You can twist them yourself, but make sure you have at least one twist per inch of wire. For best protection use a shielded twisted pair and attach one end of the shield wire to your grounding plane. The piece of aluminum plate your controllers are mounted to.

5. When making connections to the motors, use shielded cable. These wires carry the most current and will emit a lot of magnetic radiation. Be sure to ground the shield wire to the ground plane.

6. When making signal connections to the controller (The step and direction pins) use a twisted pair to make the connection. Category 5 Ethernet cable is cheap and contains four twisted pairs. This makes excellent signal wire. You can strip the housing back enough that you can run two pair to one controller and another two pair to a second controller. You can also buy Ethernet cable with a shield. If you ground this shield, be sure to ground it to the PSU that supplies your logic signals and not to the power plane for your stepper controller and its PSU.

Variable Frequency Drives (VFDs)

VFDs are used to drive spindles and work by varying the frequency of the AC going to the spindle. VFDs are great noise producers. If at all possible locate your VFD in a separate enclosure or cabinet to reduce the risk of it injecting noise into your other wiring. Recommended wiring for the VFD is foil braid or copper tape shielded wire and observing good grounding practices. A PDF document from Belden on the topic can be found at the following URL.

http://www.mc-mc.com/Portals/1/articles/WP-VFDCablingPractices.pdf

Wire Selection and Use

Wire comes in many types, sizes and configurations. Wading through all the wire available is a monumental task of its own, but for our purposes we only have a look at the types of wires suitable for wiring a CNC controller. Additionally, how the wire is to be used can have some affect on the overall system. What follows are some tips that may prove helpful.

1. Shielded Wire.

There are basically three types of shielded wire. One has a bare wire braid that surrounds the wire inside, and the other has metal foil that surrounds the wire inside. And lastly, there is both a braid and metal foil. All of these are designed to prevent noise from being injected into the wire enclosed. The type of shielded wire you will select will depend on the amount of noise you are trying to combat. A brief discussion of each follows.

A) Foil Shielded Wire

Foil shielded wire has a thin metal foil that is usually bonded to a film of plastic that surrounds the wire. The enclosed wire is usually 100% covered and that is good. Foil shielded wire can be difficult to use, especially when trying to attach a connector to the shielding in order to ground it. For this reason, you will usually find a bare metal stranded wire enclosed that you can make a connection to. Of the three types of shielded wire, this is the least effective.

B) Braided Shielded Wire

Braided Shielded Wire has a metal braid that surrounds the wire. It is more bulky than the foil shielded wire and does not provide 100% coverage. It typically covers 70 to 95% covering depending on how tight the braid is made. The braid is typically made of tinned copper wire. Because copper is a better conductor than aluminum and it's bulky size it works better to shield the wire than the foil shielded wire. It should be noted that this type of shielded wire will cost more than the foil shielded wire above. Of the three types this one is more effective than foil shielded wire, but less effective than the next one discussed.

C) Multi Shielded Wire

For very noisy environments a wire that contains both foil wrapped wire and a braid will provide the most protection. As you can guess, of the three types this is the most expensive.

2. Routing Wire

There are two types of routed wire. Wire that is stationary and wire that gets moved as the machine runs. Along with this, we must consider the effects of neighboring wires to the wire being routed may have. The following recommendations were given by forum member lead_injection.

A) Routing Movable Wires

Any wire that will be moved about in normal operation of the CNC falls into this category. For example, the wires that run from your controllers through cable management and then to your motors.

If you are flexing your cables, use high flex rated cable (IGUS). This may get pricey for 4pair STP (Shielded Twisted Pair) type cables.

If running cables in a cabletrack/carrier tie them down at both ends of the cable track. If not, ratcheting can occur and fatigue the cable prematurely.

In a cabletrack/carrier observe the neutral axis idea. Have the wire run as close to the neutral axis as possible. Make sure the wire is not in tension in the longest neutral axis situation.

B) Routing Stationary Wires

Running different signal classes (high voltage and low voltage) in metal conduit may make the noise worse. Separate by as much distance as possible and if they have to cross, cross them at 90 degree angles.

Avoid wiring loops coming off of devices - they are great antennas for receiving noise, or great antennas for transmitting noise. Run wires along the ground plane.

Signal Wires

The wires that are used to transmit logic signals are the most susceptible to noise interference. The reason for this is the low level voltages that are used to convey the information. The following will prove helpful in keeping your signal wires clean.

1. Isolate the PSU for your signal wires from the rest of the system. Keeping the power supply isolated will prevent your other supplies from interfering with it.

2. Use twisted pairs to carry your signals. For best results use both wires and do not share a common ground for two or more signals. Use a pair of wires for each signal. Using shielded wire is best. When grounding the shield wire, ground to the logic PSU.

3. Shielded Twisted Pairs (STP) are most beneficial to differential signals. If you add the noise to both signals, the common point is not affected - the magnitude of the difference is maintained.

Stranded Wire

Wire comes in two forms, solid conductor and stranded. Both have their ups and downs. Stranded wire is pretty common in cables because it is more flexible. When using any stranded wire keep the following things in mind.

1. Terminate the ends

Little wires hanging off the end of your cable can create problems. They can cause shorts when wired next to other wires in close proximity or to the boards they are connected to. They can also act like a little antenna that will help them emit any noise they may be trying to generate. There are several ways that you can terminate them.

A) Twist and solder the ends. Tinning the wires in this manner makes then easier to insert in the set screw connectors and binds all the little wires together preventing them from fraying apart.

B) Use crimp on ends. Crimp on ends like spade connectors or bootlace ferrules also work very well. It is best to not to tin the end before crimping them. Tinning the wires could allow them to loosen over time. Attention to detail and the proper selection of the crimped end will form a quality mechanical connection.

2. Be careful of the amount of insulation you strip from the wire. Stripping too much insulation off will lead to exposed wire that something can short against. If you do simply trim off the extra wire.

Control Signals

When a limit or home switch is engaged, or a probe has made or broken contact, we use this signal to signify the event has taken place. Typically this is done by using input pins on the parallel port. The signal voltages used on the port are in the 3 to 5 volt range depending on the type of port you have. It only takes a small noise injected onto the signal wires to put it in that unknown voltage area we discussed above, resulting in an unknown TTL state. If after careful wiring and planning you are still having these kind of issues, there are a couple of things you can do to fix the problem.

1. Higher control voltages. If instead of using the logic PSU to supply the voltage for the detection circuit you used a larger PSU, for example a 12 or 24V supply to the input side of a mechanical relay or SSR (solid state relay), the control circuit would be less affected by noise. In turn, the mechanical relay or SSR would turn on or off the control signal to your parallel port or breakout board allowing you to keep these small control voltages in short runs and contained in your wiring cabinet. In addition you may be able to find opto-isolators or opto-couplers that will work on higher input voltages that will switch the lower TTL voltages to the port. A search on Jameco, Mouser or other electronics supplier should turn something up.

2. Higher control current. If you are using pull up resistors on your inputs, you can use a smaller valued resistor to increase the current draw and reduce the chance of a false signal. Keep in mind the additional current load on your PSU. You can calculate the current load with a judicious application of Ohm's Law.

Mechanical Noise

Mechanical Noise happens when mechanical contacts open and close, as in a switch or relay contacts. As they open or close they will bounce against each other creating a rapid state change in the circuit. The electronics monitoring the change in state, the opening and closing of the contacts, can detect these quick changes. Sometimes it doesn't matter, but more often than not, you don't want this condition to interfere with the operation of your machine. For example, it will generate errors when probing. However, like I mentioned above, this situation is pretty easy to remedy.

1. Debouncing a switch with hardware.

Debouncing a switch can be done with the addition of some hardware to the signal circuit. There are ICs (Integrated Circuits) like Motorola's MC14490 that are designed to do just this thing, but they can be difficult to find. A simple method of debouncing a SPST switch uses an RC network (sometimes coupled with a diode to increase the speed) as a delay into a Schmitt triggered inverter allowing it to compensate for the time it takes the switch to settle down. If you are interested in this method, you can find more information on the subject by visiting the following URL:

https://electrosome.com/switch-debouncing/

Additionally a great video on debouncing a SPST switch can be found here:

https://www.youtube.com/watch?v=tmjuLtiAsc0

I may at a later time create a tutorial on how these circuits are made, but there is an easier way. That comes next.

2. Debouncing a switch with HAL

The hardware abstraction layer (HAL) of LinuxCNC has a Debounce component. The Debounce component has a single input pin and a single output pin. Its job is to look at the input and to send the output after a programmed delay time. The Debounce HAL component will be covered in a separate tutorial when we create a touchoff plate for the CNC machine. More information can be found for the Debounce component by visiting the following URLs:

http://linuxcnc.org/docs/html/hal/rtcomps.html#sec:Debounce and http://linuxcnc.org/docs/html/man/man9/debounce.9.html

Documentation

Documenting your wiring cannot be over stressed. With power feeds, motor leads, signal wire and everything else you stuffed into your your wiring compartment, you will be grateful that you documented your wiring. A year after you completed your CNC wiring and you want to add something, or some trouble arises, you will have your documentation to fall back on.

So, what should you document? The list that follows probably should be the minimum you hang onto and if you think you should note or save something else, you probably should.

1. Hardware Documentation.

At a minimum, make sure you save any documentation you have for your hardware in a safe place. Stepper controllers, Break out Boards, Power Supplies, PID controllers, individual components if they apply, Servo Controllers, etc. Although it takes a little more room, I print all the electronic documentation for the stuff I have and keep them in a binder in plastic sheet protectors. This binder is divided into sections based on the type of hardware or documentation I am keeping.

2. Wiring Schematics

As you wire your CNC, make sure to draw up a schematic that you can reference later. The schematic does not have to be all that neat, but you must be able to pick it up a year later and understand what you have done. Be sure to annotate your schematic with any additional information that will help remind you of what you made. Keep a copy of your schematics in your documentation folder so it does not get lost. If you keep things electronically, scan your schematics and save it with the rest of your documents. If you don't have a scanner, you can take a digital picture and save it to your computer.

3. Label your wires

Take the time to label your wires. When you start bundling wires, it is hard to look at them and know for sure what is what when you go back to modify or change something a year later. Label your motor wires with the joint or axis they run, label your signal wires so you know what they do. The idea here is to make it easy to identify a specific wire or set of wires you have in your controller.

Additional Information

1. LinuxCNC and Machine Related Questions

Additional Information and help can be found by using the LinuxCNC forums. If you are not a member of these forums, I encourage you to join. Please visit:

http://linuxcnc.org/index.php/english/forum/index

The folks there are very helpful, have loads of experience and are willing to share some insights.

2. Cable and Wire Harness Assemblies

Publication IPC/WHMA-A-620 covers the Requirements and Acceptance for Cable and Wire Harness Assemblies. This publication describes acceptability criteria for producing crimped, mechanically secured, or soldered interconnections and the associated lacing/restraining criteria associated with cable and harness assemblies. It is not the intent of this document to exclude any acceptable procedure used to make the electrical connection. A 2002 version of this document can be downloaded from the following URL.

http://www.gartechenterprises.com/downloads/IPC-A-620.pdf

3. Understanding EMC (Electromagnetic Compatibility) Phenomena

A publication from Groupe Schneider goes into depth about what Electromagnetic interference is and how to design your system with it in mind. This is a great document is you want to know the what and why of electromagnetic interference. It discusses in detail, cables, grounds, types of interference, chassis connections, filters and more. A very good source of information to those who want to know more on the topic. You can download a copy of the 200+ page PDF from the following URL:

http://www.engineering.schneider-electric.dk/Attachments/ia/instal/electromagnetic_compatibility_install_guide.pdf

Acknowledgements

I would like to thank the following people from the LinuxCNC forums for their input on this tutorial. It is with their help I am able to give you the information contained herein.

Andy Pugh - Arc Eye - Clive S. - Jake - lead_injection - Peter Ommen

(End of Tutorial – Last Update 12 APR 2017)


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited April 18, 2017 8:43 pm by Joe Hildreth (diff)
Search:
Published under a Creative Commons License