ZigBee is a communication device used for the data transfer between the controllers, computers, systems, really anything with a serial port. As it works with low power consumption, the transmission distances is limited to 10–100 meters line-of-sight. ZigBee devices can transmit data over long distances by passing data through a mesh network of intermediate devices to reach more distant ones. ZigBee is typically used in low data rate applications that require long battery life and secure networking. Its main applications are in the field of wireless sensor network based on industries as it requires short-range low-rate wireless data transfer. The technology defined by the ZigBee specification is intended to be simpler and less expensive than other wireless networks.
Here we make use of an interface of Zigbee with Raspberry Pi2 for a proper wireless communication. Raspberry Pi2 has got four USB ports, so it is better to use a Zigbee Dongle for this interface. Now we want to check the communication between the two paired ZigBee modules.
Modules Needed :
- Raspberry Pi2
- XBee 1mW Wire Antenna- Series 1 (2 No:)
- XBee Explorer Dongle (2 No:)
The two Zigbee must be paired with the same baudrate (for Ex: 9600) with X-CTU Software. Attach the two Zigbee’s to the two dongle’s and connect one pair on the USB port of the Raspberry Pi2. Connect the other pair to the USB port of a computer or a Laptop. Install the FTDI Driver on the Computer /laptop to provide usb communication. Create a hyperterminal, select the corresponding com port and the baudrate for the connected device.
Click here to see the instructions to Test your XBee Explorer Dongle with PC.
In the Raspberry Pi2 section open the LX terminal and type lsusb.
The response showed inside a red box indicates the presence of a usb device in the module. Write a python script to perform Zigbee communication which is given below.
# Enable USB Communication
ser = serial.Serial('/dev/ttyUSB0', 9600,timeout=.5)
ser.write('Hello User \r\n') # write a Data
incoming = ser.readline().strip()
print 'Received Data : '+ incoming
The two zigbee must be in a line of sight and check the results in the Python shell and in the hyperterminal of the computer.
The Communication could also be established with two Raspberry Pi or with another controller it self.
Shop With Us
- Click here to buy Raspberry Pi 2 from RhydoLabz.
- Click here to buy XBee 1mW Wire Antenna-Series 1 from RhydoLabz
- Click here to buy XBee Explorer Dongle from RhydoLabz.