I'm using Xbee S2, Arduino Uno and the Xbee Arduino API library.
I have a small mesh network:
one coordinator in AT mode that sends the received data to a database via python,
routers in AT mode, routers in API mode(connected to Arduino),
end devices.
The idea:
API routers send out a ND command, gather needed data from the end devices, form a package that looks like "end_device_data + API router ID" and then pass it on to the AT routers, and finally to the coordinator.
Problem:
The end devices are moving around in the network. If I configure a XBee as a API Coordinator and send out a ND command I receive a response where I read the data I need from the end devices. But if I try the same thing with an Xbee API router I get no data back.
I'm aware of the DH, DL fields and if they are set to 0 the data will be passed on to the coordinator, which is why this worked in the first case with the coordinator. However I can not relay on the DH, DL field because the end devices are moving and every time it's a different value for those fields.
I'm using the AtCommandRequest/Response from the xbee.h library in the function.
How can I make the API routers and End devices talk to each other? I can imagine that if the End Devices had Arduinos as well then it would be easier, but I'm trying to avoid that.. if possible
I've tried google, but found nothing. Any advices, recommendation of sites and tutorials are welcome. Thanks in advance!
How can I make the API routers and End devices talk to each other?
A router simply passes data through. It does nothing with the data. So, routers and end devices can't talk to each other. The end devices (and routers) can talk to the coordinator.
However I can not relay on the DH, DL field because the end devices are moving and every time it's a different value for those fields.
I don't understand this. A given XBee has a DH/DL value. That value does not change because the XBee connects to the network through a different router.
Well they can talk in a way. If the router in API mode sends out an Node Discovery command the end device will reply. In that reply I found the things I needed - the MAC and Node Identifier value. But that's not a perfect solution because on the other hand the ND command is sent out to all the nodes, including the router in AT mode which are API router neighbors, and that's not what I want because then I will always have to drop those replies coming to my API router. And that's kinda what I am doing right now until I find a better solution.
Yes Xbees have a given DH/DL value, but imagine if an end device is moving around in a network and it needs to send the data only to the specific routers that need to add their mac and then pass on the packet to the coordinator. In that case the DH/Dl value would have to change every time when it approaches those specific routers, and I don't have a way of doing that.
The API routers are supposed to act like stations that send data to coordinator saying which end device is currently in their range. The other routers will be used just to pass the info to the coordinator. My problem is finding the best way to send the id of the given API router and end device together so the coordinator knows where it came from and which end device is there. (:
In that case the DH/Dl value would have to change every time when it approaches those specific routers, and I don't have a way of doing that.
I don't understand this. Do YOU change your name at school, at home, at work, at church, etc? No, you have the same name everywhere. If you are at school, and call home, you have the same name as when you are at work and call home. Your home number remains the same, too, regardless of where you are calling from.
I think we have a misunderstanding, or my understanding of this technology is completely wrong. (:
The Xbee that represents the end device doesn't change it's name - the Serial High and Serial Low number are always the same. And the Node Identifier field as well, in case it's set up. Nor does any other node in the network. But the end device is supposed to send messages to various routers, and not to the coordinator.
So the DH/DL values can't be 0 because then the routers will just pass it on to the coordinator. But also it can't be an address of a specific router, because then when it approaches a different router it won't send anything to that other router.
I'm aware that the DH/DL field can't change that easily which is why I mentioned that in my first post
"However I can not relay on the DH, DL field because the end devices are moving and every time it's a different value for those fields". Now when I read my sentence I see that I should have written - "it would be a different value for those fields and that's not possible".
I'm just trying to find a way to make the end device and routers communicate so I can retrieve the mac of a specific end device and send a message to the coordinator that would look something like this (end device mac + mac of the first router that gets the message from the end device). And I want to do that without having to broadcast an ND request.. And so far I haven't been able to find a way. The ND command works, my API router gets the response from the end device, but also gets a response from the other router.
So the DH/DL values can't be 0 because then the routers will just pass it on to the coordinator. But also it can't be an address of a specific router, because then when it approaches a different router it won't send anything to that other router.
It really isn't clear what a given end device is supposed to communicate with. The only thing that a given end device knows is what coordinator to talk to.
You seem to be trying to get the XBee to magically know which router(s) it's supposed to talk to, without defining how it is to know that.
WHY is it necessary to send the mac address of the first router (there really is no way to know which routers are used, nor how many) to the coordinator? I think you really need to rethink what you are trying to do.
The end device is a vehicle and the API routers are various stops. The coordinator is supposed to gather data of the vehicle movement, and to do so I need the information that will tell me where it was last checked in - which is why I need the the router mac.
I read a lot of documents, googled as well and found no information on this. One part of me knew that it was impossible, but the reason why I asked for help here is because maybe someone had similar problems and found a way to get around. I guess I was looking for that magic. (:
I've already started working on other ways trying to find the best one and I'm aware that I might have to change a lot of things to get this working.