Shop OBEX P1 Docs P2 Docs Learn Events
Xbee with BoeBot — Parallax Forums

Xbee with BoeBot

DiablodeMorteDiablodeMorte Posts: 238
edited 2010-03-02 20:16 in Robotics
I just finished a project of mine. When I say "finished" I actually should say "I got it to a stage in which I could conceivably present it without it failing miserably"


PLATFORM:
The platform is a stock Serial BoeBot that I won at a robotics camp I attended this summer.

MODIFICATION:
The modification is a XBEE Series 2 Zigbee Module by Digi/MaxStream

WHAT'S COOL:
Instead of simply using the Xbee's ASCII(AT Command Mode Firmware) wireless transmission I opted for the API firmware. For those of you that havn't used Xbees: they are small RF radios which follow the Zigbee standard and are usually used in data collection because they autonomously form networks with fellow xbee's and manage packet routing. The AT Command firmware allows the execution of AT commands(Similar to Modem commands) and also allow the transmission of HEX or ASCII packets to all xbee's in the network. The API firmware steps it up a notch by requiring a whole new format of each message. API allows the transmission of a packet to a particular xbee(which can be achieved in AT Command mode buts it's not as fast).
Because I opted for API I had to program the bot to recognize these packets and then handle them. The commands are very very simple(Forward, Backward, Stop, Left, Right) and they are issued via a Visual Basic program to a "coordinator" xbee(kinda like a "master" router). I also used the SERVOPAL by Parallax to control the servo's.

PROBLEMS:
I ran into several problems in this project. The first of which was the actual creation of API packets. As it turns out API packets require checksums and lengths which I had a hard time calculating(I dropped a 0x00 in the 64bit address). My second problem arose when I tried to send information to the xbee via Visual Basic. As it turns out, visual basic's SerialPort control doesn't state that it will send Byte data, it only shows the use of string data. After I figured out that it will send Byte data I was golden. With that solved I ran into another problem. I couldn't get a reliable read of the serial data when I sent data to the BoeBoe very quickly. The Xbee's are not designed to be very fast. They have inherient overhead to ensure that data gets to the target(Kinda like a TCP approach, I need UDP). I'm fairly confident these can be overcome as I have seen atleast one company controlling a robot in real time very quickly but my approach was to actually set a restriction timer in the Visual Basic program that nullified all commands until a alloted time had elapsed.

PICTURES:
Attached
Picture 1 = BoeBot and Xbee w/ Xbee Dev board
Picture 3 = Xbee Dev board
Picture 4 = Another view of BoeBot and Xbee w/ Xbee Dev board

VISUAL BASIC CODE:
Attached

BASIC CODE:
Attached

Regards,
Diablo

Post Edited (DiablodeMorte) : 1/25/2008 12:19:23 AM GMT
1280 x 960 - 683K
1280 x 960 - 657K
1280 x 960 - 645K

Comments

  • BergamotoffBergamotoff Posts: 20
    edited 2008-01-24 07:12
    Good work and excelent description!!!
    Thank you for contributing you knowledge [noparse]:)[/noparse]

    Looking forvard to see other your projects!

    Janis
  • Rob7Rob7 Posts: 275
    edited 2008-01-27 17:26
    Diablo,

    What version of microsoft Visual Studio Solution are you using?
    I receive (unrecognized version) when I try to open it and cannot.
    Is It the Visual Studio 2008 Express Edition All-in-One ?

    Rob7

    Post Edited (Rob7) : 1/27/2008 5:34:40 PM GMT
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2008-01-27 18:33
    Rob7 - I didn't know there even was an "all in one" version. From my Visual Studio's About:

    Microsoft Visual Studio 2008
    Version 9.0.21022.8 RTM

    Products Installed:
    Microsoft Visual basic 2008 91908-152-0000043-60604

    Hope that helps!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Current Projects:
    Robot Control Via Skype API - Dev Stage(50% Complete) - Total(25%)
    Robot Localization Via Xbee's - Research Stage
    IR Tracking with Propeller - Research Stage
  • labheshrlabheshr Posts: 10
    edited 2008-02-07 05:53
    Hi !

    Good job!

    Can u tell me what RF protocol did u use exactly for controlling the boe bot?

    Thanks;
    Labhesh.
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2008-02-09 14:00
    labheshr said...
    Hi !

    Good job!

    Can u tell me what RF protocol did u use exactly for controlling the boe bot?

    Thanks;
    Labhesh.

    I'm not sure exactly what you mean by "Protocol." I sent data using the Xbee Zigbee API. I sent 5 data "chunks." The first was the command and the other are reserved for later. Xbee receive packets contain lots of data such as the 64bit address of the sender, the 16bit address of the sender, status and so on. In my code I simply skip all this data and get right to the data I want [noparse]:)[/noparse]

    Hope that helps, I can pull out the actual Xbee Hex code for Transmitting and receiving if needed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Current Projects:
    Robot Control Via Skype API - Dev Stage(50% Complete) - Total(25%)
    Robot Localization Via Xbee's - Research Stage
    IR Tracking with Propeller - Research Stage
  • kareskkaresk Posts: 2
    edited 2009-12-03 00:40
    Hey hey,

    Nice work!

    I am trying something similar with many BoeBots that have Xbees on them but I have a problem with communication.

    I see in your bs2 file that u don't set the address of the Zigbee?
    And the only thing is SERIN SI, Baud, [noparse][[/noparse]WAIT($7E),SKIP 13,dat1]
    What does this do?

    I try simple communication but it sometimes works sometimes not.
    Did you have similar problems?

    Thanks a lot in advance
  • Harrison H JonesHarrison H Jones Posts: 22
    edited 2009-12-05 05:15
    What he is doing is waiting for a start bit(HEX $7E) and then skipping the next 13 bytes of data, and get getting the data he wants. As far as setting the address.. Xbee's have hard-coded 64bit addresses. I don't think you need or even can change them.

    Hope that helps
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-12-05 17:31
    Harrison H Jones said...
    What he is doing is waiting for a start bit(HEX $7E) and then skipping the next 13 bytes of data, and get getting the data he wants. As far as setting the address.. Xbee's have hard-coded 64bit addresses. I don't think you need or even can change them.

    Hope that helps
    XBees do have hard-coded addresses (referred to as "serial numbers", held in the SH and SL registers), but they also have separate addresses that can be changed either in configuration (XCTU or a terminal program) or on the fly through your microcontroller. Each XBee module has a 64-bit destination address (usually separated into a 32-bit DH and a 32-bit DL), and a 16-bit·source address ("MY"). As far as I can see, the DH is normally left at 0 and the·32 bits of the DL are used as "short addresses".

    (disclaimer - I'm working with Series 1 XBees. The Series 2 might have some differences)

    If you set one module's "MY" to 0, it will only receive data transmitted by modules whose DL is also 0.
    If you set one module's DL to 0x0000FFFF, it will be set to broadcast, and its transmissions will be received by all other modules in range, regardless of their MY settings.

    I'm have all of my XBee modules set up with their own MY addresses in the non-volatile configuration memory. However, I'm using several of them to receive from a module that has its DL set to 0 (that is, the transmitting module is only sending to modules whose MY is 0). I'm doing that rather than broadcast because the broadcast mode does not do acknowledgement and retries (since it assumes many different receivers). I expect to only receive through one module at a time, and I'm not sure what effect multiple receivers with the same MY setting has on acknowledgement and retries (so far it just simply seems to work fine, but maybe when one of the receiving modules gets out of range problems will appear).

    Anyway, rather than setting the receiving modules MY addresses to 0 through the configuration software, I have the processors they're connected to temporarily setting them at powerup. One of them is connected to a BS2PX, and the other to a Prop Protoboard. Both work fine. There's probably a more eloquent way of doing this, but I'm just trying to get things working the way I like them.
  • kareskkaresk Posts: 2
    edited 2009-12-05 18:23
    Uh...Too much info...

    From the official site of the Xbee I got a manual with sample codes how to send and receive but with configuring the Xbee's at the start and then send messages between.
    so I am using the code:
    HIGH TX

    DEBUG CLS, "Configuring XBee..."
    PAUSE 2000 ' Guard time for command sequence
    SEROUT TX,Baud,[noparse][[/noparse]"+++"] ' Enter command mode
    PAUSE 2000 ' Guard time for command sequence
    SEROUT TX,Baud,[noparse][[/noparse]"ATNI BS2 Test Node",CR, ' Set description
    "ATMY ", HEX myAddr,CR, ' Set node address
    "ATDL ", HEX DestAddr,CR, ' Set destination node address
    "ATD6 1",CR, ' Use RTS for flow control
    "ATCN",CR] ' Exit command mode

    PAUSE 1000
    DEBUG "Configuration Complete!",CR
    RETURN

    where myAddr and destAddr are the addresses of each vehicle and I want them to send some data between them.

    Also I use
    PAUSE 20
    SEROUT TX,Baud,[noparse][[/noparse]"+++"] ' Enter command mode with minimal guard time
    PAUSE 2
    SEROUT TX,Baud,[noparse][[/noparse]"ATDL", HEX DestAddr, ",CN",CR] ' Update DL for polling
    RETURN

    to change the destAddr.

    When I do this and then try to send simple data like
    SEROUT TX, Baud, [noparse][[/noparse]"H", CR, CR] - at the sender every second or two
    SERIN RX, Baud, [noparse][[/noparse]poraka] - at the receiver

    sometimes the received data is different, sometimes nothing is received, sometimes something else is wrong..

    How can I have a secure communication?
    That is what is bothering me
  • logan996logan996 Posts: 281
    edited 2010-03-02 20:16
    Hey diablo where did you get that XBee devboard?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When the government is afraid of the people there is liberty, when the people are afraid of the government, there is tryanny"


    ·Thomas Jefferson
Sign In or Register to comment.