OK all good points...
Length...
Now I haven't tried any of this so perhaps I am just buying into hype but I have found at least two chips, recommend by other folks, that the data sheets claim will operate over 20-50m of cat 5.
Looking at the datasheets it isn't quite that simple, the driver offering 50m is not isolating the bus capacitance, but uses beefed up active pulups with current sensor circuitry. This would mean that the entire circuit, all bus legs, has to be 50m or less
However there is another family of chip that uses level offsets to prevent latching of bi-directional buffers which does provide isolation, meaning each leg could be 20m or more.
HOWEVER I recognise that this constitutes jumping trough hoops and should be avoided if possible.
I am well aware that RS485 vis bullet proof, especially at low speeds, in fact I regularly use standard 1.5mm SWA cable over huge distances without an issue. The longest so far is 1.2km, which I did not expect to work, but it is fine, all be it fine at 9600 baud
Multiple masters...
OK I get that I am bucking the trend but considder...
With home automation even simple stuff you are talking about many devices. Granted you could group some together in a single addressable node, which I will, switch plates, output units and the like but still, many
If I go with a single master then one device carries the logic, the relationship between inputs' events and actions, for the entire system. If that master fails everything has failed.
In my case the wind turbine would shut down the solar charger would back off and the generator would fail to start.
Not good when you dont have a grid, and of course there would be no lights so I could see to fix it.
OK I appriciate that some of the systems could continue in some form of fallback mode and my world wouldnt end but the whole point of intigrated systems is to well, intigrated.
In a classic master slave architecture the master would have to ask everything in turn if it had any new data and then act on it, commanding output devices to do whatever was required. that could be several devices all of which would be sent simmilar if not identical commands
What I need is a way for everything on the bus to be aware of everything else with something to say, hence broadcast.
(I didnt know about I2C address 0 when I asked.)
Essentally every message would be a broardcast, some in resonce to physical input, a button press for example and some in responce to events such as confirming a command.
Of course to do that, without a single device looking after the scheduling, there has to be some strategy to either schedule who can talk or detect when there is a conflict, probably both, and it has to be a distributed solution.
Is I2C the right choice, possibly not but then neither is 485 at least not without significant work.
I2C, even using wire, should cope with conflicts if I avoid restarts and handle resending at a high level when a send has failed.
Nick Gammon Has done a load of work on this and even has code to fix, well almost, TWI.c
I note he describes code that allows a master to also listen for broardcasts or packets sent to it so no switching modes as the master is also a slave. (not sure if it would see loopback but I assume so.)
To be honest I am frustrated, part of me wants to start from scratch, hence the origional question.
I am also struggling to believe that there isnt some interface out there that will do what I want without all the mucking about.
So far, and I will be more than happy to take other suggestions, I2C is the best fit, all be it a poor one from a hardware perspective.
The fact that Wire is less than great seems like a poor reason to abandon a protacol with almost all the features I need and hardware solutions for the length problem.
I take all your points, and everyone elses, but so far I havent seen anyone suggest a workable alternative that will do the following...
Power, devices only not lights, over the same cat5 as the data.
unsolicited transmissions from everything, all masters or perhaps more accuratly no masters, just nodes that can talk at will.
I have even wondered about taking the I2C spec, or more likely an exixting soft I2C library and working with that.
For example if the clock and data both used 2 pins each, one to pull down the line driver locally and one to sense the line state then a simple buffer would not latch up since line side signals would not affect the drive state.
This would allow significantly harder pull up and drive current and mitigate some of the electrical limits imposed with a passive high state.
Perhaps this is why all the comertial products I know anything about all use propriatory networks...
How fast can I bit bang, perhaps soft is the way to go, its not lkle the conflict resolution is hard.
Anyone with a better plan, other than just have one master, please feel free to show me how silly I am being by missing something obvious.
Thanks,
Al