Using an XBee Radio

LR2 Touch can send 9600 bauds serial command through the audio port (earphone plug), and therefore send commands to an XBee or an Arduino. The connection is unidirectional, the R2 Touch can only send, but not receive any serial information via the audio port. A simple level adapter circuit is needed between the phone and the XBee, see below for a do it yourself version.

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".



In the following screen, choose "Serial via Audio Port" connection.
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. When you press a button, you should hear a short buzzing sound in the speakers. This is what serial 9600 bauds sounds like...


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. You should be good to go, more details below.


Serial Audio Adapter Board

The following adapter circuit is required to translate the audio port signals to logic levels.


Here are the components:

Serial Audio Adpater v1.1 Bill of Materials (updated 9/30/2013)


Part   Quantity 
DigiKey Part Number   
DigiKey Link
0.1 uF Cap1
445-5303-NDhttp://www.digikey.com/product-detail/en/FK18X7R1H104K/445-5303-ND/2256783
LM339AN (IC)
1
LM339ANFS-NDhttp://www.digikey.com/product-detail/en/LM339AN/LM339ANFS-ND/458684
10 kOhm Res.
2CF14JT10K0CT-NDhttp://www.digikey.com/product-detail/en/CF14JT10K0/CF14JT10K0CT-ND/1830374
22 kOhm Res.1CF14JT22K0CT-NDhttp://www.digikey.com/product-detail/en/CF14JT22K0/CF14JT22K0CT-ND/1830383
3.5 mm Audio Connector
1
CP-43514SJCT-ND http://www.digikey.com/product-detail/en/SJ-43514-SMT-TR/CP-43514SJCT-ND/669734
4.7 kOhm Trim
1
3386G-1-472LF-ND http://www.digikey.com/product-detail/en/3386G-1-472LF/3386G-1-472LF-ND/2537015
0.1" pin 50 strip1
SAM1031-50-NDhttp://www.digikey.com/product-detail/en/TSW-150-07-L-S/SAM1031-50-ND/1101377

Solder the components like this.


Here is completed prototype of v1.0, almost the same except for the placement of some components on the lower right:


Left (black) plug connects to the iPhone Earphone plug using a 3.5mm audio cable.
Power (+/-) and Din (S) of the XBee connect to the Serial Out Connector on the bottom right.
The top left connector is used for the approx. +5V source to power the board and XBee. I use a small 4.8V NiMh RC radio battery pack.


The adjustment of the trim pot is not critical at all, just setting the pot near the middle should work. You can also adjust it more precisely by connecting a RS-232 terminal at 9600 bauds to the output of the adapter board. Watch the R2 Touch output on a Terminal session (make sure iPhone volume is all the way up). Adjust the pot mid-way between the two extreme positions where the messages start not showing properly (i.e. you don't get anything or weird characters display on the screen).

Configuring the XBee's

XBee's don't require any configuration to get them working. They should connect to each other as soon as they are powered, since they all talk to group address 0 as shipped. Make sure your setup works like this first. Once you get it going, you should change the address fields so each of them talks to the address of the other only, for a secure connection. Do the following using the XCTU programming tool which you download from the Xbee site:

Find the SH and SL addresses of each module (it's a read only field, module address High and Low, unique for each module). Program it in the DH and DL fields of the other (that's the destination address High and Low).

This way each module will only talk securely to the other.