Communication options?

I would like to have several arduino’s connected to a “network” that I could receive data from on my pc, aswell as pass data from one to another.
Is that possible, if so what would be the best method?

Well, for connecting multiple Arduino’s, the easiest way and possibly the best way I believe would be i2c. Look at the examples for the Wire library included with Arduino for ideas on how to use it, here’s a link that shows how to talk with 2 Arduino’s, I’ve had 7 working on the same link just to test.

Then you would need 1 of the Arduino’s connected to the computer, most likely the Master. The Master in I2C controls the flow of data, it tells each chip what to do basically. It’s one master and the rest slaves, generally.

You can have multiple masters, but that also adds another level of difficulty. But here’s an example that somebody has setup for using multiple masters. (I haven’t personally)

There are other protocols available, but will require a bit more hardware as well as software work. I believe you could use SPI, and I read somewhere about a Serial network… but can’t recall where.


I think i depends a lot on what distance there will be between the Arduinos.

I2C is as far as i know meant to be used over rather short distances

RS485 is a good contender for a protocol / interface that will work in a bus setup.

thanks for the input.
I was thinking rather long distances, possibly 100ft.
what about zigbee?

what about zigbee?

Or RF? :slight_smile: RF = poor man’s ZigBee (but still effective ;D)!

I would like to ( or in other words, HAVE to :wink: ) keep it cheap though, and xbee seems kinda pricey

I would like to ( or in other words, HAVE to :wink: ) keep it cheap though, and xbee seems kinda pricey

Well, you may want to look into Radio Frequency.

Spark fun has some VERY reasonably priced Transmitters and Receivers.

I suppose you could use multiple receivers, but you probably wouldn’t want to try multiple Transmitters without getting some more complicated code.

RS485 can be made rather cheap, it’s just a single cheap IC to convert the serial from Arduino to the RS485 signals + a couple of resistors.

Also RS485 can handle both half and full duplex.

RS485 can handle much longer distances than 100 feet, but of course it’s not a wireles system, you need a cable, this could be done with ordinary cat 5 network cable.

Here are some links to arduino + RS485 info:


Implementing full duplex where every node can talk to every other node is fairly complex. Because all the nodes share the medium (cable) you would need to implement a collision detection scheme, which is not exactly easy.

Half duplex with one node as a dedicated master that initiates all communication and a bunch of slave nodes that only respond to “calls” from the master is much easier, and requires only 2 wires in the cable. Full duplex requires 4 wires.

Thats sounds excatly what im looking for.
I’ve worked with RS485 quite a bit, but only in a commercial building automation level - i never had to figure out the parts to make the devices.
The way most of my older controllers handle the communication ( which is half duplex 485) the that the " master " holds a token “a virtual point” which allows it to talk - when data is requested from a slave the master sets the “token” on the slave, so that the slave can talk. Once the master receives the reply the master disabled the slave token and is free to broadcast another request.

I dont think it would be terribly hard to recreate that process in this format

That is what Im going for here, a home automation system that would be completely open source yet more flexible than what is currently offered

Ok, I have found several examples of using rs485 for a network, however what I dont understand is how the controllers are addressed.
Could anyone shed some light on that please?

I think what I have decided to “try” to make is a shield that incorporates the 485 communication, 4 relays, and a terminal block to connect some inputs ( digital, thermistor, and hopefully a 4-20ma or two)
The arduino’s would only act as slave IO with all the logic being preformed by a python application on a PC.
This way the system could be used in several different applications.
Im kinda surprised that a similar shield doesnt exist

actually this is very close to what I want…
would prefer less relays and more inputs.

The RS485 specification is only the definition of the “electric level”

How you addres units and how you exchange information between them is up to you to implement.

The usual way to do it is simply to let each unit have a one byte addres.

this could be defined in the software, or you could do it with a 4 (or bigger) position dip switch hooked up to some digital pins on Arduino.

A good example can be found here:

Another way is to check one of the “real” implementations like Modbus, good introduction here:

And here is something interesting i found:

A port of FreeModbus for AVR micros, especially atmega168 :slight_smile:

Not much info though.