Sometimes it is useful to have a wireless serial communications channel for telemetry or other similar purposes. With that in mind I developed a simple sketch with an Arduino Mega 2560 and two XBEE radios (Series 1) inserted on SPARKFUN XBEE Explorers . XBEE radios work with 3.3 V (beware!) and the regulated explorers ease the task of interconnecting the whole scheme. One of the XBEE works with the Arduino Mega, sending the data from an HMC5883 compass to a remote computer which has also an XBEE for reception. The remote computer has a Processing 3.0 application to read and visualize the data sent from the XBEE/Arduino sender. The XBEEs form a point to point link, working in the so called ISM band (2.4GHz) and using a form of modulationcalled direct-sequence spread spectrum (DSSS). As such, the link has a high degree of immunity to interference.
XBEE radios (Series 1), by default, work in transparent mode forming a serial connection and the sender and receiver must, in principle, work straight from the box without modification. However, I strongly recommend that anyone desiring to work with XBEE radios to download the configuration software from the manufacturer (XCTU) and read the tutorials and learning stuff regarding XBEE from sparkfun.
As a final advice it is wise to change the default Personal Area Network (PAN) and the source and destination addresses. All radios with the same PAN ID can talk to each other and ignore radios with different PAN ID. To change to command mode in order to do the modifications you must type in XCTU terminal (+++) without return. Then type ATDL\r and wait a 0 (default lower address). To see the high word type ATDH\r . This pair of commands can be used to set the new destination address: ATDL1234\r and ATDH0\r. To set the PAN ID use ATID1111\r for instance. Don't forget to issue the ATWR command after all the commands.
A typical configuration for two radios talking to each other:
ATMY ATDL ATDH ATID
Radio A 1234 5678 0 1111
Radio B 5678 1234 0 1111