How can I convert packets received from router XBee to usable data?

Good day!

I have 3 XBee PRO Series 2 Module, 2 Xbee PRO Shield, 1 Xbee 3.3v/5v Adapter and 1 Arduino UNO.

I’m currently using this connection:
PC <–> Arduino <–> XBee (C) ~~~~ XBee (R) <–> Sensor
~~~~ XBee (R) <–> Sensor

I’m trying to read the XBee serial address and the sensor values transmitted by the router.

This is the code I’m using in the coordinator side of the arduino:


void setup(){

void loop(){
if (Serial.available() >= 21){
if( == 0x7E){
for(int i=1; i<24; i++){
Serial.print(": ");

    Serial.println(discardByte, HEX);


The problem is I receive garbled bytes from the router.

These are the bytes I receive and the should be description:

7E - start byte
00 - length
92 - frame type
00 - 64bit source address
7D (should be, 0013A200, 40B77006)
56 - 16bit network address
01 - receive option
01 - number of sample set
00 - digital channel mask
01 - analog channel mask
02 - digital sample data
2D - analog sample data
FF (should be 2 bytes every pin set)
FF - checksum
(should be 8bit sum minus 0xFF)

I disabled digital i/o except assoc and rssi and enabled 1 analog pin for temp sensor

1 Like

You should for sure try running the xbees in AT mode. “Transparent” mode removes all of the packet problems and allows you to see just the data you have transmitted. Doing this will eliminate any other errors you might have while working with your system.

Are the sensors connected to the UART or one of the radios ADC lines?

1 Like

Thank you for the reply but I’m afraid I can’t use AT mode because I’m using 3 XBees. Can you suggest another option?

Thank you for the reply. Both router xBees has a sensor connected to it’s analog pin 0 (AD0)–no digital pin is used except for assoc and rssi.

Try it first with two xbees to make sure it works

Try following the article located at


I tried it with two xbees. I configured the first to ‘Zigbee Coordinator AT’ and the second to ‘Zigbee Router AT’. I used 2 computers to enable the xbees to “chat”. Everything seems to be working fine. I can’t check the bytes though because I can only do it if the coordinator is configured as API.

I suggest you to include micro-controller to your Router. I can see from your post that you are using micro controller for coordinator. I think your router is not able send packets properly.

1 Like

Please check this

1 Like