There is a wireless 802.11b/g router about 20 feet from my desk that is running, other than that there aren’t any other wireless devices in the same room (but there are plenty in our building with decent enough signal strength for me to connect via my laptop.). One thing I remember reading about is the channel – maybe we should experiment with different channels to find the one with the least amount of noise?
I have both XBee’s configured to 115200 baud, so we should definitely be well within our transmission capabilities. I’ve also set the baud rate on the Arduino and on the PC to 115200.
We are primarily sending data one way – the Arduino has several sensor connected to it, which it samples every 10ms, then sends out via Serial.write() commands. Currently we have this structured such that we have a byte array of length 24, and we use the 8-bit timer2 to trigger an interrupt which indicates we should sample all our sensors. We then do:
Serial.write(out, 24);
where out is the byte array.
Perhaps I should instead use a byte array of length 72, and call:
Serial.write(out, 72);
every third sample? So instead of 24 bytes every 10ms, we would send 72 bytes every 30ms.
This seems like it would maximize the packet payload and give more time for the XBee to perform retries if needed. If I am reading the documentation correctly, 72 bytes is the max payload for the Series 2 devices, while Series 1 devices have a max payload of 100 bytes. Presumably the difference is taken up by the extra overhead that the Zigbee protocol imposes.
Also, would it be worth trying to force the buffer to be sent immediately after we perform our Serial.write()? From what I have read, you can enter command mode, then send the AT commands GT + CC + GT to cause the buffer to be packetized. But perhaps this wouldn’t happen any faster if we just set the packetization timeout to something smaller (default is 3 character times, so at 115200 buad, I think this is 3/(115200/8) = 0.000208 s ~= 0.21ms). Entering command mode takes lot of time because of the guard times that must be observed before and after ‘+++’ is sent, so this is probably a bad idea.
In the Series 1 devices, there is a setting which allows you to control how many ‘XBee retries’ are conducted, and it can be up to 6. I don’t see anything similar for the Series 2 devices, but there is a way?
Also, with transparent mode, is the XBee just taking care of building the API frame for you with some defaults? It seems like it must be because the packet payload size is the same as when you use API mode.
Thanks,
~Luke