multiple serial communications and rgb leds

Hey guys. Here's a challenge. For a project at my university we are designing an interactive lounge environment. One of our main components consists of several nodes. Each node (4 in total) can connect to a node of another object with a magnetic connection Each object is the home of an arduino pro mini.

This is where it gets tricky. Every node has an rgb led and every led can have a different color. This color is based on the state all the connected objects. This is to create 'behaviours' in a networdk of connected objects. My question is how we can do this best communicationwise. I have thought of a solution that uses serial connections between objects. This means that every arduino has 4 serial connection and we need 8 pins for that. Add the 12 (pwm) pins we need for the rgbleds -> we do not have enough pins. That is, we do have enough if we can use all the analog input pins as digital outputs and all the other pins as well which would bring us to a total of 20 (just enough) pins.

But maybe their is an even better solution which I am not thinking of. One of the behaviours we want to achieve (hence the serial and not a bus) is the folllowing: We have a network ob objects in a string connected. The leftmost one has a blue color and the rightmost one has a yellow collor. All the object in between will form a gradient from blue to yellow (e.g. the middle one will be green). If this can be done other than using serial (less pins) I would be very, very interested in hearing so.

Use the 1 wire bus protocol. Have four 1 wire buses per node. Then you can communicate between them to find out positions. Each node needs to be a multi master configuration with collision avoiding algorithms.

The software for this is tricky but perfectly doable, I remember reading a paper for such a system in an academic journal way back in the 70s. However, that bit needs planning quite carefully as it is not trivial. In involves relaying information from the other devices as to what they are connected to. The only snag is that if a node finds itself at an end it doesn't know what end it is at so doesn't know what colour to set itself to. Both ends could make the same decision.

Wow, that does look difficult. Do you have some pointers or examples I can look at? Because there seem to be several different libraries for this.

I said it was not easy. Some links I have found:-

Try googling these words:- topology self mapping networks

You might have a look for "Luminet" on this site or google it. It's a network of avr processors that communicate with each other and can propogate programs (they call it "programming by infection").

Some of the ideas and protocols might fit your project.

I had an other thought over night about the physical communications between the devices. Why not use inductive coupling in a half duplex manor. Basically drive the coils with a high frequency by modifying the PWM frequency and amplitude modulate it with data from the serial port. You can use an output multiplexer to switch the signal to each of your nodes. On the receive side you simply amplify what is coming from the coil and demodulate it with a diode. Again a multiplexer determines what node you are looking at. The baud rate should be low and the messages repeated a few times to allow the receiver to lock on to the correct channel. That way you don't have to have two physical connection on each node.

It has been a while since I posted my question and we looked through all the offered solutions. In the end we chose to do it differently. We are using the serial connection of the arduino. The Tx goes to all four nodes in parallel and the Rx is multiplexed. This actually works very well. We are setting up some prototypes with custom made pcb's for the connection rings. If they are done I'll make some pictures and post a link to the blog with an extensive explanation on how it works. Thanks for all the help!