NCD Articles Home Copyright © 2009, National Control Devices LLC
By Ryan Sheldon and Xu Shirui
Contact Us

Introduction to ZB ZigBee Networking

Building Your Own ZB ZigBee Network
ZB ZigBee Networking is simply the hottest wireless technology of our time.  Period.  It's fast, it's very easy to use, highly reliable, and self healing.  This article helps introduce you to ZB ZigBee networking technology, and gives you the solid and practical building blocks required to understand this technology in a format designed for the novice user.  The information found in this article is not a substitute for ZB ZigBee networking data sheets.  The examples shown here are, at times, over-simplified, but provide you with the introduction you require to use this technology for the first time.

ZB ZigBee Networking Components


Computer Interface
Your Computer Connects to the Coordinator.  The Coordinator Communicates to the wireless ZB ZigBee Network.

Your computer can speaks to a ZB ZigBee Network using a Coordinator.  Think of the Coordinator as the interface to a ZB ZigBee Network.  NCD Coordinators are equipped with a USB Interface.  USB Coordinators mount as a Serial Port on your computer, and you will develop software that sends Serial commands at 115.2K Baud.  Only ONE Coordinator should be installed within a wireless ZB ZigBee Network.  Two types of Coordinators are available.  AT and API.  Normally, AT coordinators are used.  AT coordinators use Terminal-like AT commands to speak to a ZB ZigBee Network.  They are easier to use than an API coordinator.  An API coordinator uses a string of carefully chosen bytes and checksums to communicate data to a ZB ZigBee networking.  API coordinators are harder to use, but can communicate and switch between devices much faster.  This article will introduce you to AT coordinators.  You can convert an AT coordinator to an API coordinator and vise versa using X-CTU from to burn the AT or API firmware into your USB coordinator device.  You will only burn the firmware for coordinator devices, never attempt to burn the firmware for Router or Endpoint devices.


Links Coordinator and Endpoints
  • Forwards Data from Coordinator to Endpoint.
  • Forwards Data from Router to Router.
  • Can be Used as an Endpoint Device.
  • Routers Bridge Data between Devices that would Otherwise be Out of range and are Positioned between Coordinators and other Routers and/or Endpoint devices.

The primary job of a router is to bridge the wireless gap between your computer (the Coordinator) and the device (Endpoint).  If the Coordinator cannot speak to the Endpoint device because it is out of range, a Router can be used to bridge the two devices together.  Perhaps the most confusing part of a Router is that it also can be an Endpoint device.  It would be tempting to only use Routers and skip the use for Endpoint devices altogether.  However, our tests have shown that routers are slower than endpoint devices, and will slow down network traffic, so you should always use Endpoint devices when possible, and routers when necessary.


Remote Device
Endpoints are Devices.  In the case of NCD devices, Endpoints are often Relay Controllers or some other type of device used for collecting data or computer control.  Endpoints cannot forward data to other devices, they are simply a final destination for data communications.

Endpoints are simply devices.  With regard to NCD products, Endpoints can be relay controllers, data collection devices, PWM devices, and much more (and more coming).

Growing your ZB ZigBee Network:

 Building Blocks of a ZB ZigBee Network

Coordinator/Endpoint Network
A very basic ZB ZigBee network can be created between just two devices, a Coordinator and an Endpoint.  In this case, the Coordinator has direct 2-way communication with the Endpoint device.

Coordinator/Router Network
A very basic ZB ZigBee network can also be created between a Coordinator and a Router.  A Router can be used as an Endpoint device and a Coordinator has direct 2-way communication with this device.  In our tests, Routers are slower than endpoint devices.  So for small close range networks, Coordinator and Endpoint devices may be slightly more preferable than a Coordinator and Routers in a ZB ZigBee network.

Coordinator/Router/Endpoint Network
If a Coordinator cannot reach an Endpoint device (due to range issues), a Router can be positioned between the Coordinator and an Endpoint to Reach the Endpoint device.  In this example, the Coordinator communicates to the Router, the Router Communicates to the Endpoint device.  When the Endpoint Device needs to send data back to the computer, it must forward its data to the Router, and the Router will report the data back to the Coordinator.

Growing your ZB ZigBee Network:

 Building Blocks of a ZB ZigBee Network

Coordinator and Endpoints in your Network
A Coordinator can Communicate to no-more than 8 Endpoint Devices.

Coordinator/Router "Distance" Network
If overall long distance communication is your goal, then a Coordinator/Router "Distance" network can be used.  This form of network is slower but can span long distances.

Coordinator/Router/Endpoint Network
As you are starting to grow your ZB ZigBee network, a wise mix of Endpoint devices and Routers should be used. 
A Router can be used to extend the range, but using too many routers slows the network speed.  So use routers when necessary.  In this example, the first 3 endpoint devices are directly communicating to the Coordinator.  The Coordinator also talks to the router, The router talks to another 4 devices.

Growing your ZB ZigBee Network:

 Building Blocks of a ZB ZigBee Network

Coordinator/Router "Distance" Network
This is another form of a "Distance" network whereby a Coordinator is talking to Routers and Routers are associated with Endpoints.

Coordinator/Router/Endpoint Network
A Coordinator can associate itself with up to 8 devices, in this case, it is associated with 5 Endpoint devices and 2 Routers (7 total of 8 possible associations).

Quick Summary of ZB ZigBee Networking

  • A Coordinator Connects to your Computer.
  • A Coordinator is used to communicate with a ZB ZigBee network.
  • Only One Coordinator should be used.
  • A Coordinator can talk to up to 8 Endpoints or Routers in any combination.
  • A device is an Endpoint.
  • A Coordinator can talk to Endpoints.
  • If a Coordinator cannot talk to an Endpoint because it is out of range, a Router can be used to Bridge Data between the Coordinator and the Endpoint.
  • A Router can also be an Endpoint device, but it's slower.
  • Use Endpoint devices whenever possible.
  • Use Routers only when necessary for best communication speed and fewer data hops across the wireless ZB ZigBee network.

Network Formation/Reformation:

 How ZB ZigBee Networks are Formed and Heal Themselves

ZB ZigBee networks are automatically formed as network components are powered up.  ZB ZigBee Network Components (Coordinators, Routers, and Endpoint devices) begin communication with each other, measuring signal strength and determining best communication routes.  Networks may be completely reorganized the next time power is applied to any or all ZB ZigBee Network Components.  In most practical applications, the user does not control how networks are formed.  Instead, it is up to the user to make intelligent choices with regard to which network components should be used for any particular application.  As a general rule, you only have one Coordinator and as many Endpoint devices as possible.  Routers should be used sparingly, to bridge the gab between Coordinators and Endpoint devices.  Keep in mind that a Coordinator can only associate itself with 8 devices.  Routers can only associate themselves with 8 devices.  Endpoints only associate themselves with 1 device (directly with a Coordinator or with a Router that has communications with a Coordinator).  Network formation only takes a few seconds in most cases, but it can take a minute or two for all devices to be "negotiated" onto the wireless ZB ZigBee network.  When a Router drops off the network, it can take time to renegotiate a new network path.  Fortunately, this is all done for you.  All you have to do is wait a short time for a device to re-appear on the network.

ZB ZigBee Networking Speed

Speed is not a particularly defining feature of ZB ZigBee networking.  ZB ZigBee networking is more about sending and receiving small amounts of data periodically, and is really not designed for high speed communication of large amounts of data.  However, the future is open for this technology, and this (like all technological innovations) is subject to future improvement.  So how fast can you expect?  Well, for starters, if you are trying to send a couple of bytes of data to activate a relay, it takes far less than a second.  Not bad, and rather perfect for our intended applications.  But don't expect to replace your 802.11N WiFi with ZB ZigBee networking.  In fact, trying to send a picture file could prove to be painfully slow...but surprisingly reliable.  ZB ZigBee network devices buffer data and store these data until the intended recipient is available.  ZB ZigBee network devices can periodically disappear from the network (for who knows whatever reason), this and the extensive use of routers will slow communication speeds.  The self-healing properties and large buffers do significantly improve reliability, but can sometimes work against speed.

ZB ZigBee Networking Replacing ZigBee?

I don't think so.  These are apples vs. oranges technologies, you can't compare them.  They both have their strengths, and they both have shortcomings.  So it is up to the user to determine the best technology for a given application.  For instance, ZigBee has much better range with less hardware than a comparably equipped ZB ZigBee network installation.  In addition, ZigBee is very fast when comparing the two technologies.  ZigBee and ZB ZigBee network devices have similar command sets, making migration between technologies somewhat easy.  ZigBee is only slightly easier to use than ZB ZigBee, but only slightly.  Neither technology is for the complete novice.  We can help get you started, but the real power comes from users who read and study ZB ZigBee networking.  As hardware engineers, we will make sure you have the equipment you need.  But learning to use it can be as simple or as complex as your willingness to study.

Who Talks to Who?

Up to this point, we have always focused on a Coordinator talking to a Endpoint device.  In most applications, this is how ZB ZigBee networking is best used.  But no article would be complete without the simple mention that Endpoint and Routers can also talk to other Endpoint and Router devices.  I just thought I would drop that bug in your ear as some foreshadowing to potential future devices.

Hardware Components of a ZB ZigBee Network

The actual wireless portion of a ZB ZigBee network interface is identical, weather it be a Coordinator, Router, or Endpoint device.  The firmware running inside the wireless module is what defines its role in a ZB ZigBee network.  For experienced ZB ZigBee network users, there are many firmware options available, but the most popular firmware is listed below:

Coordinator AT Firmware Programmed for 115.2K Baud We Ship and Support this Version
Coordinator API Firmware Programmed for 115.2K Baud We Ship and Support this Version
Router AT Firmware Programmed for 115.2K Baud API Version of This Firmware Will Not Work with our Controllers
Endpoint AT Firmware Programmed for 115.2K Baud API Version of This Firmware Will Not Work with our Controllers

ZB ZigBee Network Device Organization

NCD ZB ZigBee Network Devices are organized as two separate microprocessors.  The first microprocessor you will work with is the ZB ZigBee Network Wireless Communications module.  This module is directly connected through serial communications to a custom microprocessor developed by NCD.  The Baud rate between the ZB ZigBee Network Wireless module and the NCD Microprocessor is usually either 9600 Baud (for small devices with a 8-pin microprocessor) to 115.2K Baud for larger NCD Devices, including ProXR devices.  We configure and test ZB ZigBee Network devices prior to shipment.  Part of our configuration and testing process involves setting the baud rate, and accessing the device (verifying 2-way communications) from the Coordinator.

Building Your First ZB ZigBee Network

As an end-user, there are four basic things you must learn.  First, you will need to know how to open the serial port on your computer (to begin communications with the Coordinator).  Second, you will need to know the serial numbers of every device in the ZB ZigBee Network.  You will use these serial numbers to identify various devices in the network.  Third, you will likely want to know how to send commands to target a specific device in the ZB ZigBee network using the serial numbers.  Finally, you will need to send commands to a NCD device to perform a desired function, such as activate a relay or collect data.

The best way to do all of these things is to show you step-by-step how to implement a ZB ZigBee Network into your own application.  This tutorial will be written for Visual Basic 6, but we will also include source code for Visual Basic .NET and Visual C.  First, let's take a look at the actual hardware components that will be used in this tutorial.

Notice: Photographs Shown in this Tutorial can be Enlarged by Clicking on the Pictures.

Meet the Players


S/N: 0013A200 404BFBF7


A Coordinator plugs into the USB port of your computer and communicates to the ZB ZigBee network.  The Coordinator mounts as a Virtual COM port on your computer (Virtual COM Drivers are Available for all Major Operating Systems)  All of your software will be written as though you are talking to a COM port at 115.2K Baud.  The Baud Rate is VERY IMPORTANT.  It is also very important to know the COM port your computer assigns to the Coordinator.


S/N: 0013A200 403E29EE


A ZR15_ZBMESH will be programmed with Router firmware.  This will allow you to forward data to remote devices in the ZB ZigBee Network.  We will also take advantage of a Router's ability to act as an Endpoint device, which in this case will be used to control Two relays.  Routers should be used only when needed, they are slower than Endpoints.

S/N: 0013A200 403E29E3


A Second ZR15_ZBMESH will be programmed with Endpoint firmware.  This device will serve as a Relay Controller Only, and will NOT have the ability to forward data to other devices in the ZB ZigBee network.  But its overall speed will be slightly faster than the Router version of this device.

S/N: 0013A200 403E29FF


A Second ZADR810ProXR_ZBMESH will be programmed with Endpoint firmware.  This device will serve as a Relay Controller Only, and will NOT have the ability to forward data to other devices in the ZB ZigBee network.  Each Endpoint device has a different command set, so we will send different commands for this device than the ZR210.

Serial Numbers

There are three possible ways to obtain serial numbers from your ZB ZigBee network.  The easiest method is to use our ProXR software to query all the devices in the area and have them report their serial numbers.  However, some users may prefer to obtain the serial numbers by recording the serial number printed on the bottom of the wireless module.  The third method is to manually query the modules by developing your own software (which is the most difficult method).

Obtaining Serial Numbers Manually

The wireless module can be removed from each of the above controllers.  These modules are socketed, and can be reinstalled only when no power is flowing to the controller.  You will need to remove each module from each of your controllers and take note of the serial number printed on the back.  This serial number is how we will identify each of the devices on the ZB ZigBee network, and is very important in following the topics discussed in this article.  Every controller will always have a different serial number that cannot be changed.  The serial numbers in these tutorials will not work with devices you obtain from us, the software must be modified to include the serial numbers of your devices.

NOTE: ALWAYS Power Down the Controller while Physically Obtaining the Serial Number


The serial number for each module is highlighted in RED above.  There are two parts to this number, you will need both parts.

Note that it is also possible to query the network for all serial numbers in the area.  This allows you to obtain the serial numbers without removing the modules from the controllers.  This is a somewhat advanced topic and will be covered in the future.

Start by Plugging the Coordinator into the USB Port of your Computer.  Once the FTDI Drivers have been installed, check your Device Manager to determine the COM port that was assigned to the Coordinator.  This is a very important first step.

Visual Basic 6 does not like COM port numbers above 9, so it is sometimes necessary to right-click COM listing (as shown at left) and change the Properties>Port Settings>Advanced>COM Port Number to a number less than 10.  If all COM ports less than 10 show up as "in-use" you can use the following registry patch to clear the unused COM port assignments on your computer.

I have used this Patch for years with Windows XP Professional and Windows XP Home, it has never caused any problems, but I have no information as to its compatibility with other versions of Windows.  Nonetheless, it is always a good idea to backup your registry before making any changes to the registry.

Download Registry Patch to Clear "In-Use" COM Ports from your computer, Windows XP Home/Pro Tested.

COM3 is used by the Coordinator in this example, so we will communicate to the ZB ZigBee Network using serial commands sent to COM3 at 115.2K Baud.

Note:  NCD Staff Members Pre-Configure all Coordinators to operate at 115.2K Baud for best performance.  However, if you need to use other baud rates, you can change the configuration of the Coordinator using X-CTU Software.

Note that X-CTU Software can also be used to burn AT or API firmware into the Coordinator.  We will be using AT firmware for this example, because it is easier to use.  API firmware is faster, but software development is more complicated.  Most users end up using API firmware, but AT firmware is probably the best for learning about ZB ZigBee Networking.

Using ProXR Software

NCD ProXR Software should be used to initially test your ZB ZigBee network.  ProXR software will allow you to send commands to each of the devices in the ZB ZigBee network, and will allow you to make sure each device is functioning as expected prior to developing your own software.  It's important not to skip the use of our ProXR software.  ProXR software will let you test your ZB ZigBee network in just a few minutes, and it is very easy to use with a full graphical user interface.  ProXR software, like our product line, is always evolving, so we will not be demonstrating any screen shots throughout this article.  ProXR software screens are frequently updated and improved.  Rest assured, our ProXR Software is a vital tool for demonstration, configuration, and learning about how NCD products are used.




SELECT ZBR1x/ZBR2x if you are using a relay controller that begins with part number ZR1x or ZR2x.
SELECT ZB ProXR if you are using a more advanced controller that begins with ZAD or ZUXP or has PROXR in the part number.

This will search the ZB ZigBee Network for all available devices.

After a few moments, the a new serial number should appear.  If it does not, click the REFRESH button again. 
It is sometimes necessary to repeat this step a few times. 
The device may appear as a Router or a Endpoint device.

This will take you to the next screen.

If you are using a ZR1x or a ZR2x relay controller, the following window will allow you to test your relays on the relay controller.
If you are using any of our ProXR series controllers, the buttons shown on the left side will allow you to test the relays to make sure you have communications working.


The NCD Component Library should be used when developing your own software for communication to NCD ZB ZB ZigBee Devices, this will greatly simplify programming, and many examples for ZB ZigBee are available in this FREE download.

Developing Software for ZB ZigBee Networking Devices

ZB ZigBee networking Example Software for Visual Basic 6 has been developed to help get you on the right path to using ZB ZigBee Network devices in your own applications.  Our VB ZB ZigBee Examples are easily ported to other languages.  Most of our examples are for AT communications, but we do have a few API examples for those power users looking for maximum speed.  Our example software addresses the most import component of ZB ZigBee networking: How to Talk to Multiple ZB ZigBee Network Devices using a Single Coordinator.

Keep in mind, ZB ZigBee Network devices pass data around the network, seeking the destination device.  This is all done for you, and you do not need to worry about anything except telling the network who you are trying to talk to.  You tell the network who you want to talk to using the serial number of the device.  Once you have addressed that device (using its serial number), you are able to communicate freely with that devices exclusively.  ZB ZigBee networking automatically hops the data from point to point, seeking your device so once again, you have very little to think about when you develop your software.

AT Coordinators vs. API Coordinators

The examples shown below were written specifically for a AT Coordinator or a API Coordinator (but not both).  You have seen references to AT and API throughout this article.  But it is now important for you to understand the differences between AT and API coordinators.  With regard to hardware, an AT Coordinator is identical to a API Coordinator.  The difference is the program that is running inside the Coordinator module (firmware).  When AT Coordinator firmware is running, the Coordinator expects ASCII Characters and the Coordinator will be compatible with AT Terminal software that is built into windows such as Hyperterminal.  Hyperterminal can be used to talk to the Coordinator, but it is not a good choice for controlling relays, as the relay command set is more similar to an API Coordinator.

An API Coordinator, once again, is identical to a AT Coordinator, except the firmware program that is running inside the ZB ZigBee module is different.  An API coordinator does not work well with a terminal program such as Hyperterminal (much like our relay controllers).  You cannot send ASCII characters to a API coordinator and expect it to respond properly to your commands.  Instead, you MUST send a properly structured packet of data to the API Coordinator to get it to work.  It is not possible for us to fully explain this structure here, as this topic is very intensive, and is best left to documentation provided by  However, we have provided you with a few program examples that demonstrate using Visual Basic 6 to generate API Coordinator commands.  API Coordinators are significantly more difficult to program than AT Coordinators.  However, API Coordinators will give you EXCELLENT communication speed when you are trying to rapidly communicated to multiple devices on a ZB ZigBee network.

As a general rule, we believe new users should learn how to use the AT Coordinator first.  Once you have learned how the AT Coordinator work, you will see the limitations of using a AT Coordinator.  But by this time, you will have a much more solid understanding of ZB ZigBee networking, and the groundwork will be in place for learning how to use a API Coordinator.  If you are working on developing software for industrial applications, you will most likely want to use the API Coordinator, as there are too many limitations to the AT Coordinator.  But the AT Coordinator will teach you the basics, and there is no better place to start than learning the basics.

Please see the links below for our current catalog of ZB ZigBee Networking Example Software. 

Download Visual Basic 6 Source Code for Communicating with ZB ZigBee Network Devices

The following examples were developed by our programmer, Xu Shirui (  The examples shown below are very similar, but we wanted to share all available examples Xu has developed.  More will be posted as they are developed.  The latest examples are closer to the bottom of the list.

Note: Xu developed this software for use with his devices.  You MUST change the serial numbers in these example programs to match the serial numbers of your devices.  We are still in the process of testing these samples with our devices, so not all samples have been modified to use the serial numbers found in this article.  We are working with Xu to develop more sample programs, but there is more than enough samples here for most applications. Sample1:  AT Example
Contains Three
Sample Programs
Demonstrates Many Features of the ProXR ActiveX allowing simplified communication to obtain information about a particular ZB ZigBee Networking device.  Supports Basic Function for Reading Information About a ZB ZigBee Network Module such as Firmware Version, Serial Number, and Reading/Setting the Pan ID.  Requires NCD ProXR ActiveX Control.
  Sample2:  AT Example
  Uses MSComm Control to Activate Relays on 3 Different Controllers (as shown in the above examples).  You can send commands to one or all devices.
  Sample3: API Example
  Uses MSComm Control to Activate Relays on 3 Different Controllers (as shown in the above examples).  You can talk to each device very easily using this program.  Requires a Coordinator running API Firmware. Sample1:  AT Examples
Contains Three
Sample Programs
This is one of my favorite examples using the MSComm Control.  The code is similar to above examples, but is more streamlined and easier to read for some programmers.  Demonstrates control of all three boards shown in this article using a single routine to target each device.
  Sample2:  AT Example
  Another example similar to Sample 1, uses a different format and can help you better understand how to target ZB ZigBee network devices.  Also uses the MSComm Control.

Sample3:  API Example
  Very Similar to Example 1, but uses API Mode.  Requires a Coordinator running API Firmware.  Uses MSComm Control to communicate to the Coordinator.
ZB Sample1: AT Example

Contains Two
Sample Programs

Similar to Previous Program Examples, Excellent Coding Structure using MSComm Control.
Sample2: AT Example
Similar to Previous Program Examples, Excellent Coding Structure using MSComm Control.

ZB ZigBee Mesh Networking - Introduction to Building Your Own Mesh Network