Xbee communication beteween MAX and arduino using firmata


I was wondering if any of you had problems to communicate between (using Xbee series 2) Arduino and MAX/Msp?

I am currently using the ‘maxuino 007’ patch to communicate between arduino (using the standard firmata), as is the only one I found that is able to control both inputs and outputs and both analog and digital at the same time.
Maxuino and firmata are working by default on 57600b.

The communication between Max and Arduino has not problem, but when I am trying to use xbee series 2, I cannot make it work.
(I am using an arduino xbee shield and a xbee usb adaptor)

I been doing the below series of tests:
(I use different documentation to be able to configure the xbee modules in different bauds and as router / receiver)

  1. Communication arduino to arduino app (simple serial.print words) at 9600b works without problem
  2. Communication arduino to arduino app (simple serial.print words) at 57600b works the connection but is given me back strange letters instead of the original message.
  3. Communication arduino (simple serial.print words) and Max (serial.print reader) at 9600b works. At 57600b gives as well strange letters.
  4. Change the baud rate on both Max Maxuino patch and firmata to 9600b doesn’t work.

I suppose that the problem is that at 57600b the maxuino patch receives strange letters instead of ‘0-1’ to digital and numeric values for analog.

Any clue?

Thanks very much.


What firmare versions are being used on your xbee modules?

ok did u /any1 get this to work…its really frustrating me…and i reallly need this to work…

ive tried everything…

arduino to computer ok… it just doesnt work with xbees…

ive tried using all this and still no joy

im using the same setup configuring in xctu and then using maxuino on my mac…

Please help… i need this done like yesterday
thank you in advance of any response…

if any does get this to work a screen shot of xctu in both coodinator and router/end device would be great…

The v1x47.

Btw, I have been using a pc to be able to change the bauds trough the x-ctu, but actually all my test and the Max patch is running in a mac (OS X 10.6). I suppose it is not a problem, but just in case could help.


As long as the BD parameter (baud) speed of the ZNet 2.5 module matches the baud rate of the serial interface attached to it, you should get clean communication.

I didn’t see any mention of the BD parameter being changed to match the Arduino or Maxuino, so I’m venturing a guess that this is the problem.


I already changed the BD from the X-CTU and having everything at 57600 (Maxuino - Firmata and both Xbee) but something still working wrong.

At the moment I manage to connect with maxuino but after a few seconds it stop communication and start again.
For example I tried a simple exercise of blinking a led:

  • if I switch it on and off with a long intervals (1.5 seconds) it works.
  • if I switch it on and off with short intervals (for example half second or less), the led blinks 3-4 times and after that it doesn’t response until around 4 seconds.
  • if I blink the led with a metro 250ms, doesn’t work at all.


“Strange letters” always sounds like a baud rate problem. Let’s see whether I understand the setup:

  1. You have an Arduino connected serially to an XBee
  2. A second XBee relays the communication to a Mac.
  3. You want each serial link to be running at 57600 baud.

The possible problem is the connection between the second XBee and the Mac. The Mac will support 57600 baud exactly, but the XBee with its 16MHz clock cannot. The best it can do is a rate of 58824 baud, which means it’s transmitting 2.12% faster than the Mac is expecting.

Normally people report reliable communication in this case. Still, I’m wondering whether the rate of transmission of characters is enough to cause a problem here.

Since at this baud rate the XBee is the faster transmitter, you could try slowing it down a bit by setting it to transmit two stop bits instead of the default one bit. To do that, send ATNB=3. The documentation says this sets mark parity, which is equivalent to two stop bits.

There’s no need to do anything at the Arduino end of things. If I understand correctly the Arduino also has a 16MHz clock so it and its XBee will be communicating quite happily at 58824 baud.


I am experiencing something VERY similar. Did you end up finding out what was going on?

More details on my setup to follow soon…


OK, so it seems this might be some sort of buffer/overrun error.

When the Arduino is connected directly to the computer via usb cable there are no issues.

When the Arduino is connected though a Xbee setup to the computer there can be periodic (frustrating) Arduino reboots. If I put a delay in the Firmata code for each cycle I have more robust behavior.