Multi Arduinos/Serial/XBee with Max/MSP?

Is it possible to have multiple Arduinos all talking to the same computer/maxpatch? And if so, does it break if you only have one of them running? I plan on building everything around a screenless/headless mac mini.

More specifically, I'm working on something that will be using an Arduino mega + maxuino to interface with a DIY controller. Then I have a pair of ArduiMUs (http://www.sparkfun.com/products/9956) (which look retired now) connected to a pair of XBees, which will wirelessly connect to an XBee+Xbee Explorer on the computer side. Finally, It would be nice to have a separate Arduino handling some other sensor I/O. All arduinos would be embedded in their specific components, so it would be quite difficult to leach pins off one that's already setup.

The maxuino+mega will speak OSC over serial it seems. The Xbee+Explorer will presumably spit up serial data on the computer side, as would the 4th arduino.

Will all these serial messages play nice? Can I just route them differently in the computer? (I've not done any serial/osc/arduino stuff with max before).
Will the patch work fine if one bit isn't connected? Like if I don't use the Xbee setup, will max and/or the serial communication break? What if I hot swap stuff?
From my, vague, understanding, serial connections are always there and open, so if the Xbee isn't plugged in, max wouldn't care as it would just listen for it anyways (unlike bluetooth which would lose sync I guess).

What I don't know is how each device is identified on the max side. In looking at Maxuino patch, you tell it which device you are using. Can it get married to a specific device (and not be a drop down menu)? Like if I only use the Xbee+explorer and not the mega, will Maxuino hijack that serial connection?

Sorry for the barrage of questions! I did do some searching and googling but didn't find any specific info on running multiple arduinos/serial connections at the same time, and how they play with each other.

Is it possible to have multiple Arduinos all talking to the same computer/maxpatch?

Talking to the same computer? Yes. To the same maxpatch? Depends on whether the patch opens multiple serial ports or a single serial port, with the XBee able to listen to all the Arduinos.

The maxuino+mega will speak OSC over serial it seems. The Xbee+Explorer will presumably spit up serial data on the computer side, as would the 4th arduino.

On different serial ports, I presume. Otherwise, how is the 4th Arduino talking to the PC?

Will all these serial messages play nice?

Depends on how you write the code.

Can I just route them differently in the computer?

You can and you must.

Will the patch work fine if one bit isn't connected?

Depends on how you write the patch, and how you define "work fine".

Like if I don't use the Xbee setup, will max and/or the serial communication break?

If by setup, you mean configuring the XBees, then, no, they won't work. Whether that breaks your patch or not depends on the patch. Serial communication won't work, though. You need to plan for there not being serial data present.

What if I hot swap stuff?

Then, you are a moron. Don't even go there.

From my, vague, understanding, serial connections are always there and open

Wrong.

so if the Xbee isn't plugged in, max wouldn't care as it would just listen for it anyways (unlike bluetooth which would lose sync I guess).

Depends on the patch...

What I don't know is how each device is identified on the max side.

Different serial ports is one way. If multiple XBees are talking to the XBee connected to the PC, you must make sure that each sends some unique ID that max can parse.

Can it get married to a specific device

That's not legal in most states...

Right, I guess I sort of shotgunned a bunch of questions out there.

I have discreet, arduino-based devices that I'm building, that would be communicating with discreet parts of the patch/code. The xbee/wireless thing is one component that would be communicating exclusively to it's part of the code (2 xbees sending data to an xbee explorer connected to the computer).

The arduino mega, likely with maxuino, would be yet another part, connected directly via a usb cable.
Sometimes I would be using everything, sometimes only one component, but ideally, I'd always want the same patch running (since the mac mini would be configured/scripted to open up the one patch). When I don't have the specific component plugged in, I wouldn't be using that part of the patch (each component would be a different 'instrument' in that way).

When you say serial ports, are there multiple ports available (noob question I guess)? Like MIDI channels or something?

Oh, does all this serial stuff work like MIDI, just being able to listen to the different ports from different parts of the code?

With the hotswap thing I meant more specifically if the xbees lose power/connection, will the xbee explorer (and computer) be ok with that (depending on code) or does that lock up all serial communication?
And if I don't use the xbee explorer (or xbees at all) that just a regular arduino mega can still talk to the part of the patch it normally does.
Like do the serial ports and/or devices have fixed names/values/addresses that don't change based on the order they are plugged in or are there. (like using only the mega one day, then the xbee the next day, then both the following day).

When you say serial ports, are there multiple ports available (noob question I guess)?

Yes. When you plug the Arduino in, it is connected to one serial port. When you connect the USB Explorer in, it is connected to another serial port.

Oh, does all this serial stuff work like MIDI, just being able to listen to the different ports from different parts of the code?

I've never use MAX/MSP, but, I presume it can listed to multiple serial ports as easily as one.

With the hotswap thing I meant more specifically if the xbees lose power/connection, will the xbee explorer (and computer) be ok with that (depending on code) or does that lock up all serial communication?

The XBee on the explorer will have no idea why the remote XBee hasn't sent any data lately. It could be because that remote device was powered off, or because it moved out of range, or because the remote device simply has nothing to say.

As long as you determine that there is serial data to read, before trying to read it, the lack of data won't be a problem.

And if I don't use the xbee explorer (or xbees at all) that just a regular arduino mega can still talk to the part of the patch it normally does.

Yes.

Like do the serial ports and/or devices have fixed names/values/addresses that don't change based on the order they are plugged in or are there. (like using only the mega one day, then the xbee the next day, then both the following day).

Sadly, no. Each time a device is connected, it gets the next available name.

Ok that makes a lot more sense. How does it name items if they are all plugged in at startup? (More specifically, does it do it consistently)

How does it name items if they are all plugged in at startup? (More specifically, does it do it consistently)

The "it" that names serial ports, and assigns one to a device is the operating system. How it names them depends on the operating system.

The USB ports have addresses. Whether anything is connected to a USB port, or not, and whether that device needs a serial port defined, should be done the same every time the PC starts, because the ports should be checked in the same order every time. The only way to know for certain is to test it.

Perfect, thanks for your help.