Transmit AND receive data from two XBee (ZigBee) S2 radios in ROUTER mode

I currently have a 3 XBee (ZigBee) module network I am trying to troubleshoot.

I want to ideally have 4 XBees, but that’s later.

So my current 3 XBee module network has 1 coordinator, 2 routers. I followed this guide:

It works perfect for 1 coordinator, 1 router.

Now each router is connected to an Arduino Uno with 3-4 sensors each. It transmits/broadcasts 3-4 lines, 1 for each sensor every second or so. So does my other router (2 routers total).

Now my coordinator (hooked up to an XBee USB board to my PC) can see the data being received in the X-CTU terminal. However, there is an issue with the data/lines being jumbled up between Router 1 and Router 2 (R1 and R2 from now on).

I ASSUME that R1/R2 can talk to my coordinator (C), and it can. I have tried to sent data from C to R1 or R2, it recognizes it. I have received data from R1 or R2 to C (obviously), and I can see it.

However my solution for the “synchronization” or data is summarized as having a flag that broadcasts “I’m done” from R1 which I want R2 to read/receive and then start broadcasting/transmitting R2’s sensor data. Then R2 says “I’m done” to R1 and repeat for infinity.

I have tried to implement this with NO luck.

This is what I can get out of my situation.

  1. I can transmit/receive from coordinator (C) to router (R1 or R2). I can do it from both simultaneously obviously, which is my main issue I want to fix.
  2. I CANNOT get my routers (R1 and R2) to recognize anything they broadcast, but it will recognize anything C broadcasts (when I try to send something via Terminal in X-CTU).

I want to ultimately poll/sync the outputs of my Arduinos + Routers so they don’t output at the same time
Get my XBee Routers (R1/R2/R3/etc) to receive broadcasts they send out. They only recognize coordinator (C) broadcasts.

If anyone has an alternative solution, I would appreciate it.


1 Like

The default configuration for ZigBee is as follows:

Coordinator’s destination address is a broadcast (DH=0, DL=FFFF)
Router/End Device’s destination address is a unicast to the coordinator. (DH=0, DL=0)

0 is a reserved address for the coordinator, FFFF is a reserved address for a broadcast. So if you want a router to talk to someone other than the coordinator, you just have to set the destination address accordingly.

The radio’s address is the serial number. It’s a 64-bit number broken into two halves (Serial High, and Serial Low). The easiest way to find this is to do a read and note the SH and SL. On the opposing router, put these two numbers in as your destination address (DH=SH, DL=SL). Alternatively, you could put in a broadcast address (DH=0, DL=FFFF) and everyone will hear your message.

The other option is to use API mode. This way you specify the destination address on a per-packet basis. This is a lot more complicated because you also have to format all of your data into a particular format. If you are using an Arduino, there’s a library out there that will do all of the heavy lifting for you. You can have a mix of API and transparent (AT) radios on the network, which can make things easier…

Since you are concerned with the coordinator getting jumbled data from the routers, you could set the coordinator to be in API mode, and leave the routers in AT. The data you receive will be in a frame that will include the source address. So you can more easily parse who sent what.

Page 23 of this guide can describe it better than I can:

Hye…Im doing my final project…I use 3 zigbees(2 router 1 coordinator) and 1 arduino uno.

Each router has different sensor(magnetic door sensor and motion sensor) and coordinator attach to arduino uno.

Now i faced similar problem with refinery…I dont know how to make the 3rd zigbee(router) communicate with my 1st zigbee(coordinator)…what is the coding I have to put in my arduino uno, so my coordinator know which one is motion sensor or magnetic door sensor. thank you for helping me…

I figured it out but it was several months ago.

I ended up having all routers continuously transmit data to the coordinator and only let the coordinator accept data from the proper router (so there wouldn’t be crosstalk between simultaneously incoming data from the routers).

I had 3 routers, 1 coordinator. Each router was labeled A, B, C. My coordinator Arduino code was accepting data from router A, making sure it receives all of router A data (checking with if the “done” line is received, then move on to next router), then goes to router B, then C, then back to A in an infinite loop.

I couldn’t figure out how to get the coordinator to talk to the routers (as in the routers receiving data, not only transmitting), so there was only 1 way communication between the routers and coordinator unfortunately.

I am sure there is a way for routers and the coordinator to talk between one another (transmit and receive) but this was the solution I came up with for my project due to deadlines.

I recently made a tool that allows you to do exactly this -

This is pretty much what I needed, just you know, 2 years ago. I don’t mean to be negative, but I eventually did figure it out. Long story short, I ended up having a filter for each router so my coordinator could identify the source of the data.

My solution was really a workable band-aid but yours is a fully-fleshed answer to my problem.

Thank you,

Ha yeah, I thought it might be a bit late for you. I had the exact same requirement and decided to develop something to do this after not being able to find a solution (I stumbled across your question early into my search).

Hopefully someone finds it useful :slight_smile:

can u please share your tx and rx arduino codes.
i am working on wireless sensor network for industrial applications through xbee and arduino.
i had configures xbees in API mode and got strucked in coding…please help me in this issue.
syed saleela

I am that someone. Thanks to everyone. This was really helpful. I am doing a full API mode setting. Just starting but all the links above and the replies really cleared the picture for me. Thanks again

Hey, I was working on the same thing. I was wondering if you could give me some pointer and clear few doubts( too elaborate and specific for this column). Please help me my project is due in a week. Please leave a comment or PM me on Digi and we can talk over email.

I might be able to answer a couple of smaller questions in a reasonably timely fashion.

I can’t seem to work out how to PM on here, my twitter handle is @BleckyWhat. Or you can open an issue on the GitHub project.

With the review of
it cannot define the R1 and R2 in my device properly, so, please give me some more details on it.

This project uses a Cypress microcontroller. If the reader is using a different host microcontroller, this project can still demonstrate, conceptually, what is required to interface with an XBee module. The reader can still view the example code and use it to re-create the application in the desired microcontroller software development environment. For router support visit:

Hello sir
Respected sir how I can I transmit data 2 ZigBee and recieved one ZigBee