Multiple XBEEs API mode coordinator not receiving packets sometimes

I had a strange problem where sometimes messages from my routers did not arrive at the coordinator. Now I know why and it has been driving me nuts, so that’s why I’m sharing this with you to save you all the trouble of going through this.

This is my setup:

  • 1x XBEE Pro Series 2B as a coordinator in API mode (2) 9600 Baud
  • 3x XBEE Pro Series 2B as a routers in API mode (2) 9600 Baud

I’m using th brilliant API library because the AT mode was never stable, find it here: https://code.google.com/p/xbee-arduino/

So this is what happened:
Periodically the coordinator requests a status update from all routers so it sends out a broadcast message. This message always arrives at all routers so no issue there. In response, every router sends out a status update back to the coordinator. Sometimes the coordinator does not receive all the replies.

Reason for this is that all three routers reply at the same moment and the Arduino UNO fails to process the incoming messages. I’m sure the coordinator xbee receives them but Arduino fails to read them all from the serial port.

Solution was to add a small delay (100, 200 and 300ms) which was different on all routers so none of the messages arrive at exactly the same point in time. Now the delivery is completely fine and no packets are lost.

Has anyone else seen this before?

I'm sure the coordinator xbee receives them

No, it doesn't. When the coordinator XBee is listening to one of the routers, it is deaf to the others.

The coordinator should NOT be broadcasting a request for status. It should get a list of routers and ask each specific router for status.

Agreed, you're probably right. But the same situation could still occur even when you use the router adresses?

And more in general, you say the coordinator will ignore all other incoming messages when listening to a router. Is there anything else I can do to prevent packets from getting lost? In theory there's always a chance of packets arriving at the same time. Is there something I can configure on the router xbee to guarantee delivery?

Is there anything else I can do to prevent packets from getting lost?

Don't ask multiple devices to send at once. Think of the coordinator as a kindergarten teacher. The routers are the kindergarteners. They are supposed to be quiet until called on. In your case, anyway.

Is there something I can configure on the router xbee to guarantee delivery?

It's there along with the generate winning lottery ticket numbers option.

It's there along with the generate winning lottery ticket numbers option.

Lol, understood :slight_smile:

But the situation is a little bit more complicated since all of the routers can also trigger a transmit based on an event (sensor value change). So the only way to make sure the transmit is processed by the coordinator, is to manually send some sort of 'ACK' back to the router?