The wireless networking device, XBee is a user friendly, popular and is a technology worth knowing about. It can transmit and receive data wirelessly, and thus can be used for many IoT applications. As the popularity of the XBee module has grown massively, there are now several modules types available in the market. The XBee Series 1, is the most popular by far. However, XBee Series 1 (S1) cannot communicate with ZigBee devices available in the market. But for communication between Xbee modules, which is the discussion of this article, it is very simple to understand and use
Communication between XBEE devices
XBee devices communicate with each other by sending and receiving wireless messages. These devices can only transfer wireless messages, after which they have no control over the sent data. XBee devices use the serial interface to communicate with various smart devices. The data from serial input is transmitted wirelessly and the received wireless data can be read through the serial output. This form of communication can be used for a multitude of purposes, from configuring a device to communicating complex messages. Various smart devices, and microcontrollers can be used with XBee devices to send and receive messages wirelessly.
There are two types of data transmission involved in XBee communication:
Wireless communication:
Wireless communication takes place between 2 or more XBee modules. In order to wirelessly communicate they must be part of the same network and use the same radio frequency. Modules that meet these requirements, communicate through wireless communication.
Serial communication:
Serial communication takes place between a smart device and the XBee module connected to it. Data exchange between the two devices is passed through the serial interface.
Characteristics of XBee modules:
Channel: The channel calibrates the operating frequency within a 2.4GHz band. This is important since, as we know XBees must share the same operating frequency to communicate with each other.
PAN ID (Personal Area Network ID): For two XBees to communicate, they must share the same PAN ID. The PAN ID is often a number between between 0 and 0xFFFF, and you can change it on both devices to match.
Addressing: Each XBee module has a source address (called ‘My address’) and a destination address. An XBee’s destination address specifies the source address of the module it can send data to. It can be specified by a universal unique address of 64-bits. This address printed can be found on the back of the module. Alternatively, it may be specified with a 16-bit address that is unique within a network, or with text.
In communication, each XBee in a network has a specific role. The three roles are Coordinator, End Device, and Router. Each network has only one Coordinator, which serves as the root of the network tree. A network can have multiple Routers; these can forward information to end devices and also run application functions. Lastly, End Devices cannot relay data, but only talk to a parent node (either a Coordinator or Router). A network can have multiple End Devices.
If you have to XBees in hand and are ready to dive right in, here’s a short tutorial. This will show you how to get them to start communicating with each other. Otherwise, this will give you an insight on how XBee configuration is done to start communication.
Configuring XBee modules:
In order for two modules to wirelessly communicate with each other, we need to first tweak some settings. As we discussed just before this, the channel, PAN ID, and Address values need to be set to match with each other.
Step 1:
Download and install XCTU software.This is available for both Windows and Mac on the website.
Step 2:
Plug your first XBee into an Explorer module, which is a an extra board that provides access to the pins on the XBee. Connect this via USB to your computer’s USB port.
Step 3:
Open the XCTU software and click “Discover devices.”
Step 4:
We next have to select and configure the port. First select the port the module is connected to. On the next page, you will see the page displayed in the following picture:
Select the settings as such, as click on ‘Finish’.
Step 5:
From the “Devices discovered” list, where you should now be able to see your device, click “Add selected devices”.
Step 6:
Open up the settings for your device and make the following changes:
Channel (between 0x0 and 0xFFFF). Remember the number you choose here as it will have to be used for the other XBee as well.
PAN ID. Same as the channel, PAN ID can be anything you want (between,0 and 0xFFFF) but remember it in order to use for the other XBee.
Addressing configuration can be made very simple, since we are using only two XBees. Let the Destination High be 0. For the Destination Low and MY address, choose two different numbers and use them in exchange for each other in the other module. For instance,
XBee Module #1:
- DH: 0
- DL: 3
- MY: 2
XBee Module #2:
- DH: 0
- DL: 2
- MY: 3
Step 7:
In the CE (Coordinator Enable) option, select Coordinator from the dropdown list. Then, click ‘Write.’
Step 8:
Now you can remove the XBee. Plug in the other XBee and repeat the above steps from 2 to 6. The only difference is on the second XBee, you can leave the CE(Coordinator Enable) i.e., step 7 as 0, or select EndUser. Make sure to keep note of which module is the Coordinator and which is the end user.
Run a Communication Test between XBee modules:
Step 9:
Connect the XBees to their respective Explorer modules and plug them into different USB ports. Open the XCTU software to scan for devices, and select and add both the devices from the resulting list.
Step 10:
Click on one of the two modules displayed in the left-hand column. To start sending messages, we have to open the Console. To do this, click on the console icon to view the console, to start typing click Open.
Step 11:
Repeat the same for the other module to open both consoles. Then, type into one console and switch to the other to see your message reflected in the other console.
Now that you have successfully learnt and understood how to transmit messages between the two XBee modules, you can go ahead and start thinking about the applications you can use this in! Keep in mind the versatility that these small chips come with, you can connect them to larger devices like your computer. Alternatively, you could implement applications with SoCs like Arduino with the XBee modules.