I am working on a project where there are two different mobile robots that are talking to eachother via XBee modules. Additionally they both send or receive data from a computer through another XBee module.
I am thinking to use 2 Arduino Duemilanove (maybe I can use Mega) 2 XBee Shields (Sparkfun vers.) and 3 XBee 2.5 Series and 1 XBee Explorer USB to connect the stations to eachother.
I guess I can make a connection between them so they can receive or send data to eachother with such hardware.
Well there is this simple question, how can I write it in the Arduino code, so every station know the place to send data or receive data.
Sorry for my bad english but I will be glad if you can give me an example project where I can find a solution for the Arduino Code.
With the XBees that you have, one of them needs to be configured as a coordinator, while the others have to be configured as end devices.
When the end devices broadcast, there is no ambiguity who they are talking to.
When the coordinator broadcasts, the packets go to all end devices. The end device needs to determine if the packet is for itself. Some packet filtering is done because the packet is for devices with a different PAN ID. But, if the end devices are for robots Joe and Tom, is is necessary for the coordinator to do more than say "Go Left", for instance. If that happened, both Tom and Joe would turn left.
The coordinator needs to say "Joe, go left". Joe needs to see the message, see that it is for him, and decode and implement the message. Tom will see the same message, see that it is not for him, and do nothing.
Of course, the end devices don't have to have names. They could have numbers. But, each must have a unique id in the topology that has nothing to do with the fact that the are all XBees. The unique ID is hard-coded in the sketch on each device.
I already knew that the broadcaster sends all the data to other stations and they just decide if it belongs to them or not, but I dont know how to do it. I mean what shall I do in Arduino code or X-CTU to let them work like that.
I used two XBee 2.5 Series on point to point application once. I just put same PanID and Baud Rate for them and they started to send/receive data. I could do that with easy comands like Serial.Write() Serial.Read()
But now what shall I write to the code to show that the data belongs to that station or not.
If it is same like point to point communcation then what parameter should be changed on XBee configuration (on X-CTU for example) to do the same thing.
Thanks for the help already and I hope I asked my question clear this time.
It is the same as point-to-point, except that each message send needs to contain information that defines which receiver should do something.
Point-to-point involves only two nodes, like me talking to you. When I say something, you know that I am talking to you.
If there are three of us, and I'm the boss (the coordinator) and you are one of the end devices, and your friend Joe is another end device, I can't just say "Tell me what you see on pin 7" because you both will tell me, and I won't know which value cam from you and which came from your your friend Joe.
So, I have to say "Joe, tell me your value for pin 7", and Joe has to respond "Joe: HIGH". If I say "Nefsantum, tell me your value for pin 7", you need to respond "Nefsantum: LOW" (or whatever the correct value is).
So, the coordinator needs to add data to the messages sent (using Serial.print(), Serial.println(), or Serial.write()), and each of the end devices needs to add data to the messages returned, to identify which end device the request is for or the reply is from.