XBee Interfacing With Raspberry Pi Model 2

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

48223
Advertisement

XBee Interfacing with Raspberry Pi

fig 7Fig. 7: Configuration details of end device
Fig. 7: Configuration details of end device

The communication between XBee and Raspberry Pi is done through serial communication. The connections for serial communication between XBee and Raspberry Pi Model 2 are given below and also shown in Fig. 8.

fig 8Fig. 8: Connection of XBee module with Raspberry Pi Model 2
Fig. 8: XBee interfacing with Raspberry Pi Model 2
fig 9Fig. 9: Screenshot of minicom on Raspberry Pi
Fig. 9: Screenshot of minicom on Raspberry Pi

Rx (Pin 3) of XBee ® Pin 08 (GPIO14)

Tx (Pin 2) of XBee ® Pin 10 (GPIO15)

Vcc (Pin 1) of XBee ® Pin 01 (3.3V DC)

GND (Pin 10) of XBee ® Pin 06 (GND)

You need to reboot the Raspberry Pi board after these connections and the configurations as explained below.

In order to use the serial port for communication between Raspberry Pi and XBee, some configurations are required in files cmdline.txt and inittab.txt. Start the ‘Terminal’ on Raspberry Pi board and then follow the given sequence of commands:

 [stextbox id=”grey”][email protected] ~ $
sudo apt-get update[/stextbox] // Checks for updates
[stextbox id=”grey”][email protected] ~ $ sudo apt-get upgrade[/stextbox] // Installs updates if any
[stextbox id=”grey”][email protected] ~ $ cd /etc[/stextbox] // This should change directory to etc folder
[stextbox id=”grey”][email protected] ~ /etc $ sudo chmod 666
/dev/ttyAMA0[/stextbox] // To add permission to use serial port
[stextbox id=”grey”][email protected] ~ /etc $ sudo apt-get
install python-serial[/stextbox] // This will install serial Library to Raspberry Pi
[stextbox id=”grey”][email protected] ~ /etc $ cd[/stextbox] // This should change directory to Root folder
[stextbox id=”grey”][email protected] ~ $ sudo apt-get install
minicom[/stextbox] // This will install Minicom on your Raspberry Pi
[stextbox id=”grey”][email protected] ~ $ cd /boot[/stextbox] // This should change directory to Boot folder
[stextbox id=”grey”][email protected] ~ /boot $ sudo cp
cmdline.txt cmdlinebackup.txt[/stextbox] // This should make a copy of cmdline.txt and rename it to cmdlinebackup.txt
[stextbox id=”grey”][email protected] ~ /boot $ sudo nano
cmdline.txt[/stextbox] // This should open cmdline.txt in text editor
// Remove: “console=ttyAMA0, 115200 console=ttyl”
// Hit Ctrl+O to Save and Ctrl+X to Exit
[stextbox id=”grey”][email protected] ~ /boot $ cd /etc[/stextbox] // This should change directory to etc folder
[stextbox id=”grey”][email protected] ~ /etc $ sudo cp inittab
inittab.backup[/stextbox] // This should make a copy of inittab and rename it to inittab.backup
[stextbox id=”grey”][email protected] ~ /etc $ sudo nano
inittab[/stextbox] // This should open inittab in text editor
// Comment the line: “T0:23:respawn:/sbin/getty –L ttyAMA0 115200 vt100” // by adding ‘#’ before of it.
// Hit Ctrl+O to Save and Ctrl+X to Exit
[stextbox id=”grey”][email protected] ~ $ sudo minicom –b 9600
–o –D /dev/ttyAMA0[/stextbox] // This will set the baud rate of the port: ttyAMA0 to 9600
[stextbox id=”grey”][email protected] ~ /etc $ cd[/stextbox] // This should change directory to main Pi folder
[stextbox id=”grey”][email protected] ~ $ sudo reboot[/stextbox] // This should restart the system

Advertisement


7 COMMENTS

  1. I followed the exact steps you’ve mentioned. But I didn’t get the result. I’m not able to see anything in XCTU software.

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

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here