Shop OBEX P1 Docs P2 Docs Learn Events
Simple XBee to XStick communications[help needed] — Parallax Forums

Simple XBee to XStick communications[help needed]

mlee49mlee49 Posts: 5
edited 2011-12-06 00:57 in Accessories
Hi, I'm beginning a new project using a Basic Stamp 2, XBee 802, and a XStick. The end goal is to connect a sensor and stream data to the XStick's computer, but I'm running into trouble with basic configuration.

Here's what I know so far:

The XBee will be in AT mode and transmit
The XStick will be in AT mode as well and receive
The basic stamp 2 will assist with sensor calculations[unimportant at this time]


Here's what I dont know:

How can I establish basic communications between the two?
Do I need to program the XBee off the stamp 2?
Where is some starter/basic comm code for simple terminal access from one to another?


I really want to understand this application because I find the material very applicable. Any help would be greatly appreciated.
Thanks!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-04 14:20
    There is a utility program you can download from Digi called X-CTU which is used to configure the XStick and could be used to configure the XBee if you had a USB adapter for it. You can configure it using the Stamp although it's not as convenient. Download and read "Getting Started with XBee RF Modules". There's a link to the PDF on the webpage. It has a chapter on configuring the XBee modules.
  • mlee49mlee49 Posts: 5
    edited 2011-12-04 20:54
    Thanks Mike, I have been reading the startup guide and will continue to. I believe I need to assign the XBee a specific Node and the XStick a seperate node. Can anyone confirm this for simple point to point setup?

    Also, has anyone ran the XBee directly to a USB without the SIP board? I have a USB breakout cable and know the +5 and ground, but not sure how the data in/data out get connected to the XBee.

    Thanks a ton for the help!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-04 21:28
    I built my own SIP board equivalent using an FTDI USB adapter cable. The XBee is a 3.3V device and you have to have a 3.3V logic level USB adapter cable as well as a 3.3V power source. Use Parallax's xBee USB adapter schematic for a model. There's a link for it on the product webpage.

    You have to assign a unique node address to each xBee. Assuming you have the IEEE 802.15.4 xBees, you assign the other xBee's node address as the destination for each of the xBees, so xBee #1 connects to xBee #2 and xBee #2 connects to xBee #1. When they power up, they'll automatically connect to each other and you'll have a ready-to-go full duplex serial wireless link.
  • mlee49mlee49 Posts: 5
    edited 2011-12-04 22:10
    Thanks again Mike, I really appreciate your help.

    I cant seem to access the XBee from XCTU when it's in the Board of Education/stamp 2. I should have bought the USB adapter board, but I think I can make shift a cable. I'm not sure if a standard USB cable will do, stepping down the 5 V to 3.3 with a voltage divider. Do I need to use a specific USB cable, or will an old iPod cable work?

    If I can get the XBee to configure in the XCTU software I'll be so stoked. This RF/wireless realm is so amazing! Thanks again!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-04 22:20
    DO NOT use a USB cable. You'll fry the xBee. A simple voltage divider won't work either because the current drawn by the xBee varies a lot and that changes the output voltage of the voltage divider.

    The FTDI cable I mentioned is a USB to serial adapter built into the USB connector end of the cable. The FTDI chip inside it includes a voltage regulator and the necessary logic level translation to 3.3V. It's equivalent to Parallax's USB adapter board.

    Follow the startup guide examples and configure your xBee using the Stamp. It's not hard. Page 49 shows how to turn on flow control, but the same technique can be used with any of the other configuration commands or a series of them.
  • mlee49mlee49 Posts: 5
    edited 2011-12-04 22:49
    Again, thanks man. I did google how to make a home made FTDI cable and saw the reference to a chip.

    I'll hit the manual again a while, see how far I can make it.

    On a positive note, I did configure the XStick with it's own Network ID. Now if I can get the XBee configured I should be able to establish basic communications. :)
  • mlee49mlee49 Posts: 5
    edited 2011-12-05 20:38
    Alrighty! Figured out how to communicate between the two. It was actually very simple, here's how I learned.

    First I read the XBee RF Module Manual(800kB pdf: ftp://ftp1.digi.com/support/documentation/90000982_E.pdf)

    Next I read on the differences between AT and API modes, from there I found out that there are only a few parameters to change to establish communication.

    1) The Channel must be the same
    2) The PAN ID must be the same
    3) The MY or Source address must be different for each module
    4) The DL or destination address will be each others MY address
    5) Simply program these values and write to each module and BAM! Instant communication.

    After rereading the Getting Started with the XBee guide(http://www.parallax.com/go/XBee#downloads) I looked at the Basic Stamp 2 code and saw how they were simply entering command mode. A simple SEROUT is the same as entering the terminal and using the four letter commands. I cant wait to program the XBee through the stamp and complete this project! Thanks for helping and I hope this helps someone else!!!
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2011-12-06 00:57
    Just a short addendum on this topic, the simple fact is that any time you receive the XBee and the XStick from the distributor, both are preprogrammed with a MY address zero, destination DH DL also zero, and also the same pan ID (3332) and channel (12). So to use them as a simple serial link, you don't have to program them at all with AT commands or XCTU. Just send serial data to the serial port of one at 9600 baud and that same data will appear on the serial port of the other.

    Things can certainly get more complicated, but it can be really simple to start. This applies to the 802.15.4 XBees.
Sign In or Register to comment.