Portugal
Offline
God Member
Karma: 9
Posts: 753
Tomorrow I will know a BIT more than yesterday
|
 |
« on: May 14, 2012, 06:16:48 am » |
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
|
|
|
|
|
Logged
|
Debian,Mint,Ubuntu Arduino Mega 2560 Arduino Nano Arduino Duemilanove MAC OS Montain Lion Raspberry PI Model B
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #1 on: May 14, 2012, 06:29:53 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Portugal
Offline
God Member
Karma: 9
Posts: 753
Tomorrow I will know a BIT more than yesterday
|
 |
« Reply #2 on: May 14, 2012, 06:37:34 am » |
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?
|
|
|
|
|
Logged
|
Debian,Mint,Ubuntu Arduino Mega 2560 Arduino Nano Arduino Duemilanove MAC OS Montain Lion Raspberry PI Model B
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #3 on: May 14, 2012, 08:18:45 am » |
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
|
|
|
|
« Last Edit: May 14, 2012, 08:23:10 am by Graynomad »
|
Logged
|
|
|
|
|
Portugal
Offline
God Member
Karma: 9
Posts: 753
Tomorrow I will know a BIT more than yesterday
|
 |
« Reply #4 on: May 14, 2012, 09:32:43 am » |
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
|
|
|
|
|
Logged
|
Debian,Mint,Ubuntu Arduino Mega 2560 Arduino Nano Arduino Duemilanove MAC OS Montain Lion Raspberry PI Model B
|
|
|
|
Offline
Sr. Member
Karma: 0
Posts: 275
|
 |
« Reply #5 on: May 14, 2012, 01:07:03 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 247
Posts: 16526
Available for Design & Build services
|
 |
« Reply #6 on: May 14, 2012, 02:06:13 pm » |
Maxim has a good application note on doing what you want with RS485 and some chip suggesions for doing it. http://www.maxim-ic.com/app-notes/index.mvp/id/723
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #7 on: May 14, 2012, 05:17:22 pm » |
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
|
|
|
|
« Last Edit: May 14, 2012, 05:21:13 pm by Graynomad »
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 0
Posts: 275
|
 |
« Reply #8 on: May 14, 2012, 05:44:58 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Topsham, Vermont USA
Offline
Edison Member
Karma: 11
Posts: 1357
... in The Woods In Vermont
|
 |
« Reply #9 on: May 15, 2012, 03:55:24 am » |
Anyone running other protocols on top of RS485?? This is interesting: http://real2electronics.blogspot.it/2009/09/arduino-and-rs485-english-version.html 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...
|
|
|
|
|
Logged
|
|
|
|
|
Portugal
Offline
God Member
Karma: 9
Posts: 753
Tomorrow I will know a BIT more than yesterday
|
 |
« Reply #10 on: May 15, 2012, 06:04:16 am » |
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.
|
|
|
|
« Last Edit: May 15, 2012, 06:15:27 am by HugoPT »
|
Logged
|
Debian,Mint,Ubuntu Arduino Mega 2560 Arduino Nano Arduino Duemilanove MAC OS Montain Lion Raspberry PI Model B
|
|
|
|
Topsham, Vermont USA
Offline
Edison Member
Karma: 11
Posts: 1357
... in The Woods In Vermont
|
 |
« Reply #11 on: May 15, 2012, 06:46:39 am » |
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..
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #12 on: May 15, 2012, 06:50:07 am » |
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
|
|
|
|
« Last Edit: May 15, 2012, 07:03:51 am by Graynomad »
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6824
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #13 on: May 15, 2012, 07:31:56 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Topsham, Vermont USA
Offline
Edison Member
Karma: 11
Posts: 1357
... in The Woods In Vermont
|
 |
« Reply #14 on: May 15, 2012, 07:59:10 am » |
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??
|
|
|
|
|
Logged
|
|
|
|
|
|