CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RS485 Implementing a Daisy-chain

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

RS485 Implementing a Daisy-chain
PostPosted: Fri Feb 24, 2012 9:34 am     Reply with quote

I'm diving into RS485 for the first time and I've read many of the posts here on CCS and spent time Googling as well. I've come up with some questions that I haven't been able to answer and thought the vast experience here might be able to point me in the right direction.

First, I'm not sure whether RS485 is necessarily the correct answer for my situation, but it appears to be the most robust and ubiquitous of the options.

The planned configuration is one master, many slaves (20ish max), distances initially less than a couple of meters total, but could grow to tens of meters, not necessarily a terribly noisy environment but here will possibly be some high current PWM happening on the slaves and not large amounts of data being moved, mostly just commands from master to slaves.

My unanswered questions so far are:

1. Interconnecting each slave in a daisy-chain: would a pair of RJ45 connectors be a satisfactory solution? The goal is to allow the end user to simply add another slave by plugging in another cable into the last unit.

2. Ground loops and reference for the RS485: There may be multiple power supplies in the network and I'm trying to figure out grounding. Won't the ground(ref) that is run with the A & B wires end up creating a large loop problem?

Thanks for your time and ideas,

John
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Fri Feb 24, 2012 10:03 am     Reply with quote

Yes.
Opto-couple the RS485 drivers if you want really good reliability, and the devices may be on different supplies.
Remember the need to bias the rails to the 'off' state when not being driven.
Depending on the data rate you intend to use, you may need to have termination at each 'end' of the bus. Consider a plug in terminator that goes into the last RJ45, makes it simple to move, no jumpers involved, and easy to remember.
Twisted pair cable.

Best Wishes
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri Feb 24, 2012 1:50 pm     Reply with quote

Don't discount CAN. With RS485 you have to take care of bus contention manually (not really a problem if each slave only replies to the master when it is commanded to), but CAN takes care of that in hardware....you never have to worry about it.

Regarding interference, I have direct experience with an automated welding system with 4 welders, each @ 130-250A, and the welding leads running alongside the CAN cable for 60'. No interference issues.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: RS485 Implementing a Daisy-chain
PostPosted: Fri Feb 24, 2012 6:40 pm     Reply with quote

jecottrell wrote:

1. Interconnecting each slave in a daisy-chain: would a pair of RJ45 connectors be a satisfactory solution?


I use this method
Quote:

2. Ground loops and reference for the RS485: There may be multiple power supplies in the network and I'm trying to figure out grounding. Won't the ground(ref) that is run with the A & B wires end up creating a large loop problem?


In my typical deployment the slaves are powered from the master with power and ground supplied via the same cable. In this deployments the slaves do not control large currents directly by may indirectly via relays however there is no coupling between the power systems of the PICs and devices being controlled. As such, ground loops have not been an issue.

In other cases where the remote PICs are individually powered I connect the RS485 signal ground (from the cable) to the power supply ground of the remote PIC via a 10 ohm resistor. These 10 ohm resistors are present at the slaves and the master. I have not had any earth loop issues with this configuration.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Sat Feb 25, 2012 9:01 am     Reply with quote

RS-485 drivers and receivers are designed to work with common-mode variations--usually grounds that aren't consistent. You'd need to be in a pretty unusual environment to run into problems with only a couple of meters of cable.

A lot of systems with a master and slaves end up with two data channels (i.e. 4 wires), one channel for the master to talk to the slaves, and one for the slaves to respond. There are various schemes to make sure the slaves talk one at a time, but the master can always send out messages.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat Feb 25, 2012 9:26 am     Reply with quote

John P wrote:
A lot of systems with a master and slaves end up with two data channels (i.e. 4 wires), one channel for the master to talk to the slaves, and one for the slaves to respond.


That is RS422
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Feb 25, 2012 10:03 am     Reply with quote

RS-485 seems to be the 'defacto' standard for halfduplex,multidrop communications these days, though there are other methods.
One problem,though not unique to it, can be loss of communiction due to wire breakage( one of the 'petals' dies).
There are solutions to this, one I've used for 20+ years up to 15 miles one way trip.
Just something to be aware of.You should have some slave code 'incase of failure to communiate'.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Feb 25, 2012 11:49 am     Reply with quote

Quote:

1. Interconnecting each slave in a daisy-chain: would a pair of RJ45 connectors be a satisfactory solution? The goal is to allow the end user to simply add another slave by plugging in another cable into the last unit.

RS485 seems to be a good solution. If you are going to use RJ45 connectors you can use one pair to DC power the n slaves along the net. With this, you can get a full duplex communication + power using the shielded cable (and cheap) Cat 5 and RJ45 connectors.

Quote:

2. Ground loops and reference for the RS485: There may be multiple power supplies in the network and I'm trying to figure out grounding. Won't the ground(ref) that is run with the A & B wires end up creating a large loop problem?

As suggested, a unique power supply is required. Use a common RS485 GND signal common line wired through 10-100 Ohm to DC power GND in each slave board and in the master. I have not had any GND loop issues with this configuration in an industrial enviroment.
A good code to manage all the communications issue and with the capacity to know the integrity of the whole system is a must.

Humberto
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Sun Feb 26, 2012 12:13 am     Reply with quote

asmallri wrote:

That is RS422


Actually I think what I suggested should be called "RS-422 out and RS-485 back". The outgoing data channel has only one transmitter which is always on, so it's RS-422, though it has multiple listeners. The returning data is RS-485 because it has multiple transmitters which must be enabled one at a time, even though there is only one listener.

The advantage of this scheme is that it's full-duplex as far as the master is concerned, and if the master is a computer, as it often is, then it can allow incoming data to collect in a buffer while outgoing data can be sent at any time. There's no need to coordinate the timing of the incoming and outgoing lines. But designing these things always involves judgment calls over which feature you want to make easiest to implement.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group