Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

XBee series 1 mesh and data collisions
Moderators: adafruit_support_bill, adafruit

XBee series 1 mesh and data collisions

by johnmccombs on Mon Dec 03, 2012 6:07 pm

I have a sensor network at home using Ardiunos and series 1 Xbees with the mesh software installed on them. The one unsolved problem I have is that if two sensors send data at the same time, the data (in this case json) from the sensors is intermingled.

So, what should look like this

arrives like this

One way to handle this is to poll the sensors, but some of them run on batteries and spend the majority of their time asleep, so I can't do that.

Any suggestion on ways to fix this appreciated

UPDATE: Think I found a solution. The data was being written out as it was read from the sensors, which was inserting delays in sending the data to the serial port. Also the Packetization Timeout on the Xbee was the default of 3, which is the time to send 3 characters (approx 200us at 57600). The combination meant that the json messages were being sent as 2 or 3 packets as the timeout occured while waiting for the sensor to respond. The solution was to read all the data from the sensors, then send the json message, in a single Serial.println(). And set the Packetization Delay to 10 to make quite sure it didn't timeout.
Posts: 23
Joined: Sun Aug 08, 2010 5:20 pm