Shop OBEX P1 Docs P2 Docs Learn Events
Xbee question — Parallax Forums

Xbee question

computer guycomputer guy Posts: 1,113
edited 2007-07-13 00:59 in Propeller 1
When you are using the xbee in AT mode does the rssi (pwm1) pin still work and does the associated light still change to 2x sec
when it sees another xbee or are they only in API mode.


Does anyone know how to set up the xbee for a zigbee network. i.e. one as a coordinator and the other as an End device.
I need to use the rssi function and associated function lights and as I understand these are only available in a zigbee network (API).

Thank you smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller robot.tmcp.com.au
If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
anthonybmyatt@yahoo.com.au

Post Edited (computer guy) : 7/7/2007 3:43:04 AM GMT

Comments

  • computer guycomputer guy Posts: 1,113
    edited 2007-07-07 03:42
    Can anybody help. cry.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-07 03:53
    CG,

    You don't need to be using the ZigBee firmware for RSSI.· You can either do it by requesting the RSSI level using the ATDB command, or flip it into API mode.· I recently posted an XBee object that allows for both modes to be used.

    There's so many ways they can be configured, it's difficult to give a·off the cuff·example.

    Tell me what you are trying to accomplish and I'll try to write some code using the object that would accomplish it.· Though I think all my units are at the University until I head back over there Sunday, but I can try to wing it.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-07 04:25
    Thanks Martin

    I have an xbee connected to a comparator for the rssi (a led bar).
    I am sending a particular number from an adc chip (control) to another xbee that will read the number into a variable (robot).
    I also have plans to add an lcd to the first xbee, prop pair (control).

    I just need some example code to start the API mode and send data.
    Will the associated light work with API, it doesn't with AT mode. Or do you need a zigbee network.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au

    Post Edited (computer guy) : 7/7/2007 7:20:18 AM GMT
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-07 16:24
    Hi CG,
    The big difference between AT Command mode and API is the AT mode is transparent, it simply passes the data to you.· In API mode, the data is packaged as a frame with data such as source address, RSSI level, checksum information, etc.· The receiving unit must parse out the various bytes.· This is part of what my object does.· Also, in API mode, it allows the reception of automatically sent ADC/Digital data from the XBee directly.· A new version of the library I am using returns these values also.

    The Assoc indicator is used when an XBee has been setup as a coordinator and the others are end points.· I does not require ZigBee firmware.· I've not dealt with using them as coordinators, so can't say what's up there.· If you are just·trying to ensure comms, your base XBee could send a packet out and the acknowledgement status can be read.

    As to RSSI, I guess you are using the PWM pin to drive an LED through the comparator?· It may be easier to read the RSSI as data instead and control some LEDs via the Prop.

    I know you've been at this a while, so let's take a step back and give me brief once again on what you are trying to accomplish over all and maybe we can look at this fresh before I code some examples that you don't need.· Talk me through it all.

    Also, are you able to upgrade the firmware on the XBee currently?

    -Martin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 01:29
    Ok I have a robot with 2 motor controllers and a prop.
    The motor controllers work off of a servo pulse.
    I have attached an xbee pro up to the prop and am going to use it to receive an adc reading to control the motor controllers and 2 servos.
    That same xbee pro in the near future will also send out a byte (message id) and then a string (message).

    I have a controller I am building with a prop and adc0834 and an xbee pro.
    I plan on reading in 4 adc values into separate variables (say rob_x, rob_y, cam_x, cam_y).
    Then turning these into numbers that can be used by the servo_32 object.
    The values will then be sent via the xbee pro to the robot.

    The message id and message will be to tell the receiving prop what type of message it is (i.e. rob_x, rob_y, cam_x, cam_y, message - for lcd on controller).
    The message id will be 1, 2, 3, 4, 5.

    So I will use
    message_id = XB.rx()
    switch (message_id)
        case 1:
            'receive rob_x value
            rob_x = XB.rx()
        case 2:
    
    



    and so on.

    Thank you for your help smile.gif
    I hope this is enough information for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 01:38
    When you say "I have attached an xbee pro up to the prop and am going to use it to receive an adc reading to control the motor controllers and 2 servos.", you simply mean you are going to send 4 values (which eventually come from massaged data from your controller ADC)? I think this is where i was getting a little confused.... SO, no transmission of direct ADC data needed, right?

    And you are going to send the values one at a time preceeded by the ID number to be evaluated? So a data packet would be:
    <ID><Value>

    Am I on the right track?
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 01:41
    Yes the adc value will come from the adc chip not the xbee adc input.

    and I will send an id number and then the message.

    The id number will be to tell the robot what variable to put the value in.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au

    Post Edited (computer guy) : 7/8/2007 2:00:50 AM GMT
    909 x 690 - 35K
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 01:55
    Yes, but when you say ADC value, you really mean a value sent from the controller board's XBee. Sorry to be so fussy on this, but using the term ADC is not really appropriate since it's not an ADC's value you are readiing diectly, but a value sent to it from another Xbee - whatever the original source of it.

    I could probably code this and cross fingers, but I'd rather wait until tomorrow when I have a complement of hardware.

    Have a good night!
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 01:58
    Yes the controller will send the value and the robot will receive the value.

    For lcd messages it will go the other way robot will send message and controller will receive it.

    I have attached a picture to my other post if it helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 02:46
    Sorry, I had missed the image, I read it from Email :P

    Also, you talked about RSSI in an earlier post, would using code to control LED's be OK to indicate signal strength? Though not very linear, it would be interesting to use the RSSI value to PWM an LED so that it dims as strength goes down!

    I'm not going to write all this, but enough to get you started with code I know works... though it does sound like fun [noparse]:)[/noparse]
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 02:54
    The LM3914 chip is meant to get a varying voltage and turn the lights on depending on what the voltage is compared to the vref.
    I could use a single led and dim it for testing though.

    Thank you smile.gif

    All I need is some code to get me started and I should be able to pick it up from their with some comments in code.

    Once again thank you so much.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 03:04
    OK, but you know you'll need to filter the PWM output of the Xbee 1st so that it's analog and not pulsed digital. My prefernce is to off-load un-necessary hardware where possible. If you have 10 open I/O on the Prop, a little code would be all it takes, and you'll be getting RSSI levels with every reception.

    Ok, enough of my 2 cents on your project! [noparse]:)[/noparse]
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 03:12
    Thing is I already have the LM3914 chip on the controller and the leds all wired up.

    What do i need to do in order to filter the pwm output on the xbee?

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 03:24
    For filtering you can look at the pulse-width/frequency of the PWM pulse, and calculate an RC combination that would provide a low-pass filter below that based on 1/2piRC (roughly).· But since the updates will be pretty slow (based on when data is received), you can simply experiment with maybe 1K R and a 1uF cap. - The resistor goes in series, the cap is after the resistor to Vss.· In creasing either will improve the filtering, but too big will make it sluggish response.

    ····················
    PMW out ---/\/\/\/\------- LM3419
                   |
                   =
                   |_Vss
    

    One thing that might mess it up is the input impedance of the IC as it may drain the cap too quickly if too low, but if it's simply feeding comparators, it should be OK.

    -Martin
    ·
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 03:34
    What like this.

    Picture attached.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
    312 x 137 - 4K
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-08 03:41
    Yup, you may also want to check the Xbee docs to ensure it is normally low and not inversed, otherwise your indicator will work backwards.
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-08 03:45
    Thanks will do.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-09 00:38
    OK CG,

    Here ya go. A little discussion on it:

    Code assumes your control base is at Address 0 (MY=0) and the Robot is at address 1 (the code configures the XBee', so use default XBee settings).

    To ensure the ID and values/message arrive as a whole string so that a missed packet doesn't cause issues with being synchronized, I·concontenated both ID and value/message into a single transmission that takes the byte format of:

    <ID - 3 bytes,eg: 01)><null 0 for string end><value or message variable length><rest are null 0's>
    or
    < 05><0><Hullo Pippin!><0>

    On the receiving end, they are parse out again.

    The string is limited to 16 bytes, but written to be easily changed.· The RSSI level is also displayed.

    I had some odd results getting the recieved value to be correct, but hoping it's due to my manually sending the strings (don't have 2 props ready to go right now). Using Parallax's numbers object, so should be good there.

    It's pretty well commented and extensible/modifyable.

    Also, MY APOLOGIES!!!! When I posted an update to the XB object I neglected to include the example file in the archive!!· I'll get a new one sent up soon.·

    It's also possible to confirm a packet is acknowledged when sent, but I didn't put in this example. Got to get ready for 12 teens to storm my Robotics camp in the morning!!

    The attachments are the archived base code with all files, and just the robot's file alone - save to same directory.

    Let me know how it goes or if you have any Q's.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies

    Post Edited (Martin Hebel) : 7/9/2007 4:15:27 AM GMT
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-09 03:05
    Thank you nice code and lots of comments.

    I am assuming that the same code could be used on the control as on the robot, I would just need to change the Base_addy to 1.
    I did however notice that there was no example for sending data only receiving.
    How would I send the Id number and message together. So that the other end can receive it.

    Thank you Martin smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-09 04:09
    I could have sworn I had the file base controller tab selected when I made the archieve, but apparently I gave you 2 copies of the robot's side.
    Attached....

    You simply need to reverse the code between the 2 for data robot-->base.

    Sorry (though I claim IDE bug!)

    -Martin




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies

    Post Edited (Martin Hebel) : 7/9/2007 4:16:32 AM GMT
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-09 04:11
    Thats all right I fully unerstand.

    Thank you and great code.
    This will help a great deal with my robot and I will give you credit on my website.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-09 04:29
    You are welcome, looks like a heck of a robot you have going there! My 'free' weekend is over, so I may be slow with responses for a while, but I'll answer when I can.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-11 06:42
    Martin

    I just noticed that my rssi led bar is not so accurate.
    In fact I lose the signal when the bar is at about 50%

    Could this be because I am using a 10k resistor rather than the 1k you specified earlier, or is it something else.

    Thank you smile.gif
    Computer Guy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au

    Post Edited (computer guy) : 7/11/2007 7:49:14 AM GMT
  • computer guycomputer guy Posts: 1,113
    edited 2007-07-13 00:21
    Martin

    This should be the last question... I hope.

    If anyone else can answer my question please go ahead, you would make my day.


    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my robot using the propeller robot.tmcp.com.au
    If you offer cheap PCB fabrication, perl programming or any other helpful services please email me at.
    anthonybmyatt@yahoo.com.au
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-07-13 00:59
    The docs say the PWM amount should be 24% - 100% based on RSSI, so 24% of 3.3V to 3.3V after filtering. Given a period of 64uS, this would define a frequency of 16K approx. Therefore you want your filter to be less that this. Using 10K and 1uF for 1/2piRC, this would be a cutoff freq of 15Hz. Using 1K, would be 159K. The signal lasts a couple seconds, so either should be fine.

    To tell the truth, I've tried the output before and it didn't make a lot of sense to me in what I was seeing on the scope. If the numbers above don't help in figuring things outs, I'd recommend putting it on a scope and trying to figure it out. Don't have time for it here right now, sorry!

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
Sign In or Register to comment.