I2C with 5 Masters and 1 Slave in a Star topology over 50' distance

Hello world,

I am new to Arduino. I just finished about 12 micro projects in a Vilros Arduino kit and now am on to my first real solution!

I have a home project I'm currently designing using I2C with 5 Masters (Arduino Unos) and 1 Slave (Arduino Due). They will be connected using a kind of a star topology; I was thinking of combing all the wires from the Masters at a point near the Slave where it can connect to them. Because they could be about 50' or so between the Masters and the Slave, I was reading I should use one PCA9600 chip per micro-controller.

For power, I was thinking of giving each of the six micro-controllers their own 9V 1A wall wort transformer. The Masters will only have a few low-voltage sensors driven from each of them and the Slave will control loads via a relay module.

If this all sounds practical so far, my question is what type of cables can I use to accomplish this? Can I use the data twisted pair of a CAT5 cable for the SDA and SCL? Can I use a single 16 gauge wire for the shared ground, or can this also be a wire (or bridged multiple wires) within the CAT5 cable too?

Thank you in advance for any guidance.

Because they could be about 50' or so between the Masters and the Slave

50 what meter, cm , km ...
Are you aware of the I2C distance limitations?

No, not 50 Whatt per meter.
I think 50 feet, about 15 meters.

I see wires everywhere. What about a wirless tranceiver modules. NRF24L01+ or CC1101.
Or if you want something better and maximum reliability, the XBee modules.

The I2C bus is designed to be use on a pcb board, for example inside a TV. Only one Master is allowed, one Master that controls the bus.

If you want to transfer data over some distance, use RS-485. That is perfect for twisted pair CAT5 cable.

Using wireless modules will be cheaper, and it will be easier to add new modules.

50 feet is what I'm trying to accomplish.

The I2C spec on p. 8 says it can support a multi-master configuration.
http://www.nxp.com/documents/user_manual/UM10204.pdf

Also, the PCA9600 chip spec, says it can achieve 1 MHz operation on up to 20 meters on I2C.

I would also prefer not to go wireless.

RS-485 looks promising. It seems, like I2C, that it also requires 2 wires and a ground but can go much longer distance (1.2 km). I will take a deeper look into RS-485 as a possible solution, but everything I've read points to I2C being an option too.

Philips / NXP can say whatever they want, the I2C bus is not a multi-master bus :smiling_imp:

A Master can also be a Slave without any pain. But a Slave can only become a Master when the I2C bus is not used. When two devices decide to become Master at the same time, there will be a collision and the I2C bus is not designed to handle every possible collision.

It means that one Master should tell the Slaves when they can become Master and for how long.
A typical use is when the Master tells a Slave "give me data", and the Master let the Slave temporarily become a Master to transfers data to the (Slave part of the) Master. After a while the Master checks if the data has arrived, because that data was received in interrupts while the Master was doing other things.

The PCA9600 is an awesome chip, no doubt about that. The chip actually converts the I2C to a RX and TX bus for twisted pair cables. So it actually converts I2C to some kind of RS-485. Why use a dedicated chip like that, when you can use the real thing (RS-485). There are many good chips for RS-485.
The RS-485 has been around for a long time and is special designed for data along (CAT5) twisted pair cables. It is standard, straightforward and it will work.

Thanks for the great info. RS-485 sounds more applicable; I think I will go that route.

I see that I can buy the MAX485 chips within the US, so I won't have to wait a month to get them from China.
http://www.ebay.com/itm/MAX485-RS-485-Interface-IC-10-pack-/171233115016?pt=LH_DefaultDomain_0&hash=item27de49fb88

But I'm wondering, can you tell me what is gained by going with a RS-485 module such as below?
http://www.amazon.com/MAX485-RS485-Module-RS-485-Development/dp/B00FHG1QC8/ref=sr_1_1?ie=UTF8&qid=1419817715&sr=8-1&keywords=max485

Besides the MAX485 chip, from what I can see there is about 7 resistors and a capacitor also on board this module. So I'm not sure if I go with the MAX485 chip only, if I will have to also put in place all these other components to get RS-485 working?

Finally, I'm getting that I will be able to use a twisted pair on a CAT5e cable for the RS-485 communications, which is cool. Can you please recommend what would be a good choice to use for a shared ground over a distance of about 50 feet?

You can get any component in the US - forget e-bay, and buy from the big US distributors: digikey.com, mouser.com, less used avnet.com, arrow.com.
Smaller resellers dipmicro.com, taydaelectronics.com
See the datasheet for some typical connections & terminations. Don't forget a 0.1uF cap from Vcc to Gnd on each chip.

The PCA9600 chip looks very nice, not seen before.

The problem with going the RS485 route is that the inputs and outputs to these will [I assume] be the RS232 Rx,Tx pins. So, 2 potential problems here, one is that with RS485 you can only do half-duplex [yes?], so will need a fair amount of overhead to determine who does what and when. And secondly, UNOs only have a single h.w. UART, so either you have to use SoftSerial, which isn't all that great, or else eat the 1 h.w. UART, which is always a pain to lose.

So, it might be better to stick with I2C, if using UNOs.

If you need more distance and/or decide to go wireless, try these - in fact you get the UNO chip thrown in for less than 1/2 the cost of a regular UNO.
LowPowerLab Store?route=moteino-r4
https://lowpowerlab.com/shop/

Here is a schematic of that module in the download tab : http://imall.iteadstudio.com/max485-module.html
It uses 120 ohm between the wires and 20k to to 5V and GND for a bias to keep them apart.
I'm not sure if every node should have that 120 ohm when connected in a star. I thought that a RS-485 star network is normal, but now I'm reading that it is not. Only a long line with devices along that line is normal. And the line should have the resistor at the beginning and at the end, not at every node.

You have to know how to use the Serial port before using RS-485.
The Arduino Leonardo or Micro has a spare hardware serial port. The Arduino Mega 2560 has 3 spare hardware serial ports.
Also SoftwareSerial is possible.

These should help with your network wiring also.

AN723 RS485 fail safe terminations.pdf (155 KB)

AN763 RS485 termination.pdf (234 KB)