From Domoticz
Jump to: navigation, search

ZigBee is an IEEE 802.15.4-based specification for a suite of high-level communication protocols used to create personal area networks with small, low-power digital radios.

ZigBee protocols are intended for embedded applications requiring low power consumption and tolerating low data rates. The resulting network will use very small amounts of power — individual devices must have a battery life of at least two years to pass ZigBee certification.

The technology defined by the ZigBee specification is intended to be simpler and less expensive than other wireless personal area networks (WPANs), such as Bluetooth or Wi-Fi. Applications include wireless light switches, electrical meters with in-home-displays, traffic management systems, and other consumer and industrial equipment that requires short-range low-rate wireless data transfer.

Its low power consumption limits transmission distances to 10–100 meters line-of-sight, depending on power output and environmental characteristics. 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 (ZigBee networks are secured by 128 bit symmetric encryption keys.) ZigBee has a defined rate of 250 kbit/s, best suited for intermittent data transmissions from a sensor or input device.

Zigbee Modules and Network

Zigbee is a standard for low-power, short range wireless devices based on an IEEE 802 standard for personal area networks(PAN). Zigbee modules work in unlicensed ISM(Industrial Scientific Medical) band. Zigbee devices are capable of peer-to-peer, point-to-multipoint and mesh communication. They offer convenient low power wireless solutions for embedded systems where power consumption is a critical factor. A Zigbee network consist of three different types of ZigBee devices: coordinator, router, end-device. Each network has a 16bit PAN ID. All devices in a Zigbee network is assigned a single PAN ID.

Device Types

  • ZigBee coordinator (ZC): The most capable device, the coordinator forms the root of the network tree and might bridge to other networks. There must be one ZigBee coordinator in each network since it is the device that starts the network originally. The coordinator initiates a Personal Area Network(PAN) by selecting a RF channel and PAN ID. ZC also allows routers and end-devices to join the PAN. It is able to store information about the network, including acting as the Trust Center & repository for security keys.
  • ZigBee Router (ZR): As well as running an application function, a router can act as an intermediate router, passing on data from other devices. A router can start operation only when it has establishes connection with ZC
  • ZigBee End Device (ZED): Contains just enough functionality to talk to the parent node (either the coordinator or a router); it cannot relay data from other devices. This relationship allows the node to be asleep a significant amount of the time thereby giving long battery life. A ZED must join PAN like a router before sending any senor data. A ZED requires the least amount of memory, and therefore can be less expensive to manufacture than a ZR or ZC.

Device Addressing

  • When a device connects to a Zigbee network it gets a 16-bit Network address.
  • Each device(node) has a 64-Bit Device address. In XBee ZB modules, this 64-bit address is a unique permanent number assigned by the manufacturer. This is also the serial number of the device.

Any data sent from one Zigbee device to another is sent by specifying the 16-bit Network Address and the 64-bit Device Address.

Getting ZigBee modules

Getting Zigbee modules

Seeedstudio Bazaar currently sells two types of Zigbee modules from digi :

XBee® RF Modules ZNet 2.5 RF Module modules are Series 2 hardware which comes with ZNet 2.5 firmware.

In this tutorial we are going to use XBee ZB firmware on a XBee Znet 2.5 Module. XBee ZNet 2.5 Module modules can be upgraded to XBee ZB firmware by following the procedure listed at Converting a XBee/XBee-PRO ZNet 2.5 Module to a ZB Module. This procedure is also illustrated in the next section.

XBee ZB Hardware and Pin Layout

  • XBee ZB module is available with a chip antenna.


  • Pins of XBee ZB module are shown below.


Upgrading XBee firmware with UartSBee or Grove XBee Carrier

The XBee modules have to be configured with a 3.3V logic UART. Both UartSBee and Grove XBee Carrier comes with FT232RL based USB to Serial Port and a XBee compatible socket.

Installing drivers for USB-to-Serial Port

  • If you are using UartSBee set the power switch to 3.3V before connecting to PC. Grove XBee Carrier always works 3.3V logic.
  • Connect the XBee ZB to XBee socket of UartSBee or Grove XBee Carrier like this :
XBee ZB connected to UartSBee for configuration XBee ZB connected to Grove XBee Carrier for configuration
  • Install the necessary driver for FT232RL chip by following the below steps :


  • In Windows OS, the first time you plug in the device (UartSBee or Grove -XBee Carrier), you might be asked for the driver.

Download and install the Virtual COM port driver from FTDI website :


  • A wizard opens for installing the driver. Choose "Install from a list or specific location"
  • Choose the downloaded driver path
  • If you have downloaded unsigned driver, the following Window appears. Just click "Continue Anyway"
  • UartSBee driver is successfully installed. Windows assigns a COM port name to FT232RL like COM10, COM11 etc... Please check the exact name in Device Manager.  In this case "COM16" is assigned for UartSBee

All modern GNU/Linux OS comes with FT232RL drivers. To check if UartSBee or Grove -XBee Carrier is detected, Issue a lsusb command. An output similar to below should appear.

GNU/Linux assigns /dev/ttyUSB0, /dev/ttyUSB1 etc... as device name.  

Using Digi's X-CTU (XCTU) Software

X-CTU is XBee Configuration and Test Utility. It is primarily used for configuring XBee Modules from Digi and also to upgrade the onboard MCU firmware. It comes with a Serial-Terminal to interact with XBee modem using AT commands. X-CTU is a Windows application. But, it is known to work under GNU/Linux using Wine .

  • Download X-CTU from Digi's X-CTU Page
  • Install X-CTU.
  • Open X-CTU --> PC Settings Tab.
  • Select USB Serial Port (which is connected to UartSBee / Grove - XBee Carrier).
  • Click Test / Query Button

  • A dialog box shows the Modem Type, Modem firmware Version and Serial Number.
  • In this case, XBee ZNet 2.5 modem is displayed as XB24-B. This has to be upgraded to XB24-ZB firmware.
  • Open Modem Configuration Tab.
  • Click Download New Versions button.
  • This opens the following dialog box :
  • Click Web button. This downloads all devices firmware from digi's server.
  • Once, latest firmwares are downloaded an update summary is displayed. This indicates that update happened without any issue. If you do not get this dialog box, repeat the above steps.
  • Open Modem Configuration Tab.
  • Click Modem Parameters and Firmware --> Read button.
  • XBee ZNet 2.5 firmware XB24-B is detected and all its configured parameters are shown.
  • It also shows the firmware Function Set as ZIGBEE ROUTER/END DEVICE AT and version as 1220.
  • Function Set decides which firmware is already programmed / to be programmed to XBee Module. Series 2 devices can be used in many different modes(ZC or ZR, ZED). We have to choose the appropriate firmware function set.
  • Now, Update the firmware to XB24-ZB.
  • Select Modem:XBEE as XB24-ZB
  • Select Function Set as ZIGBEE COORDINATOR AT.
    • Note: ZIGBEE COORDINATOR AT is one function set that we will use in the next section. You can choose any function set which is suitable for you application.
  • Select the latest version of firmware. At the time of writing this guide, it is 208C
  • Click Write button. This permanently writes the firmware to XBee module.

Wireless UART demo using XBee ZB modules and PC

This demo configures two XBee modules to connect to each other automatically upon power-up and continuously trans-receive data. This setup can be used as a Wireless UART to connect any two PCs or two MCUs with serial ports.

  • Use two UartSBee or two Grove XBee Carrier with two XBee ZB modules.
  • Connect these modules to PCs Serial port and make sure the drivers are installed.
  • Open X-CTU, select the USB-Serial Ports of the device as shown below :
  • Program one module with COORDINATOR AT function-set firmware and another module with ROUTER AT function-set firmware. Always use the latest version of firmware. See the above section on how-to program firmware.
  • Now, Open Modem Configuration Tab and configure the destination addresses of both the modules as follows:
    • Set the destination address high of COORDINATOR to serial number high of ROUTER.
    • Set the destination address low of COORDINATOR to serial number low of ROUTER.
    • Set the destination address high of ROUTER to serial number high of COORDINATOR.
    • Set the destination address low of ROUTER to serial number low of COORDINATOR.
    • Write these parameters to the modules.
  • PAN ID was not modified during parameters configuration. It was left to 0, as there is only one Zigbee network in the vicinity. You might want to change these PAN IDs (of both the modules) to a 16bit number.
  • Open the Terminal Tabs for both the modules and click the Show Hex buttons.
  • Type a message in COORDINATOR terminal and it will be sent to ROUTER via wireless. Similarly, any text typed in ROUTER terminal is sent to COORDINATOR terminal.

Wireless UART demo using XBee ZB modules and Arduinos

Wireless Sensor Networks(WSN) demo with XBee ZB modules

Configuring a standalone sensor nodes using XBee ZB module and Grove XBee Carrier

Configuring a Zigbee Coordinator using XBee ZB module, Seeeduino and XBee Shield

Using Seeeduino as Internet Gateway using XBee ZB module, Wifi Bee and Bees Shield