Pages: [1]   Go Down
Author Topic: More than one Slave RS232  (Read 585 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

for a bigger project I need Arduinos to communicate, but I²C seems not to be good for a safe connection, because of the cable length.
Can I connect more than Arduino to the two RS 232 pins?
I know that every Data I send will be transmitted to every Board, but the first Byte could be an adressbyte, so just the right board reads the data and the others ignore it.
Is that possible?
Which other Bussystems for a long cable length with library are available?

Thank you,
Flüpke
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The serial signals on Arduino are not RS-232, that is an electrical spec that specifies voltage levels among other things.

So, apart from that yes you can link several Arduinos on a serial connection, you just have to choose appropriate line drivers and for this sort of thing RS-485 is normally the recommended standard.

With RS-485 you implement a "half duplex" connection, which basically means only one device can talk at a time, so you do what you have been thinking, a master sends a packet to the "network", all slaves read this packet and the addressed slave takes action on it.

Depending on the nature of your application (ie how important the data reliability is) this can be very simple or quite complex.

Quote
long cable length
How long and how fast?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can I use it just like RS 232?
You can use 485 like 232 but not the other way around.

RS-232 is not suitable for a multi-drop bus because you cannot disable the transmitters. That's why RS-485 is popular because the transmitters can be tri-stated to allow others to talk.

Quote
Is there any good tutorial on RS 485?
I haven't looked in the last 20 years so don't really know but did a bit of Googling

http://www.lammertbies.nl/comm/info/RS-485.html
http://www.radio-electronics.com/info/telecommunications_networks/rs485/rs-485-tutorial-basics.php
http://www.bb-europe.com/tech_articles/rs485_basics.asp
http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_contents.asp

I'm not sure these are good but they should give you the idea.

Quote
How does Slave to Master works?
Basically the master asks a slave for information or sends it a command, and the slave provides the information or actions the command.

Usually this is done by sending a "packet" to the bus, this packet has control information such as slave address, data length and a checksum. The slave responds either with data or just an acknowledge so the master knows the data/command was received. The master then moves on to the next slave address and the process repeats until all slaves have had a go. Then the master goes back to the first slave etc etc.

This is called a "protocol" and there are a 1000 variations. AFAIK no (simple) standard exists so you have to write your own protocol. Writing a robust protocol is not a simple job, however something quick and dirty is easily achievable. As this is for a model railway nobody will die if some data is corrupted, that always helps smiley

______
Rob
« Last Edit: July 22, 2011, 09:49:19 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12853
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
for a bigger project I need Arduinos to communicate

More than two Arduinos?
Logged

Calgary, AB
Offline Offline
Newbie
*
Karma: 2
Posts: 46
Arduino Newbie
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Fluepke

Don't throw out IC2 without some investigation.  I plan to use it for distributing a fast clock around the layout at some point.

Design tips for using IC2
http://www.eetimes.com/design/embedded/4025661/Inter-IC-I2C-bus-design-and-test-for-embedded-systems-Part-1

IC2 bus extender to 50 feet
http://www.nxp.com/#/pip/pip=[pip=P82B715]|pp=[t=pip,i=P82B715]

Another possiblity is Onewire
http://www.arduino.cc/playground/Learning/OneWire

Regards  bill
Logged

Don't you just hate ONE D 10 T problems?

Pages: [1]   Go Up
Jump to: