Dual XBee

Radio Setup

Why use a dual radio setup

The standard R2 Touch/MarcDuino installation requires a single WiFi radio on the Marcduino side, and uses the built-in iPhone WiFi to connect to it. The major advantage of this is simplicity and ease of use. However, when the WiFi space becomes very polluted, such as in large conventions, you can run into connection reliability problems. A more advanced and robust alternative is to use a dedicated Xbee to Xbee link, as described here. It uses an external XBee radio connected to the iPhone instead of the iPhone WiFi. The external radio is much more powerful and linked uniquely to your R2, providing a very robust link. I have never suffered a disconnection with this setup even at very large and crowded venues. Another major benefit is that you don't need to monkey with the WiFi settings of your phone to connect to your R2. The link is instant-on as soon as you power your R2. There are some downsides though. The setup is far more complex on the transmitter side: you need the external XBee radio, a small interface board, and an external battery to power the interface board and the external radio. Another disadvantage is that you don't get a visual indication on the R2 Touch app when the link is on (there is no "green indicator" in this mode). For this reasons, I strongly recommend to start with the traditional WiFi setup and get it working first, before upgrading to the dual radio setup.

Components needed

You'll need a breakout board to mount for the transmitting XBee, same one that's used on the MarcDuino side:


Although the two radios will connect by default without any programming, it is not secure. You'll need to program them to talk uniquely to each other at the very end of the setup, once you have verified that everything works. For this you need a programming board called an XBee dongle. It's the same one that is used to program the XBee on the MarcDuino side, so you hopefully already have one:


Then you need to pick two of the same XBee radios. Anyone from the Pro range should do , but stay away from the cheaper regular ones, they are not powerful enough for this.

In the US, my favorite is their highest power and highest range 900 MHz XBee S3B, which goes on for miles even with a ridiculously small piece of wire as an antenna:


The 2.4 GHz XBee Pro S2B should work just as well in countries where 900 MHz is unavailable:


Audio Adapter Board

Finally, you need the order or make a small audio adapter interface board. This board connects to the iPhone earplug jack on one side and the XBee transmitter on the other side. You can either order it all made or make one yourself from the instructions below.

Ordering the Audio Adapter Board

The boards are made by user Glyn Harper on the Astromech.net forum. The current run link is:


Making an Audio Adapter Board

Follow this link to get the DIY instructions for making the adapter board

Audio Adapter Board DIY Instructions

3.5mm Male to Male Cable

You'll need a 3.5 mm audio cable between the iPhone and the input of the adapter board. I like to use 4 wire ones but a 3 wires works just as well. Not posting a link since these come and go, but any 3.5mm stereo (3 wire) or 4 wire audio cable should work.

Connecting and testing the system

Connect the iPhone to the adapter using a 3.5mm stereo audio cable, the XBee GND, VCC and DIN pins to the -, + and S pins on the serial out connector. Power up the adapter (and the XBee) using a 4.8V RC receiver battery for example. See picture below.

To switch to the audio serial output, press the small wrench on the main R2 Touch screen to enter the setup menu.

Choose "Connection Method". By default it is on TCP over Wifi.

Change the connection method from TCP to "Serial via Audio Port" .

After a short delay, a warning appears to set the volume to max. Press OK and set the volume at or near to max level. To test if the connection has been changed properly, you can momentarily remove the 3.5 mm adapter from the earplug jack and press a button on the R2 Touch interface. You should hear a short buzzing sound from the iPhone speakers.


Place the trimpot in the middle on the adapter board, the matching receiving XBee radio in your MarcDuino setup (replacing the default WiFi radio if you had one there before). You should now be able to use R2 Touch.

The adjustment of the trim pot is not critical, just setting the pot near the middle should work. Ideally, it should be half-way between the two extreme positions where you lose the connection.