2013-10-21

Magic Tag

Upplagd av victorvj

This is MagicTag, the project that group 3 has developed.
We hope you enjoy it!

In case you want to learn more about us, visit our blog

2013-10-18

Piano step

Upplagd av matteo zaghi


2013-10-17

MagiBox

Upplagd av sam

Info video of the logical/magical boxes by Sam Sam and Rafel Ridha

Pet the animals!

Upplagd av Pedro Hernandez

Our project for the course was called "Pet the animals!". By making an abstract picture of several animals, we tried to create a space in which both adult and kids would interact with the animals and get feedback from them in the form of sound.


Please make sure to enjoy our video to get to know more about our project!


Pet the animal from Connie Huanca, Fredrik Hellström and Pedro Hernandez

2013-10-13
Upplagd av #@o p3!

Step on me

A new interactive playground area for kids to explore and play freely, using a grid of LED-filled squares that reacts to their movements in different ways. No rules, regulations or instructions, allowing the children to create their own games and objectives; to play alone or together; to compete or to collaborate.

2013-10-10

Radio-transmission with Sun SPOT

Upplagd av victorvj

In our project we decided to use Radio-transmission between Sun SPOTs in order to create a game for kids named MagicTag.
In this project we are using a Sun SPOT + RFID reader per kid and a Tag, which they are using to transmit the information we want. This information is their own Sun SPOT address. There is a communication back when the package has been received where we send the LED color to change the color of the Sun SPOT that was touch.

Use case:
PlayerA: SunSPOT_A + TagA
PlayerB: SunSPOT_B + TagB

TagA touches SunSPOT_B
SunSPOT_B opens a connection to SunSPOT_A
SunSPOT_A receives the info. Checks the information, transmits LED Color to SunSPOT_B.
SunSPOT_B receives the color and changes its color to the new color.

Constants:

private String port = ":10";
private String commType = "radiogram";
private String EMPTY_MSG = "MESSAGE";

Receiver code:

DatagramConnection readConnection = (DatagramConnection) Connector.open(commType + "://" + port);
Datagram packet = readConnection.newDatagram(readConnection.getMaximumLength());
                    
while(true){
      readConnection.receive(packet);
      String receivedMsg = packet.readUTF();
      System.out.println("receivedMsg " + receivedMsg);

      if (receivedMsg.equals(EMPTY_MSG)) {
            System.out.println("TAG RECEIVED");
            DatagramConnection answer = (DatagramConnection) Connector.open(commType + "://" + packet.getAddress() + port);
            Datagram answerPacket = answer.newDatagram(readConnection.getMaximumLength());
            answerPacket.writeUTF(getMyColorCode());
            answer.send(answerPacket);
            System.out.println("SEND >>> Color sent: "+ getMyColorCode());
            answer.close();
      } else {
            System.out.println("COLOR RECEIVED: "+receivedMsg);
            setSpotColor(getColorFromCode(receivedMsg));
      }
}        


Sender code:

while (true) {
     try {
          String RFIDTagContent = getRFID();
          System.out.println("rfid read : " + RFIDTagContent);
                
          String enemyAddress = this.getAddressForTag(RFIDTagContent);
                                
          if (enemyAddress.equals(this.myAddress())) {
               System.out.println("Ignoring tag");
          } else {
               ledBlink();

               DatagramConnection writeConnection = (DatagramConnection)Connector.open(commType + "://" + enemyAddress + port);
               Datagram packet = writeConnection.newDatagram(writeConnection.getMaximumLength());

               packet.writeUTF(EMPTY_MSG);
               writeConnection.send(packet);
               System.out.println("SEND >>> Tag sent!");
               writeConnection.close();
          }
      } catch (IOException ex) {
          ex.printStackTrace();
      }
}


RFID code:

protected String getRFID() {
    byte[] idArray = new byte[16];
    int index = 0;

    do {
        try {
            if (board.availableUART() > 0) {
                idArray[index] = board.readUART();
                index++;
            } else {
                Utils.sleep(200);
            }
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    } while (index < 16);

    String returnString = "";
    try {
        returnString = new String(idArray, "US-ASCII");
    } catch (UnsupportedEncodingException ex) {
        ex.printStackTrace();
    }

    return returnString.trim();
}



Note: this is the basic code for communicating 2 Sun SPOTs triggering the communication with a RFID reader.

KEY points:

Some of the key points, or at least what we consider more important in the communication.
  • When creating a packet to transmit the information it is crucial to give it a size enough to transmit the information. We have seen some tutorial with wrong code:
    • Right:
Datagram packet = readConnection.newDatagram(readConnection.getMaximumLength());
    • Wrong:
Datagram packet = readConnection.newDatagram(0);

  • Always when it is possible try to close the communication. So in our case, we are closing the communication when we are transmitting back:
     writeConnection.close();
  • Don't write anything you don't need in the packet. For example, you can't extract sender address from the packet information, so don't write this kind of information in the message. There are some other things that could be useful for you, so check the API.
     packet.getAddress();

  • You can also use broadcast in this kind of communication. The only thing you need to do is changing the receiver address when you open a communication to broadcast. Then, you need to adapt your receiver code to do whatever you need.
Check more about our project here.

2013-10-08

How to connect your Arduino to Pure Data

Upplagd av Fredrik

1. Download pduino: http://puredata.info/downloads/pduino
2. Open Arduino software and choose File/Examples/Firmata/AllInputsFirmata
3. Upload to your Arduino
4. Open Arduino-test.pd from the pduino-folder.
5. Choose serial port, open PD window to get more info.
6. Start to do something fun with the incoming data.