Making a star network using 5 xbee series 1 modules in AT mode; how to do it

atmelNetworkxbeezigbee

I am trying to connect more than two XBee series 1 modules in a star network. The node point will take data from all endpoints one by one and process it, then send data back to a PC terminal.

In order to do that, the destination address of the central node has to be changed from time to time. Is it possible to do this using my microcontroller C/C++ code?

Is it possible to change the ATDL value during a program periodically?

I am using an Atmel dev board and a FireBird V robot using the same platform.

Best Answer

If you don't want to use API, and strictly want to use AT mode, then I suggest you simply put a destination prefix string at the beginning of each of your messages, and then broadcast all messages to all end-nodes.

On the receiving end-nodes, write some code to check whether the destination prefix string of a received message matches that particular end-node's address/name (which you can assign randomly yourself in code).

I don't think it's a good idea to change ATDL dynamically for each message. Not only might it affect the timing and require re-pairing but also remember that ATDL is written to the Xbee's EEPROM -- which only allows a finite number of rewrites.

UPDATE: More details regarding implementation (as requested by OP):

If you have setup Xbees already, then it should be extremely easy. Imagine there are five people at a loud party, and you have to ask one of them to come near you -- how do you do it from where you are? You yell out their name first, then say what you want to say. So, "John, come here." (Or if two people, "John and Mary, come here.") Everyone hears it but only John will think it concerns him, so he will listen to the rest of the message, then he will act.

Likewise, let's say you want to send a message to any of the "end-nodes" in your network. First assign all of them addresses, let's say 1 to 5. Now, from the central/base Xbee, you broadcast a message (i.e., it goes to everyone), for example, "01,03>76".

  • The destination addresses are everything before the ">" (you could use any symbol).
    • So, 01 and 03 are the addresses of the Xbee destinations you intend to communicate to.
  • And the actual content of the message is everything after the ">".
    • So, "76" or "abc" or whatever will be the message you intend to send to Xbees 01 and 03.

And similarly, on the LISTENING Xbees (not the central/base Xbee, but instead the end-nodes), you simply put an "if"-condition to check if the message received is for that Xbee. Here is some pseudocode:

MyAddress = "01" [this will be different for each end-node Xbee]

Read for any Xbee received messages

if (XbeeReceivedMessageString contains MyAddress before ">")
{
   read the rest of the message and do whatever you need to do with it.
}
else
{
   do nothing/ignore.
}

(If you need help with setting up and learning about Xbees, just Google for it. An easy way to get started might be by searching for "Xbee Arduino tutorials".)