2

I have a processing sketch that pumps out basic serial commands to an xbee. Then I have two (soon to be 3, maybe 4) arduino's with their own xbee's who receive the data and do stuff.

Thing is each Arduino has it's own purpose, and therefore it's own data packet.

So, to implement this. Is there a way to send a message to a particular xbee? I.e. can I assign the xbee an index or channel of some sort, then get the broadcasting xbee to send data to whatever index or channel it needs to?

Or, will this need to be implemented in the Arduino software? i.e. Processing prefix the data packet with an index/identifier and the arduino ignore incoming messages with that prefix?

Or is there another option entirely :P

Thanks in advance for your advice.

Kad
  • 388
  • 3
  • 15
d2kagw
  • 797
  • 1
  • 7
  • 26

2 Answers2

0

To what i understood is that you want to be able to tell the diffrence to what Xbee you are sending data to. You can do this by using IP adresses. If you have for example two Xbees with the IPs:

  • Xbee1 - 192.168.80.50
  • Xbee2 - 192.168.80.51
  • Xbee3 - 192.168.80.52

You can send information between them by just connecting the Xbee that will start the communication to the Xbee that will receive it. If you want to have any kind of communication over the wireless network (or ethernet) you must have an IP assigned to every Xbee.

EDIT:
If you have a server on a computer that you have made yourself in for example Java. You can connect the Xbees to that and connect of them to the computer server. Then you can set up the server to receive and send data to the diffrent Xbee clients.

I did something similar to this: Maintaining communication between Arduino and Java program , but i didn't use a Xbee, i used the official WiFi shield.

Hope this helped! -Kad

Community
  • 1
  • 1
Kad
  • 388
  • 3
  • 15
  • is this just for Xbee Wifi Modules? or all Xbee devices? – d2kagw Jan 26 '14 at 21:47
  • Everything that communicates over networks needs to have an IP address to work. So its for all wifi modules, and ethernet modules too. – Kad Jan 27 '14 at 07:30
0

While not a specific answer to your question, with this type of communication some packet error checking would be beneficial. Send the data using a crc error checking algorithm. Packet structure could look something like:

0x7F 0x02 (Address Bytes) (Command Bytes) (CRC bytes) 0x7F 0x03

Where 0x7F is the DLE character used to indicate either a start byte will follow, and end byte will follow, or a data byte with the value of DLE will follow. This means any DLE character that is part of the address or command should be preceded by a 'Stuffed' DLE character. The CRC is calculated from the address and command bytes and used to check the integrity of the data that is received. The CRC check bytes are included in each packet.

This type of communication will prevent packets going to the wrong source from being used, and also packets that are in error from being used.

To read more on serial framing here is a good place to start: http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/.

Wilsonator
  • 407
  • 1
  • 5
  • 14