Sorry that every now and then I these strange questions about communication.
- I need to make a network of arduinos that will receive data, process it and send it to other output arduinos.
- The destination and origin of the messages is given by wether they are plugged.
- They must allow many inputs and outputs
I have been studying and struggling on how to make a kind of distributed processing environment using arduinos, and of course, the communication protocol is the hardest part. I tried to make my own protocol with a simpler scheme, but I learned that I would need a lot of low level knowledge on AVR and C programming that I don’t have. For the sake of prototype I am thinking to use ready made libraries, but it is not so easy yet:
I describe below what I am trying to do in terms of communication. But an image will make it way easier:
[see attached image]
I mainly need each arduino to have n possible data inputs, and n possible data outputs. The best would be that n is ‘virtually unlimited’, but it will be ok for now if n is just more than 1, in which case I could do a module that forks the stream, effectively making a virtually unlimited amount of outputs (at cost of speed), but that is not well desired.
*The data outputs can all be the same, as the output value will always be the same to all the “children”. However, some “children” may be busy, meaning that perhaps it is easier to keep outputs independent.
The devices are dinamically plugged and unplugged, but they can be already powered then, avoiding hot plugging problems (thanks, grumpy_mike http://forum.arduino.cc/index.php?topic=476989.msg3258658#msg3258658 )
I also need the “network” to be “heterogeneous”, meaning that hopefully it doesn’t need one single master, specially because there are many isolated communication nodes. If I am a node, I know what I am sending to my children node, but I have no idea of what that “children” node is sending to my “grandchildren” node.
If interested, an example application is the one in this video (https://www.youtube.com/watch?v=YdsDUqan77s), only that in hardware, with all the changes that it implies to the idea.
So, a thought solution was that each device (arduino) would use the I2C protocol twice. Each device is both a slave and a master: it is a master to all the devices down, and a slave to all the devices up. Would this work? or will I be wasting my time, as I have been quite some days already?
I know that mega readily does that, but I think it is on the expensive side. Whilst I will try to avoid it, if it is too much of a hassle, I can go for it.
if so, what is the best solution?
Am I dreaming of making a rocket to mars?
[note: I posted the same question in the AVR freaks forum http://www.avrfreaks.net/forum/heterogeneous-common-bus-input-common-bus-output-protocol]