I have been looking at wiring up a multidrop RS485 link over a distance up to a kilometre and have been encountering differing views on whether just the A and B wires are needed or whether a ground wire is also required for reliable communication. Some web pages say that the ground wire is necessary while other say that it is not necessary and others say that it actually hampers reliable communication.
An example is at: http://www.chipkin.com/rs485-cables-why-you-need-3-wires-for-2-two-wire-rs485/
The comments from (apparently) professionals to the Q&A tutorial at the start of the page also shows a lack of consensus.
I was wondering what some of you guys have experienced with RS485 in this respect and your views?
They call lots of stuff 2 wire but i've never used any wire to hook it up that didn't have the power with it.
red black green and yellow. Alarm wire.
The RS-485 differential line consists of two pins:
A aka '-' aka Data - (D-) aka TxD-/RxD- aka inverting pin
B aka '+' aka Data + (D+) aka TxD+/RxD+ aka non-inverting pin
SC aka G aka reference pin. Ground
It's a 2-wire differential protocol and you don't need a ground wire.
But an some applications, such as DMX512 lighting control, a 3-conductor XLR connector is used with a shielded cable.
A ground wire is mandatory !
Differential links provides a gain (x2) and noise immunity.
But it is imperative that the receiver and transmitter share the same reference voltage OV ie GND
The only exception are in the case when there is use of a flux, magnetic with transformers or optical with fibre or optocoupler
A ground wire is mandatory !
Differential links provides a gain (x2) and noise immunity.
But it is imperative that the receiver and transmitter share the same reference voltage OV ie GND
The only exception are in the case when there is use of a flux, magnetic with transformers or optical with fibre or optocoupler
Like I said lots of stuff calls it self 2 wire but it still needs the ground I never installed any alarms with optical with fibre or optocoupler. But a lot with four wire and some with shielding and 3 wires nice stuff and you can bet it was right way to do it cause after all it's there to save your life It's was for fire as well as break in .
Here is the suggested wiring from the LTC1480:
(http://www.gammon.com.au/images/Arduino/RS485_datasheet.png)
Note that they have a shield
grounded at one end (presumably to avoid earth loops). All three devices are grounded but there is no indication that the grounds themselves are connected together.
But it is imperative that the receiver and transmitter share the same reference voltage OV ie GND
I thought that the whole idea was that the 2 data wires carried a
differential voltage. Thus the reference voltage is each other.
By comparison, MIDI cables use a similar technique. There are two data wires (they are not differential, but carry a current which drives an LED in an optocoupler). You connect the ground (shield) at one end only. Otherwise you set up an earth loop.
More information here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/763 (https://www.maximintegrated.com/en/app-notes/index.mvp/id/763)
Interestingly, that mentions ground (but not a shield):
Wire
RS-485 is designed to be a balanced system. Simply put, this means there are two wires, other than ground, that are used to transmit the signal.
(http://www.gammon.com.au/images/Arduino/RS485_datasheet2.png)
Another link: http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/Basics-of-the-RS-485-Standard.aspx (http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/Basics-of-the-RS-485-Standard.aspx)
Signal ground, don't forget it. While a differential signal does not require a signal ground to communicate, the ground wire serves an important purpose. Over a distance of hundreds or thousands of feet there can be very significant differences in the voltage level of "ground." RS-485 networks can typically maintain correct data with a difference of -7 to +12 Volts. If the grounds differ more than that amount, data will be lost and often the port itself will be damaged. The function of the signal ground wire is to tie the signal ground of each of the nodes to one common ground. However, if the differences in signal grounds is too great, further attention is necessary. Optical isolation is the cure for this problem.
RS485 is a symetrical two wire protocol. the same system as sound cables with the 3 pin XLR.
we often use this over two wire but these wire must be twisted for such a long distance. if your cable has a shield, ground it on both sides, this gives better noise to signal ratio.
anyway , most devices (modems) have a power supply without ground (only 2 pins on the 220v side) so the ground potential difference is not a problem. most 485 devices can run on one pair (half duplex) or two pairs (full duplex) if available use two pairs but if you dont have massive amount of data, one pair is ok.
in theory the same data signal goes over both lines, one signal positive, one signal negative. any distortion signal which comes to the cable adds the same peak (for example positive distortion peak) to both lines.
the circuit on the receiver side takes the postive signal from one line and INVERTS the negative signal from the other line. the distortion comes on both lines positive, but since the signal on the second line will be inverted, the distortion signal will be zero.
my installation with rs485 uses only one pair (taking data from a clock to a point aprox. 500 meters away) works perfect.
EIA-485 says that using the ground can be a advantage for longer lines, but its not nessecary.
wikipedia gives a few good explanations about differential or symetrical transmissions and EIA-485
All three devices are grounded but there is no indication that the grounds themselves are connected together.
Yes there is, they all use the same symbol so they are all connected together. This can be either by a wire between the two units or a wire on each unit to the read ground ( Earth ).
Yes, but the ground symbol, over a long distance, suggests to me that they are locally grounded.
In any case, doesn't carrying a ground wire negate the advantage of having a balanced pair? The balanced A/B pair is to cancel out induced voltages on a long cable run, right? So this is negated by supplying ground over a long cable run.
I don't see a problem the wire I use has 2 wires and a shielding which is the ground. Or 4 wires and there twisted pairs. They ground at main panel. I've run miles of this on motels and it works fine.
Yes, but the ground symbol, over a long distance, suggests to me that they are locally grounded.
No it is a symbol that means the same place, not a local one. If it were a local one then there would be two different ground symbols. There are several, notice the one in your circuit is Earth, there is only one Earth. Note if they were local grounds then there would be a number in them like on the right hand side.
(http://digital.ni.com/public.nsf/$CXIV/ATTACH-AEEE-9BNEL2/$FILE/GroundingTermsandSignals.gif)
The balanced A/B pair is to cancel out induced voltages on a long cable run, right?
Not quite, the twisted pair ensures that any signal picked up is common to both wires. Then the same difference is preserved between the two signals.
So this is negated by supplying ground over a long cable run.
No, if this induced signal is also picked up by the ground wire then the differential is still preserved.
Looks like this is relevant: http://electronics.stackexchange.com/questions/150678/looking-for-a-long-distance-1km-physical-layer/ (http://electronics.stackexchange.com/questions/150678/looking-for-a-long-distance-1km-physical-layer/)
Quoting Michael Karas from that:
For successful design and deployment of RS-485 networks I strongly recommend that you read and comprehend these application note documents:
Application Note 847 FAILSAFE Biasing of Differential Buses
http://www.ti.com/lit/an/snla031/snla031.pdf (http://www.ti.com/lit/an/snla031/snla031.pdf)
AN-1057 Ten Ways to Bulletproof RS-485 Interfaces
http://www.ti.com/lit/an/snla049b/snla049b.pdf (http://www.ti.com/lit/an/snla049b/snla049b.pdf)
B&B Electonics RS-422 and RS-485 Applications eBook
http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/RS-422-and-RS-485-Applications-eBook/RS-422-RS-485-eBook-graphics-embedded.pdf (http://www.bb-elec.com/Learning-Center/All-White-Papers/Serial/RS-422-and-RS-485-Applications-eBook/RS-422-RS-485-eBook-graphics-embedded.pdf)
I think the relevant quote from these is
Although the potential difference between the data-pair conductors determines the signal without officially involving ground, the bus needs a ground wire to provide a return path for induced common-mode noise and currents, such as the receivers' input current. A typical mistake is to connect two nodes with only two wires. If you do this, the system may radiate high levels of EMI, because the common-mode return current finds its way back to the source, regardless of where the loop takes it. An intentional ground provides a low-impedance path in a known location, thus reducing emissions.
OK, let's get cunning about this and just look at the specifications of an actual RS-485 interface (http://www.ti.com/lit/ds/symlink/sn65hvd33-ep.pdf).
We find that the "Absolute maximum" specifications are -9 to +14V, but the working range is 0 to Vcc - being 3.3V.
This means that in order to work properly, you must constrain the voltages to those levels. How do you propose to do this?
Well, either you know that your grounds are at the same voltage due to other connections, or you provide a ground connection for a reference along with the data wires. If there is a concern that this will cause a "ground loop" with significant current flowing then you need to fix that problem.
Please get it straight. RS-485 is a protocol designed to communicate over significant distance with a degree of noise immunity. It does not provide any degree of isolation such as Ethernet. If that is what you want, you need optic fibre.
Thanks guys for the replies.
I take it that ideally I would connect all the grounds (in the diagram in post #5) together, preferably through shield, so there is no difference between grounds that could arise through using local grounds over the 1 km distance.
However then I run the risk of a ground loop which I'm not sure how to remove. (I will do some more googling)
The other alternative is to use optoisolated RS485 transceivers.
Is this a fair precis?
You not have a ground loop if it runs one way.
I'm not sure what you mean by that. Are you saying only connect shield to ground at one end?
As an aside, is Cat5 Ok for long runs of RS485? Too many cores I know but its cheap and comes in UV resistant forms.
Cat5 work just fine as long as you use one set of pairs and ground one set of pairs a ground loop is just that a loop if you don't run back over your ground its not a loop
However then I run the risk of a ground loop which I'm not sure how to remove.
This is indeed a serious risk. Even in a single household there can be large ground loop currents, or at least significant potential differences between grounds, such as (in the U.S.) between different branches of the 120-0-120 incoming line.
Not too long ago I was running 240 VAC out to a well pump and got a shock off the protective ground lead. I measured 77 VAC from the protective ground to the well head. The power company investigated and discovered that a power pole close to the well, and carrying a transformer, had a faulty earth connection.
So really, RS-485 is not the right protocol for rural data transmission and maybe not even over significant distances within a building.
Consider telephone-style modems (these are always isolated) for low data rates, Ethernet for higher data rates. Or do it properly; use optical fibre.
I've been wiring houses for 34 years and the only time I've seen ground problems is when the ground is cut hooked wrong in a outlet happens when you get people working on stuff they don't nothing about. Heck that's just 3 wires LOL think on that awhile. Or something with a bad motor. Now any of these need fixed if you like
your house and love yourself.
Next up any half way good cable installer knows that you don't run data cable with the power wires.
Then there this ground is at ground if one wire and grounded when you loop it it becomes a coil so like a coil
each tap can have a higher then ground level. That's why you use star grounds. And in this case one long ground with no loops
However then I run the risk of a ground loop which I'm not sure how to remove.
Ground loop current is limited by inserting an 100Ω resistor in inline with the RS485 ground.
I highly recommend to also read this (http://ftp1.digi.com/support/documentation/90000641_a.pdf).
I have done extensive testing with RS485 links both with and without ground wire connections. To summarize I 'd say that:
- Unconnected ground topology works as long as the potential difference between grounds is kept to a minimum (less than a few volts)
- Ground connection topology works better but then again if there is significant potential difference between grounds you risk a ground loop current. In this case opto-isolation is required.
I find that Maxims fail safe RS485 chips work best for higher distances eg MAX3085. There is also an opto isolated version.
Carefully choose the best chip for your particular application also taking into account required fanout etc.
If I was worried about this I would use opto-isolators (eg. like MIDI) where you specifically do not connect the grounds. However MIDI uses a shield which is connected at one end only and thus does not take part in the question about being a reference voltage.
Next up any half way good cable installer knows that you don't run data cable with the power wires.
Which is of coruse correct for safety and interference reasons.
However this bodes against using the power ground as the reference for both ends of the data link as by separating the two, you have clearly
created a loop.
Then there this ground is at ground if one wire and grounded when you loop it it becomes a coil so like a coil
each tap can have a higher then ground level. That's why you use star grounds. And in this case one long ground with no loops
But it is not the
closure of the loop that creates a ground loop - it is the
structure of the loop. A loop is caused by a "return" being separate from the active (or in this case, actives).
Ground loop current is limited by inserting an 100Ω resistor in inline with the RS485 ground.
Which indeed limits the
current, but not the voltage, so it is of no use in removing a ground voltage mismatch. It is in fact useless; just a half-hearted version of simply disconnecting the ground entirely or more accurately, providing some sort of second-rate ground if the
other part of the loop is broken.
I highly recommend to also read this (http://ftp1.digi.com/support/documentation/90000641_a.pdf).
- Unconnected ground topology works as long as the potential difference between grounds is kept to a minimum (less than a few volts)
Less than one volt according to the specifications I previosuly cited.
- Ground connection topology works better but then again if there is significant potential difference between grounds you risk a ground loop current. In this case opto-isolation is required.
The current is not the point other than in terms of safety. It is the
voltage that matters. Because the data ground will be the part of the cabling "loop" with the highest resistance, the voltage will still apaear between its ends, only marginally less thn if they were not conencted in the first place.
However MIDI uses a shield which is connected at one end only and thus does not take part in the question about being a reference voltage.
No, it does not take part in the question about being a reference voltage because the data path
is opto-isolated and requres no reference voltage. The shield ground is irrelevant.
Hi,
I have been looking at wiring up a multidrop RS485 link over a distance up to a kilometr
Check distances and baud rates;
http://rs485.com/rs485spec.html (http://rs485.com/rs485spec.html)
http://cds.linear.com/docs/en/product-selector-card/2PB_RS485fd.pdf
1km is under 4000ft (3280km) so should be ok.
Tom.... :)
If you arrange to use a balanced coding over RS485 (no DC component) you can stick it over
ethernet jacks with magnetics (transformers), giving isolation - however people normally stick
standard (DC biased) serial over it, so if you need isolation you need to add optoisolation yourself.
For runs of 1km or so you need isolation otherwise the next thunderstorm could blow up all your kit!
Fibre or wireless link makes a lot more sense for that sort of distance - at least add opto isolation and
protection circuitry at each end - you want to clamp the differential signal to a few volts and common-mode
to a few hundred (VDRs and TVSs?) to handle lightning-induced and other large pulses I think.
It needs some common connection or there is nothing to
limit the common mode voltage. You are not isolated by a transformer!
Using Earth as that common mode level is fine as long as you
are not using it in an lightning prone area.
If so, one end or the other should be isolated with opto couplers
and an isolated supply( or even both ). The isolated side should be connected
to the shield as its ground.
I've also used such when one end had 5Hp motors that were turning on
and off with no loss of data.
You have to consider the noise environment.
Dwight
I have been using RS485 over CAT5 on my project(s), it is not a conventional use, e.g. it has full duplex RX and TX pairs, and additionally sends the DTR signal that resets an AVR device over a pair. I am working on setting up the DTR pair as a half-duplex bus management system (but I'm not there yet). Finally, one pair is used as a ground line. At present I can upload a sketch to a single powered up AVR board in my back yard with the Arduino IDE, I am hoping to daisy chain a number of boards while retaining the ability to upload firmware with Optiboot and the Arduino IDE.
I used a common ground, because it is my understanding that the differential pair signal must remain within the common mode range of all differential receivers (-7V thru +12V if memory serves), and I am not sure how to ensure that without a common ground. In addition to the CAT5 pair, a 14AWG ground wire was run to the ground system on my house. It is located near the meter and electrical panel. This heavy wire will survive a lightning strike (well that's the theory anyway), and may help limit the damage to the AVR board(s) and computer connected (though I'm expecting everything would get fried). There could be a ground loop in between the 14AWG wire and the CAT5, but I don't connect the 0V (CAT5) reference (e.g. battery negative) to the chassis only the 14AWG (the battery is also charged with an offline supply).
The board in the following link is still a work in progress but may help explain what I have been describing.
http://epccs.org/indexes/Board/RPUadpt/ (http://epccs.org/indexes/Board/RPUadpt/)
The system I did had a few repeaters and over 50 uP boards connected.
It was a single pair and everything was done with a simple hand shaking protocol.
It could detect within a second when any system was powered down
and did a periodic check of systems to determine power and run status .
I don't recall who's chips I used.
There was only one master and all waited until invited to send.
Like I says, there were a number of high power blowers.
It replaced a RS232 system that was so unreliable that it had to be
shut down when blower were turned on an off as well has a rats nest of wires
and drivers.
I still isolated at each machine ( with blower on each ).
Dwight
@ron_sutherland: Very interesting work indeed!
Looking at your schematic, I was wondering if you have considered biasing the RS485 lines with say 100k resistors to +ve and GND respectively for improved noise performance? And termination impedance matching shouldn't it be 120 Ohm (as opposed to 100) ?
I think the bias resistors @Watcher is talking about are for fail-safe, which will cause the receivers to see a logic high if no-one is driving the bus. However, Analog Devices and Intersil (which is what I am using) have a more tightly defined receiver threshold level. This allows doing away with the fail-safe bias resistors. There was an article in EDN some years back about this, it basically said the AD devices (at -40mV) don't have enough margin but the Intersil (at -50mV) were right on the edge to ensure fail-safe operation in a typically noisy environment. So to some it up these Intersil chips (all of them on the bus) will see an undriven bus as a logic high (and have 50mV of margin), and thus have no need for the bias resistors.
I'm using CAT5 which has 100 Ohm impedance. Many RS485 cables are 120 Ohm and have a little less copper loss so they can run 1200 meters, CAT5 probably won't go as far.
Thanks for the clarification ron_sutherland.
I ve only been using maxim chips so far for RS485, including the fail safe version.