Home/Support/Support Forum/How can I convert packets received from router XBee to usable data?

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

+1 vote
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:
#include <SoftwareSerial.h>

void setup(){
Serial.begin(9600);
}

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

byte discardByte=Serial.read();

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
12
92 - frame type
00 - 64bit source address
7D (should be, 0013A200, 40B77006)
33
A2
40
B7
70
06
56 - 16bit network address
B3
01 - receive option
01 - number of sample set
00 - digital channel mask
00
01 - analog channel mask
02 - digital sample data
10
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
asked Oct 27, 2014 in IEEE 802.15.4 by jiasheen New to the Community (1 point)
edited Oct 26, 2014 by jiasheen
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.
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?
Try it first with two xbees to make sure it works
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.

Please log in or register to answer this question.

4 Answers

+2 votes
Try following the article located at http://www.digi.com/support/kbase/kbaseresultdetl?id=3522.
answered Oct 31, 2014 by mvut Veteran of the Digi Community (11,393 points)
+1 vote
Are the sensors connected to the UART or one of the radios ADC lines?
answered Oct 29, 2014 by mvut Veteran of the Digi Community (11,393 points)
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.
+1 vote
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.
answered Feb 4, 2015 by Love_Micky New to the Community (12 points)
+1 vote
Please check this http://ab-log.ru/files/File/books/WirelessSensorNetwork.pdf
answered Feb 4, 2015 by Love_Micky New to the Community (12 points)
...