Notifications
Clear all

Balanced vs unbalanced inputs to stepper driver

6 Posts
3 Users
3 Likes
1,520 Views
(@babag)
Member
Joined: 2 years ago
Posts: 5
Topic starter  

I am new to the forum, so excuse me if this topic has already been discussed (I did a search but couldn't find any relevant information).

I am adding a stepper motor to rotary table to make a CNC rotary axis on an otherwise manual milling machine.  This is my first attempt at this type of automation, so I am following Bill's video "Using BIG Stepper Motors with Arduino." Everything is working fine in the mockup I have done on my bench.  My Stepper motor and driver are slightly smaller than the ones he used, but the wiring and Arduino code is substantially the same.

Eventually the stepper, driver, and power supply will be mounted in the cabinet of the mill but the controller will be located about 6' away in a separate cabinet.  I was planning on connecting the GPIO pins and +5 of the Arduino to the PUL+/- and DIR+/- connections on the driver using twisted pairs that are about 10' long (one twisted pair connecting Arduino +5 and GPIO7 to driver PUL+ and PUL-, respectively; and another twisted pair connecting Arduino +5 and GPIO6 to driver DIR+ and DIR-, respectively).

I have a rudimentary understanding of how balanced lines work and why they are used, but I am a little confused by the following statement that Bill makes: "Balanced inputs are used to allow for long unshielded twisted-pair wires in an industrial environment with a lot of electrical noise. As long as we keep the connections short we can use our Arduino in an unbalanced wiring configuration."

I am not sure if my proposed setup will be balanced or unbalanced or if it even makes a difference.  Does anyone see an issue with my solution given the lengths of the cables I am working with?

Any help you can provide is greatly appreciated.

Thanks,

BabaG


   
Inst-Tech reacted
Quote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

Hi @babaG, and welcome to the forum.. Bill is right,long twisted pairs used in industrial applications are usually shielded from external EMF and other electrical noise.. but, that's because they are usually Very long lines, (500 to 3000 feet)!  There will most likely not be any problem with any thing under 100 feet, because the inductance/Capacitance of the wire will be to small to form a resonance and induce noise in the signal wires. One consideration though, you want to keep the signal wires away from high voltage AC (120, 220, etc.).. as a precaution.. It's just a standard practice in the trade to not mix high voltage and control signals together.. any shielded twisted pair of 18 Gauge will do in your case..it's all low voltage, and low current, just remember to keep it separate from your AC power wiring and you'll be fine.

have fun, and above all , be Safe!!

kind regards,

LouisR   

LouisR


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1643
 

Hi @babag,

   To send an electrical signal by cable, there must be a closed loop circuit ... so to transmit information (is it On or Off?) over a distance, the sender and receiver must be connected by a pair of wires. The information is sent by varying the voltage sent in a way that the receiving end can interpret.

Think of a simple circuit with a battery and switch at one place, a light bulb at the other place, and pair of wires linking the two places, such that closing the switch causes the light to 'glow'. The battery+switch is a transmitter, the bulb a receiver.

In an unbalanced system:

  • one of the pair of wires is directly connected to a number of circuits ... and is typically called 'Ground'. Traditionally it would usually be connected to some metal buried in the 'ground' somewhere ... and this is still commonly true, via the 'third' 'Earth' pin of the mains supply. Simplistically, this can be regarded as 'Zero Volts', in a manner that 'Sea level' is often called 'zero height'. In reality, you will be aware that the water level of an ocean varies with tides, waves, tsunami etc and locally is far from a fixed height. Furthermore, if you monitor the water level in two places a distance apart, it may be rising at one place, whilst falling at the other. The voltage potential of 'ground' can be similarly dynamic and difficult to predict, including being momentarily different at the ends of the same piece of wire at a given time!
  •  
  • the other wire in the pair of wires will have a potential imposed by the sending device, at the device connection point, relative to 'earth' at the sending end. By the time a change at the sender reaches the receiver some distance away, the receiver may see a different potential due to a number of effects all superimposing their own distortions. One of these effects will be the pickup of stray electrical and magnetic fields acting upon the wires. Another can be the earth 'potential' at the ends of the wires can be different.

Digital signals have a resilence to small changes of voltage .. e.g. 3.3V logic may regard below 0.5V as '0' and above 2.5V as 1, so a few millivolts either way is not a problem ... but there is a middle voltage range .. say 0.6V to 2.2V that is 'anybodies guess' whether it will be interpreted as 0 or 1. So even though the nominal voltage difference is 3.3V, in reality distortions above say 600mV spell trouble brewing.

Now, consider a balanced system:

  • There is still a pair of wires, but there are important differences:
    • Both wires are 'driven' by identical driver circuits
    •  
    • The signal applied to the wires is always the compliment of the other. e.g. if the two voltage levels are 1V and 2V, then to send a '0', one wire A is driven to 1V, the other wire B will be driven to 2V, and to send a '1', wire A is set to 2V and wire B to 1V .
    •  
    • Hence, at the receiving end, the wires will be connected to a comparator which compares the voltage of wire A with wire B.
    •  
      • If Voltage of A is less than Voltage of B it is '0', otherwise it is '1'
    •  
  • Note that it is a comparison of one wire voltage  with the other ... they may be almost the same, as a comparator only needs a very small difference (say a few millivolts) to choose correctly. It also, doesn't matter if the local earth voltage is different, providing it is only a few volts difference, the comparator doesn't use the earth potential as reference. (Specialist comms chips have special input circuits that tolerate both comparator input pins being at higher and lower voltages than normally permissable for the rest of the chip's  input pins - careful data sheet reading needed if your application will result in substantial voltage differences.)
  •  
  • A further tweak to improve performance, is to twist the pair of wires along their length. The idea is any stray magnetic or electrical fields will affect the voltage of both wires by the same amount ... and so any induced voltage will move the voltage of both wires by the same amount, and is 'cancelled' at the comparator which only 'sees' the voltage difference.

----------------

So what does all this waffle mean:

  • If you are sending a 'message' as a serial stream, using a single pair of wires, balanced and unbalanced use the same number of connectors ... 2. However, the unbalanced would 'ideally' use a co-ax with inner core and shield as conductors (shield as 'earth' wire), whilst balanced would use a twisted pair of identical conductors.
    • (In electrically 'noisy' environments, the more paranoid/astute engineer might specify that the twisted pair also has a screen shield connected to earth, but it is only protective, not part of the communications circuit.)
  •  
  • The unbalanced needs 1 transmitter output, balanced needs 2 transmitter outputs driven with complementary signals ... similarly at the receiver end ... this has obvious implications in terms of chip pin and connector pin requirements.
  •  
  • If you are sending several signals in parallel, e.g. an 8-pin 'byte-wide' data, then unbalanced needs a minimum of 8 'active' lines + common 'earth' line ... 9 conductors, whilst balanced needs 8 pairs, ... 16 conductors. Note that the unbalanced may need more than 1 'earth' line for higher speeds with longer wires to reduce stray coupling between the signal lines.
  •  
  • Balanced systems sometimes have an additional 'earth' wire .. this can be a shield or a simple wire. This is ensure the voltage applied to the comparator inputs is not 'widely' different from the expected ranges.

 

Summarising, unbalanced is usually 'cheaper' but less 'robust'. For lower frequencies, including those usually associated with Arduino GPIO pins then unbalanced will probably be OK in most cases for up to a metre or so ... for higher frequencies, the length becomes progressively shorter ... PCB tracks on high speed processors with high speed ports increasingly require balanced approach for just a few millimetres.

Older comm standards like RS232 used unbalanced, but RS485, CAN, USB and present-day wired Ethernet are all balanced.

A long treatise, but hopefully it gives a flavour. Best wishes, Dave


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1643
 

Hi @babag,

  I have just reread your question, and whilst I standby what I wrote, maybe I missed the point you were looking for... 🙄 That is How do I connect my stepper motor controller to my Arduino?

I haven't worked with stepper motors using a modern controller, but I have looked a few specs and programs recently. And I am left with a bit of 'maybe' situation.

My concern arises from the maximum (micro)step rate you are looking at ... and by that I mean the maximum pulse rate sent to the PUL terminals. That is for each microstep, you need to send one pulse. For the controller I looked at, this could handle up to 20kHz ( 1 per 50 microseconds, when duty cycle is 25% high, 75% low)  corresponding to 12.5 microsecond high 37.5 microsecond low.)

This, when driven directly by standard Arduino output down (say)10 feet twisted pair wire is 'pushing ones luck'.  It is in the difficult 'try and see' class. The potential problem is not one of noise from other equipment, but that of the pulses on that wire getting 'mashed' in transmission.

The similar DIR wires will have either 5V or 0V across them for long periods of time, changing only to reverse the direction of motion, so will be largely unaffected by this problem.

The minimum test you need to prototype is with full length wires and ensure the motor speed and rotation changes smoothly from slow all the way up to 'full speed'. (That is 'full speed' that you need and that the motor itself can handle, preferably when the motor is mechanically connected to its application, which may be slower than the controller can accept.)

It is possible you could overstress the Arduino output stages, but unless you have an oscilloscope, I can't think of a way of you measuring it .. and I have overcomplicated things enough already ...

If it is a problem then a simple 1 transistor buffer is all that is required, but for now, perhaps see how you get on without it.

 

Good luck with your project, Dave


   
ReplyQuote
(@babag)
Member
Joined: 2 years ago
Posts: 5
Topic starter  

@inst-tect and @davee, thanks for the quick response and helpful info.  I guess I was overly conservative in thinking I was looking at a “long” run of cable.  I am going to go ahead with my original plan and see how things work out.

@davee - your second post was more like what I was looking for, but the first one was very informative so thanks for making both.  Regarding the frequency of the PUL signal, I am more concerned with position than with speed.  I am micro-stepping using 800 steps/rev and it takes 72,000 steps to get one full revolution of the rotary table (90 full turns of the stepper for one full turn of the table).  The specs for my stepper driver say it can be pulsed at 200khz with 50/50 duty cycle, but I am nowhere near that.  I am using a 500 microsecond pulse (2khz), which will give me one full turn of the table in 36 seconds.  The whole purpose of this project is to automate gear cutting, so the time taken to position for the next tooth will usually only be about one second, depending on the number of teeth.  That pales in comparison to the time required to actually cut the tooth.

Anyway, I should have all the mechanical parts I need by the end of next week so I should be able to give the whole system a try in a week or so.  Thanks again for your help.

 

Jon

 


   
Inst-Tech reacted
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1643
 

@babag Hi Jon,

  Thanks for your update ... good to see it looks very hopeful.

  I would hope 2kHz should be straightforward ---

My earlier investigations suggested a simple Arduino software timing instruction of say 25 microseconds actually got extended to around 30 microseconds. (Running on a Mega 2560). 5 microsec error in say 500 microsecs isn't going to worry you, but obviously things are different from say 10 kHz upwards. Similarly, I might expect you might see wiring limitations above 10kHz. In both cases, these 'limits' are vague estimates, not definitive limits, and can be worked around if required at some point in the future.

Remember, the pulse rate limitations apply to all 'circumstances' --- e.g. not just when you actually 'cutting metal', but also any manoeuvring operations to set the tooling up and resetting afterwards. I don't know whether this is significant for your particular operations - I just mention for consideration.

Good luck with your project ... I hope it works well! Dave


   
Inst-Tech reacted
ReplyQuote