0

I'm new at using Xbee and I would like to get some help on how to interpret API packets. Me setup consists of two arduino unos, two xbee S2, two xbee shields and a one magnetometer sensor HMC5883L. The sensor is connected to the arduino via I2C and transmitting the data to the xbee (router) using serial communication. On the other side (coordinator) I'm reading and displaying the data on the serial monitor. I have read the data sheet of the xbee but I still can't figure how to interpret the packet. Here is a screen shot of the values that I'm getting on the serial monitor on the router and the corresponding packets on the coordinator's serial monitor. enter image description here

There are four bytes that are changing each time so how can I translate them to an integer value. Any help would be greatly appreciated.

asked Nov 9, 2015 at 19:30

1 Answer 1

0

You have a bunch of "stuff", followed by the data you sent, followed finally by another bunch of "stuff". I don't know what the "stuff" is, but I can see and decode your data easily enough.

I suspect you transmitted the data using .println(...). That will send an ASCII representation of the data.

So to take the line: -196.88<CR><LF>, if we find the ASCII values and represent them as hexadecimal we have:

2D,31,39,36,2E,38,38,D,A

Which I am sure you can find in one of those lines - maybe this one:

0,15,90,0,13,A2,0,40,C1,A8,2E,98,8D,1,2D,31,39,36,2E,38,38,D,A,3B

So you have 14 bytes defining something interesting about the packet (I'm sure Google can tell you what - source and destination maybe, probably a packet length too), then your data, and finally what looks like it's probably a checksum.

answered Nov 9, 2015 at 20:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.