Tuesday, November 28, 2023

XBee Interfacing With Raspberry Pi Model 2

Arnav Bansal. He is pursuing B.E. in electronics and communication from UIET PUSSGRC, Hoshiarpur

- Advertisement -

efy testedXBee Pro (S2) module is an XBee ZB ZigBee Mesh Protocol based wireless transceiver designed by Digi International with an excellent range of 1.6 kilometres (one mile) line of sight (for 50mW, U.FL connection) and 90 metres indoors. This device works on 3.3V DC @ 295mA in transmission mode and has a maximum data rate of 250kbps. The data from the processor to XBee module is transmitted via a serial port.

Raspberry Pi Model 2 is a second-generation Raspberry Pi that was released in February 2015. It is a Linux based computer and has a powerful Broadcom BCM2836 ARMv7 900MHz quad-core processor and 1GB SDRAM. It has a total of 40 pins, including 17 pins GPIO along with HDMI, micro SD card slot, Ethernet, USB 2.0 and 3.5 audio (out) ports.


fig 1Fig. 1: XBee Explorer shield
Fig. 1: XBee Explorer shield

There are many operating systems designed for Raspberry Pi Model 2, but most widely used are Raspbian (Linux based) and Microsoft Windows 10 IOT Core. If you are a newbie to Raspberry Pi Model 2, check out the link  for information on Raspberry Pi. In this article, the compiler used is Python and OS required on Raspberry Pi is Raspbian.

- Advertisement -

The objective is to send a character on XBee module and receive it on another XBee module. To send/receive data on XBee, the modules should be configured, and to do that the software required is XCTU. XCTU is a free software designed by Digi International that allows a user to configure XBee modules. XCTU can be downloaded from the link

Circuit and working

The components required are Raspberry Pi Model 2, two XBee modules with Explorer shields and some female-to-female jumper wires.

fig 2Fig. 2: XCTU software screenshot
Fig. 2: XCTU software screenshot
fig 3fig 3:Configuring the COM port
fig 3:Configuring the COM port

To configure XBee module, connect XBee Explorer shield to a computer via USB.

fig 4Fig 4. Bottom view of a typical XBEE module
Fig 4. Bottom view of a typical XBEE module

Then run the XCTU software and click on ‘Add Devices’ icon. The output screenshot of XCTU is shown in Fig. 2. You will get an ‘Add radio device’ window. Confirm the COM port of the Explorer and set the baud rate to 9600, data bits to 8, parity to none and click on ‘Finish’ as shown in Fig. 3. Now click on ‘XBee Module’ on the left of the Radio Configuration screen (refer Fig. 5) to configure it. There are three types of    devices   in a communication network: coordinator, end device and Now first, configure XBee as coordinator.

fig 5 Fig. 5: Radio Configuration window
Fig. 5: Radio Configuration window
fig 6Fig. 6: Configuration details of coordinator
Fig. 6: Configuration details of coordinator

To do that, click on ‘Update Firmware,’ set it to ‘XBee coordinator AT,’ click on the latest firmware available and then click on ‘Finish.’ Each XBee has two important keys, SH and SL, which help in transmission and reception of data. SL is unique to each XBee whereas SH is the same. The bottom view of a typical XBee module is shown in fig 5 along with its SL number as 406F70BEand SH as 0013A200.The coordinator sends the data, so the XBee connected to Raspberry Pi is set as coordinator.

End device receives the data. Here we will use Console Mode of X-CTU to view received data, hence, XBee connected to the computer with XCTU should be set as end device. Router (sort of repeater)is an optional mode; in this, XBee simply receives and then transmits the same data, and so this mode is used to extend the range of transmitter.To configure XB2 as end device, repeat the steps done for configuring XB1, update the firmware and replace its DH and DL values with the SH and SL values of coordinator XB1, respectively. Now XB1 can transmit data and XB2 can receive it. You can see the details of coordinator (XB1) and end device (XB2) modules in Fig. 6 and Fig. 7, respectively.

You can see the details of coordinator (XB1) and end device (XB2) modules in Fig. 6 and Fig. 7, respectively.


  1. Hi,
    Thanks for sharing your knowledge. While I update the radio module firmware, I only have “ZIGBEE TH Reg”, “805.15.4 TH” and “DIGIMESH 2.4 TH” function set. Is it compulsory to have “XBEE COORDINATOR AT”. Could you please tell me how can I go forward with the available function sets.


Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components