Shop OBEX P1 Docs P2 Docs Learn Events
Having problems with Xbees digital pins — Parallax Forums

Having problems with Xbees digital pins

RagtopRagtop Posts: 406
edited 2012-03-25 05:35 in Accessories
My goal is to attach an (active low 3.3.v) motion sensor pin to the the Digital 0 pin of an xbee to have another xbee at my computer desk turn on and off an led.

But right now I am just trying to attach a button (3.3v active high) to one and attach the led to the same pin on the other xbee.

I have verified communication with the two xbees by looping back the signal lines. I have used x-ctu to change the button/xbee D0 pin to digital input and the led/xbee D0 to output/high.

The problem is that the led stays on no matter the state of button. I removed button and placed the D0 wire to ground and power alternately with no change in led.

Is there something else I have to set in x-ctu?

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-03-24 09:58
    On the remote XBee, set a sample rate like, ATIR32 for sampling at 50ms intervals. On the base XBee, it needs the ATIA command to bind it to the remote. Say the MY of the remote is 1234. Then the base needs ATIA1234.
  • sylvie369sylvie369 Posts: 1,622
    edited 2012-03-24 10:33
    Did you also set IT and IR?

    It has been over a year since I last messed with this, but I believe that you have to set the Sampling Rate (IR) and the Samples Before TX (IT) on your transmitting XBee to get this to work properly. I had success with a project using settings of IR = $1F4 (500 mSec sampling rate) and IT = 2 (two samples before transmit). The default for IR is 0, and that may be your problem.

    (later: )

    Oh, I see Tracy beat me to this. Yes, I also set the IA on the receiver XBee to match the transmitting XBee's MY number in the project I had working properly.
  • RagtopRagtop Posts: 406
    edited 2012-03-24 12:07
    Not sure I am getting which unit to IA or MY. So tried it either way with no luck. Then I tried giving them each a separate MY address but that didn't work either.

    LED XBEE
    +++
    ATIR$1F4
    ATIT2
    ATMY1234
    ATIA5678
    ATCN

    Button Xbee
    +++
    ATMY5678
    ATIA1234
    ATCN
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-03-24 16:19
    The remote needs to have the destination address set, and only the base needs the ATIA

    base: LED XBEE
    [SIZE=1][FONT=courier new]+++        with guard time!!
    ATMY 1234     the remote uses this as its destination
    ATIA 5678      the base will bind its outputs to this MY address
    ATDO 5        the base will hold this pin normally high unless the remote button goes low
    ATCN[/FONT][/SIZE]
    

    remote: Button Xbee
    [SIZE=1][FONT=courier new]+++     with guard time!
    ATDL 1234    ' remote sends to base at this address
    ATMY 5678  ' the button state will come from this address
    ATDO 3     ' XBee will input state of this button, low when pressed.
    ATIR 64    ' transmit a packet every 100 ms.   ($64)
    ATCN                         [/FONT][/SIZE]
    

    That is minimal. There are a number of other parameters that could affect the result, but the default values should be okay. For example, the default is one 1 sample per transmission, so you shouldn't have to mess ATIT. The button should be set up active low, and the XBee's built in pulllup resistor will pull it high when inactive. If you have the base hooked up to your computer and a terminal program, you should be able to see the packet that is received every 100 ms.

    There is a good knowledgebase and forum at Digi, here also an article specifically on digital line passing.
  • RagtopRagtop Posts: 406
    edited 2012-03-25 05:35
    Thank you so much! That got it.

    It was way more complicated then I thought it would be, but I just want to temporary attach the xbee to my camera control box without having to modify it's propeller code to talk to the xbee.
Sign In or Register to comment.