I looked into automatic channel selection with XBees.

Going from the manual [1], I found out that these options work, mainly the settings for ATA2 and ATA1 are interesting:

Configure the coordinator with:

ATA2 6    // 0b110 : allow associations (bit 3), automatic channel select (bit 2), fixed pan id (bit 1)
ATCE 1    // coordinator enable
ATAP 2    // API mode 2 (with escaped characters)
ATID 7970 // pan id
ATMY 1111 // address of the coordinator
ATDL 1    // destination address low bytes
ATDH 0    // destination address high bytes

Configure the nodes with:

ATA1 6    // 0b110 : use automatic association (bit 3), automatic channel select (bit 2), fixed pan id (bit 1)
ATCE 0    // coordinator enable
ATAP 2    // API mode 2 (with escaped characters)
ATID 7970 // pan id
ATMY 1    // address of the coordinator (or ATMY 2)
ATDL 1111 // destination address low bytes (address of coordinator)
ATDH 0    // destination address high bytes

What will happen according to the manual is that the coordinator upon startup will scan the channels (different frequencies in the 2.4 GHz range) for the one that has the least energy on it. Then it will pick that one.
The nodes will look for a coordinator on any channel that matches the pan ID they have, and switch to that channel.

As a side effect the MY address of the XBee on the nodes is reset, so this is solved by setting it in the node firmware to the desired address again.

[1] XBeeManual

 

Steps in programming the wireless receiver:

  • Connect both USB and the AVR ISP mkII programmer to the board
  • Open the Arduino sketch in the Arduino IDE
  • Select the “STEIM wireless receiver” from the Board menu
  • Compile the code
  • This makes a temp directory with the hex file in (e.g. on Linux) /tmp/buildXXXXX.tmp/wireless_receiver_1_4.cpp.hex
  • Then use avrdude to burn it to the flash:
    avrdude -c avrispmkII -p m328p -P usb -U flash:w:/tmp/build4971464468714801572.tmp/wireless_receiver_1_4.cpp.hex
  • The output will be something like:
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.00s
    
    avrdude: Device signature = 0x1e950f
    avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "/tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex"
    avrdude: input file /tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex auto detected as Intel Hex
    avrdude: writing flash (8492 bytes):
    
    Writing | ################################################## | 100% 2.64s
    
    avrdude: 8492 bytes of flash written
    avrdude: verifying flash memory against /tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex:
    avrdude: load data flash data from input file /tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex:
    avrdude: input file /tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex auto detected as Intel Hex
    avrdude: input file /tmp/build4497645872316412355.tmp/wireless_receiver_1_4.cpp.hex contains 8492 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% 2.43s
    
    avrdude: verifying ...
    avrdude: 8492 bytes of flash verified
    
    avrdude: safemode: Fuses OK
    
    avrdude done.  Thank you.
    
Jan 052012
 

Sorry you have no rights to view this post!

 

Sorry you have no rights to view this post!

 

Sorry you have no rights to view this post!

© 2012 STEIM R&D Suffusion theme by Sayontan Sinha