Wednesday 25 September 2013

Communicating between the devices

Now that the technology and devices that will be used have been decided begins the implementation of the platform. Here is an outline from a technical point of view of what every SunSPOT will be able to do once the game is in effect.

Upon contact by another playmate, the SunSPOT will :

  1. Recognize the ID of whichever of whichever playmate made contact.
  2. Play a sound to acknowledge that contact has been and give auditive clues to both players.
  3. Query the color of the "assailant".
  4. Replace its own color with the new color.
Technically, playing a sound (only possible with newer SunSPOTs) and changing colors are very simple tasks that should be easily implemented.

 How well the RFID detection will work is still uncertain at this point. The parts needed (RFID tags as well as readers) have been ordered and should be available for experimentation on 27/9. The readers will need soldering to connect them to the SPOTs, so we have preemptively done some research, mainly due to our lack of experience in this domain. Hopefully reading a tag will be easy to implement in a SPOT. For the moment, we can experiment using the switches on them.

Our work has been mostly focused on the communication between the SunSPOTs. We tried to see if radio communication could satisfy our needs, but we quickly realized that directional communication is not appropriate for this game. Indeed, only one of the two devices that want to communicate knows when it needs to do so. Since opening communications with every device is not realistic, we had to look into using another protocol. Fortunately, SunSPOTs also support sending datagrams as multicast.

 Here are some diagrams to explain the principle of the communications:

In the beginning, all SPOTs are in a state of "listening to an ID".
TAG4 (associated to SPOT4) makes contact with SPOT1.
SPOT1 reads "SPOT4" in the RFID tag.
SPOT1 broadcasts a message containing the ID "SPOT4".
SPOT1 goes in a "listening for a color" state.
Since all SPOTs are in a listening state, they all receive the message.
Only SPOT4 reacts to the message, recognizing its own ID.
SPOT4 broadcasts a message containing its own color, "RED".
SPOT1, the only SPOT listening for a color, reacts to the message.
SPOT1 changes its color with the own in the message.
SPOT1 goes back in a "listening for an ID" state.
Since the datagram protocol is unreliable, we need to experiment with this model to see how big is the risk of packet loss, considering that the two SPOTs communicating are close to each other. Depending on how successful it is, we may need to refine this method.

No comments:

Post a Comment