Shop OBEX P1 Docs P2 Docs Learn Events
Digital pins on xbee 1 — Parallax Forums

Digital pins on xbee 1

jdoleckijdolecki Posts: 726
edited 2011-04-27 11:44 in Accessories
Can one of the digital pins

DIO0–DIO7/D08

Be used to show a lost of signal, to stop my bot untin signal strength is regained?

Or should I use one of the analog outputs?

I cant seem to find it in any documation.

thanks

Comments

  • johnfosjohnfos Posts: 59
    edited 2011-04-04 08:25
    You can't directly sense loss of signal because the XBee can't tell the difference between no signal and no transmission. But you could achieve the same effect in a slightly more roundabout way.

    The trick would be to use the I/O line passing feature, available on digital I/O pins 0-7. Pick a pin, and at the bot end use (say) a low level on that pin to stop the bot. At the bot end set the IA parameter to the source address of the other XBee, and set the Tn parameter (n being the I/O number) to a suitable timeout value. Set the Dn parameter for that pin to be output low.

    At the controller XBee, tie the same pin to a logic high level. Set the pin's Dn parameter so that it's a digital input. Set the IT parameter to 1, and set IR to a sample interval less than the timeout you established at the bot end. Make sure the destination address is set to the address of the bot XBee - but I assume that'll be the case anyway.

    Unless I've missed something out, the controller should now transmit the state of its input pin to the bot's XBee at time intervals determined by IR. The bot will therefore keep its output pin high. But if transmission is lost the input pin state will stop arriving, the timeout will trigger, and the output pin will revert to the low state as set by Dn. When transmission is regained the pin states will start arriving again and the output pin will go high.

    See whether that helps
  • groggorygroggory Posts: 205
    edited 2011-04-14 15:38
    RSSI could be used for something similar. That holding the line high trick would be cool as long as you don't mind constant polling. I work with a larger xbee network so constant polling is just too bandwidth intensive for me.
  • johnfosjohnfos Posts: 59
    edited 2011-04-15 10:10
    @groggory:

    If you know of a way to use RSSI I'd be interested to hear it. It's just that in my understanding RSSI is only updated when a packet is successfully received, so it wouldn't detect an absence of transmissions due to being out of range.

    @both:

    There is another possibility though. If the controller is programmed to send a "keep-going" packet after a timeout which is reset after any packet is sent to the bot, then the bot's controller could be programmed to shut it down if no packet of any kind is received within (a bit more than) the timeout period. My earlier idea involved nothing more than configuration of the XBees; the software solution would require a bit more effort, but would reduce the packet overhead if that were an issue. And at times of high activity, no "keep-going" packets would be needed at all.
  • groggorygroggory Posts: 205
    edited 2011-04-27 08:44
    Ok, the pin polling/ timeout trick is solid.

    Then layer my RSSI idea on top of that so the bot knows when it's coming near the ouside edge of its range.

    :-)
  • johnfosjohnfos Posts: 59
    edited 2011-04-27 11:44
    ... giving it the chance to send a distress signal.

    Yes, that I like!
Sign In or Register to comment.