Xbee Series 1 Programming - best option and how-to?

Hi, currently I’m trying to program my Xbee using a few APIs available out there, my programming knowledge is at an extreme beginner level.

I have tried the Xbee Java API, my use case is very similar to the PC to Xbee use-case described here:

http://code.google.com/p/xbee-api/wiki/XBeeUseCases

However, for the life of me, I just can’t seem to make the API work, the examples provided just doesn’t work on me.

I am (a little bit) more familiar with C# and the Visual Studio environment so I have tried xbee-api-sharp here:
http://code.google.com/r/huppyphone-xbee-api-sharp/source/browse

I feel that the C# API doesn’t have enough documentation to guide me through it… so it’s a little bit more difficult.

My use case for the Xbee is very simple:
Send command from 1 Xbee to another Xbee to open or close a certain DIO port, on command or automatically, using a GUI on a computer.

So my question is:

  1. Is using these API the best way forward or is there a better/simpler way to do it? (AT mode more recommended? If so, any guide for me to follow?)

  2. If using these API is the best, are there any working samples for me to look? The examples provided in the API doesn’t seem enough to help m solve my problem…

Thanks to everyone’s help in advance!

1 Like

xcen,

  1. Is using these API the best way forward or is there a better/simpler way to do it? (AT mode more recommended? If so, any guide for me to follow?)

The APIs are very useful for interfacing XBees, however, they are not indispensable. If you only need to send and receive a unique frame type you can write your own API frame builder and parser. AT mode will not be enough for you, if you want to send a “Remote AT command” you must use API firmware.

  1. If using these API is the best, are there any working samples for me to look? The examples provided in the API doesn’t seem enough to help m solve my problem…

Here you have an online API frame builder. Also, appart from XCTU you can try ZigBee Operator (www.zigbeeoperator.com). It has a nice frame sender, xbee discovery and parser. They are not examples, but you will find it very useful for sending raw data to the serial port.

The xbee-api library has some good examples, but as fgilmar implied it may be too complex for your use case. I ended up composing my own API mode packets and just using RXTX to send them. When receiving a response, I have my own parser that turns them into understandable data concepts.

I found that the xbee-api library has some threading problems when faced with multiple XBee endpoints. However, I will note that while building my system I successfully used xbee-api to do what you’re talking about - i.e. I sent an API packet that put voltage on a specific DIO pin and lit up an LED. It is possible with xbee-api and is not a complex case, but does require some Java understanding.