can i talk to multiple arduinos at the same time with another arduino, serial?

Hello all,

I am trying to talk to multiple (say 4) microcontrollers (Arduinos) at the same time. I was wondering if i can setup a serial connection, with a selection line that can detect the neighbor Arduino and enable the corresponding pin to start the serial communication between the two. something like this:

It is possible to daisy-chain the serial communication. But if one is removed, the rest of the chain is no longer connected.
Or you could start a few SoftwareSerial ports on the central unit, and communicate with the other modules one by one.
If you use an Arduino Mega a central unit, the three spare hardware serial ports can be used to communicate with three other Arduino boards.

A central Arduino with a few others is typically a I2C bus. However, it is not possible to add and remove modules runtime.

Can you tell what the project is about ?
Should modules be able to connect and disconnect during runtime ?
How long are the wires ?
Should there be a single bus, or is it okay to use seperate pins for each module ? With the Arduino Mega 2560 there are many pins to communicate with many modules.
Are all Arduino boards equal ? or is there a central unit, a 'Master', that controls everythings ?

Sure! thank you for your interest.

The project is about a swarm of sensory systems: hence i need to be able to interchange the central Arduino with any of the surrounding ones. As a result for this matter too it is not possible for me to use I2C as it is a Master/Slave based protocol.

Absolutely! they need to be able to be detached/attached to the swarm at run-time. However they will only be powered when connected to the swarm. So by connecting a new one to the family it is going to go ON and send sensory information about itself to a base unit through the swarm.

All the Arduinos in the swarm are equal (Arduino Micro, I was hoping).
I appreciate your advice.
Karim.

not possible for me to use I2C as it is a Master/Slave based protocol.

But in I2C anyone can be the master - whomever pulls the clock line low and starts sending is the next master of the bus.

However, it is not possible to add and remove modules runtime.

Why not? All devices are connected in parallel - if a card is pulled, it's wires are still in place, so everyone else can still communicate, Usually special IO pins are used such that re-inserting a card ensures that Gnd is connected first, then power before or at the time as signals.

OP describes a "swarm" though - I2C can get dicey with large numbers of devices connected, and usually a swarm is dispersed over an area. Though I remember reading somewhere a mention of a commercial operation that used something like 300 baud on the I2C bus in order to make it work with long wires and lots of devices. Don't have the reference though.

What length of wire would be involved?

How about rs485? Supports 1 bus, its like uart but with many nodes.