Connection multiple arduinos via RS485

Does anyone have some shematic how to connect multiple arduinos using rs485 protocol.I want to connect 4 arduinos but I cant find a very good example how can I use max485

Hello Nick thanks for your answer. I that shematic there are just a master and a slave, it is a start point to me but I need 4 arduinos, can I just hook it on the same line A B using the same circuit?
Doesn't I need to add a terminator resistor on the last one?

I can't believe you couldn't find a 100 examples with google.

No matter how many nodes you have on a multi-drop bus all As connect together and all Bs connect together. You should have 120R terminating resistors at each end of the bus as well (if the speeds are high). Also failsafe resistors can be added as Nick shows but most modern transceivers have this feature inbuilt.

What speed and distance will you have?

rs485 protocol

RS-485 is not a protocol, it's an electrical specification. You will have to design and write your own protocol. This will either be easy or very difficult depending on the robustness you need.


Rob

The speed I will use is 9600 bps and the distance will be approximately 150 meters between each arduino.Thanks for you well explanation about rs485, I will study more precise the implementation of it

If you only want to connect 4 Arduinos, what about using I2C?

I am sure there are many reasons not to us I2C, distance being one of them but if it will work, it is cheap and easy.

Maxim has a good application note on doing what you want with RS485 and some chip suggesions for doing it.

I2C

150 meters

Not normally possible although there are driver chips that may make it although I think 50m is about their limit.

In short RS-485 is made for this, may as well us it.

@HugoPT
You don't necessarily have to address each Arduino, you can use a publish/subscribe model whereby you send all data to the network (with a "data type" identifier) and each Arduino uses what it wants.


Rob

My bad. The distance was not in the original description of the problem and I did not pick up on the distance in the later post.

Anyone running other protocols on top of RS485??

This is interesting: Tinkering with Electronics...: Arduino and RS485 (ENGLISH VERSION)

I am probably going to work on implementing this with these: http://goo.gl/S1lFR

I understand RS-485 needs a common ground (that the differential is related to).. Can this just be "local Green Ground" in a few different rooms? Buildings? Or does the wiring have to include 1 or more ground conductors?

Anyone using CAT5 for this? 2-pair telephone wire?

DISCLAIMER: Mentioned stuff from my own shop...

I understand RS-485 needs a common ground (that the differential is related to)

Is this really true?
From what I had read the rs-485 just need 2 wires A and B.The ground is just in case we use a long link right?
I found this after a brief search

Connecting a multidrop 485 network. The EIA RS-485 Specification labels the data wires "A" and "B", but many manufacturers label their wires "+" and "-". In our experience, the "-" wire should be connected to the "A" line, and the "+" wire to the "B" line. Reversing the polarity will not damage a 485 device, but it will not communicate. This said, the rest is easy: always connect A to A and B to B.

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. Contact B&B Technical Support for more details.

Thanks, Hugo...

I'll have to do some testing when I get this going. I'm mostly interested in running in a house and close by buildings like a barn etc., running from the same AC distribution transformer.

The "Neutral" might bounce a couple of volts with unbalanced loads, but the Green Ground as I've tested it, should be less different than that.

I want to be able to locate a few Arduinos in appropriate locations and coordinate them from one Arduino or a PC.

A friend and I are working on shields for a Mega2560 that would have several ports for Home Automation, including RS-485, X-10 etc.. and another with WiFi and several other RF communications standards (http://davehouston.org/Zarduino.htm - Mega Boards) . But I want to get a simple multi-Arduino RS-485 system running sooner..

Is this really true?

You bet.

The ground is just in case we use a long link right?

Wrong.

does the wiring have to include 1 or more ground conductors?

I'm not completely sure, if there is a common ground connection maybe but no way I would trust a connection via who-knows-what, the "ground" could be several volts different. 485 is very forgiving in this regard (that's one reason it's the default standard) but every system I've every seen uses a ground wire in the cable.

AFAIK two wires will usually work but it's not best practice.

Anyone running other protocols on top of RS485??

I'm working on one now, a ring network of Mega1284s.

Anyone using CAT5 for this?

I'm using cat5/6, I need 4 conductors for signal and that leaves 4 to run power.

But I want to get a simple multi-Arduino RS-485 system running sooner..

I'm designing a PCB for a prototype, my network needs two serial ports per node though hence my use of the 1284s. The plus side is reliability, with a redundant ring network you can cut the wire with no appreciable affect on the traffic.


Rob

Following on from the above, I know everyone uses multi-drop for control networks but I have these issues with that topology

• A single short circuit and the entire network is down.
• A single rogue processor and the entire network is down.
• A cut wire and some or all of the network is down.
• Has to be either master-slave or use difficult bus-clash and arbitration techniques.
• If the master dies the entire network is down.

A redundant-ring network has none of those problems, any of the above faults have little or no effect on the network.
It does however require twice as many wires and does insert delays in the data transmission. As I’m more interested in reliability than absolute speed I’ve decided to use a ring topology, despite spending a lot of time designing a multi-drop version at first.


Rob

Hi Rob,

I know you were working on an earlier one... The process you went thru is helping me understand.

Are you using RS-485 4 -wire (Nodes transmit on 1 pair, receive on the other)?

Years ago I worked on IBM Token Ring networks. After a lot of thrashing about GM MAP, Ethernet etc, we went with Token Ring for a new Semiconductor factory. Worked out well, with multiple levels of rings..

I was always uncomfortable with the concept of MAP as a peer-network. Who's in charge in a big system? I used to say, "You can't get 500 guys and build a bridge when you are all peers". I got yelled at by the Manufacturing Strategy guys at headquarters. But you know what?? MAP died, along with DISCO.

Can you point to any of your current work/ideas??

Are you using RS-485 4 -wire (Nodes transmit on 1 pair, receive on the other)?

Yep.

Yes I spent over a year on and off working on a multi-drop/master-slave protocol then finally dropped it in favour of a redundant-ring/peer-to-peer, so I've had to totally rewrite the design.

In the process I've also slashed maybe 80% of the complexity, I want it to be reliable and have no DIP switches to set addresses etc so it's inevitable that some complexities will occur. But I think it will be fairly simple.

I have a finished schematic for a prototyping board and have started the PCB layout.

The design currently uses a Mega1284 at each node, it's not ready for public consumption yet but I'll email you (and anyone with a real interest) a document.


Rob

Rob,
Is RS422 or RS485 better for a 250Kbyte/sec connection over a 100-125' distance? One master, one slave.
Thinking MAXxxx chip on each end with RJ45 connectors.
Thanks

Just a couple of points of reference. Theater lighting control is considered mission critical by those of us who make our living from it. The defacto standard is DMX, specifically constructed packets send via RS485. In some cases it gets finicky BUT if it is deployed according to standards it is VERY robust. I have seen setups that should not work but do because the protocol and RS485 electrical speck are that robust.

Another project I used it on was for some distributed LED signs. I used some RS485 chips to extend 2 pins out to multiple signs. I was using shift out to drive a hand full of 7 segment LEDs in each sign. My system used 2 max485 at each location. 1 for clock and the other for data. The cabling was cat5 with rj45. 2 PR for clock and data, 1 pr for common/ground, and one other pr was +12V with a regulator at each drop to feed the Maxim chips 5V. So far it has worked very well with up to 3 signs and several hundred feet. Over a dozen installs and growing.

Crossroads,

I've not dealt with 422 but for point-to-point I think it's very similar to 485, one big difference (I think) is that the common-mode voltage levels are lower so it would be slightly more prone to ground offset issues.

As I doubt the price is any different between the transceiver types I'd go with 485.


Rob

Thanks Rob!