Application Icon

Tuesday, February 26th, 2013
This is our new logo. After several discussions we came to conclusion that our logo will look like that 

We made it in Illustrator by using a custom made font and background. The app icon is an important feature for our game since it will make our application to look more professional and it will give a certain style to it.

Final Presentation

Monday, February 25th, 2013
Prezi Presentation 302 Tuesday 26th February 2013

Inspiration

Friday, February 22nd, 2013

Inspiration

As an add on to our concept, it’s inportant for us to mention where we got our inpiration from for the project.

Brad the Toaster

Our inspiration came from a project called Emotional Toaster, in which Simone Rebaudengo had designed for a university final project. In particular; a toaster named Brad, that shows how a toaster can become emotional when it’s not used. When in the vicinity of other toasters. it would show it’s emotions by moving it’s toast loading lever up and down, as if to say; use me! We basically want to extend on this toaster concept give our clothing more emotions.

Below is a video of brad:


Addicted products: Preview from Simone Rebaudengo on Vimeo.

Jonnet Middleton, “Long live the thing! Temporal ubiquity in a smart vintage wardrobe.”

We all remember this chapter for a DAT302 reading last term, were Jonnet Middleton writes about how she put RFID chips into her clothing to make them smart.

We also like the way in which the writer talks about clothes as if they are like humans, e.g., her jumper and where it came from and the relationship she and other objects had with it. She talks about it as if it was more then just a jumper and if the clothing had emotions and a personality.

Final Code

Friday, February 22nd, 2013

I had to make some changes to the code, but have now incorporated twitter functionality. A summary of the code can be found below if you would rather not look through the code itself.

Here is the code itself (With some private data removed):

import twitter4j.*;
import cc.arduino.btserial.*;

BtSerial bt; // Create object from BtSerial class
String remoteAddress = “PUT MAC ADDRESS HERE”; // MAC address of the device to which the Android will connect
int stillVal;
int val; // Data received from the Bluetooth serial port
int delayTimer;
int frame;
boolean stillvalueset = false;
String message;
PFont font;


// This is where you enter your Oauth info
static String OAuthConsumerKey = “Put You Own key in Here”;

static String OAuthConsumerSecret = “Put You Own key in Here” ;

// This is where you enter your Access Token info
static String AccessToken =  “Put You Own key in Here”;
static String AccessTokenSecret =  “Put You Own key in Here”;


//twitter variables
Twitter twitter = new TwitterFactory().getInstance();
RequestToken requestToken;


//Stuff related to the device itself (clothing type, user keys etc)
String cloth = “Pants: “;
String hashtag = ” #EmotionalClothing”;


String[] boredMessage = {

“I’m getting bored being sat here”,

“My owner is so lazy”,

“I wonder what it is like outside…”,

“If I had legs, I would go walk myself”,

“This is dull, let’s go do something”,

“I’m so lonely”,

 “BORING! LET’S GO OUTSIDE!”,

 “Hey you! Do something with me!”,

“Dying of boredom here! DO SOMETHING!” 

};

String[] happyMessage = {

“I’m on the move”,

“Time for some fresh air!”,

“Going outside, be right back”,

“Adventure Time! YAY!”,

“Looks like we’re hitting the road. Smell ya later!”,

“Finally getting out and about”,

“Where are we going?”,

“It’s good to be outside”,

“I love taking walks” 

};


void setup() {

frameRate(1);

size(displayWidth, displayHeight);

ellipseMode(CENTER);

bt = new BtSerial(this); //create the BtSerial object that will handle the connection

println(bt.list(true)); //get list of paired devices (with extended information)

remoteAddress = bt.list()[2]; //get only the hardware address for the specific entry

bt.connect(remoteAddress);

font = loadFont(“AgencyFB-Bold-100.vlw”);

connectTwitter();

}


void draw() {

fill(0);

frame++;

message = “blank” + frame; background(255);

background(255); 

int value1 = stillVal;

int value2 = val;

if (value2 < (value1 – 5) || value2 > (value1 + 5)){

int blargh = int(random(happyMessage.length));

message = cloth + happyMessage[blargh] + hashtag;

fill(154);  

stillvalueset = false;

delayTimer = 300000;

frame = 0;

sendTweet(message);

}

if(frame == 60){

frame = 0;

int blargh = int(random(boredMessage.length));

message = cloth + boredMessage[blargh] + hashtag;

sendTweet(message);

}



ellipse(width/2, height – (height/3), width/2, height/3); 

textSize(50);

text(“pin value ” + val, 50, 50);

textSize(20);

text(message, 50, 150);

println(value1); //println is here for debugging in processing

println(value2); //while the phone is connected tothe computer

println(message); //so they are left in

delay(delayTimer);

delayTimer = 0;

}


void btSerialEvent(BtSerial bt) {
val = bt.read(); //update val whenever new data is received

if (!stillvalueset){

stillVal = val;

stillvalueset = true;

}

}


void stop() {

if (bt != null) {

bt.disconnect();

}

println(“Bluetooth disconnected”);

}

// Initial connection to twitter
void connectTwitter() {

twitter.setOAuthConsumer(OAuthConsumerKey, OAuthConsumerSecret);

AccessToken accessToken = loadAccessToken();

twitter.setOAuthAccessToken(accessToken);

}

// Sending a tweet
void sendTweet(String t) {

try {

Status status = twitter.updateStatus(t);

println(“Successfully updated the status to [” + status.getText() + “].”);

} catch(TwitterException e) {

println(“Send tweet: ” + e + ” Status code: ” + e.getStatusCode());

}

}

// Loading up the access token
private static AccessToken loadAccessToken(){

return new AccessToken(AccessToken, AccessTokenSecret);

}

The main change in the code is applying a frame rate to the sketch. This then allows me to create a timer of sorts, and using an if statement I can get the sketch to post to twitter every 60 seconds. There is still a set delay when the device picks up that it is moving (which is set for five minutes) but as soon as that five minutes is up it then resets the stillVal variable and compares it to the current value (which is always being overwritten by the current data coming from the arduino) and either goes through the bored/alone scenario or the happy/about. The code could be tidier, but for now this is satisfactory.

The twitter code we used came from robotgrrl.com


A TL;DR of the code is as follows:

  1. When the app starts, it links up to the bluetooth device we would have inside, for example, a pair of jeans.
  2. A value is read from the bluetooth device and stored into two variables. One of these variables gets locked down so the application has something to compare a more recent reading to
  3. A running timer is started to work out when to send out the next tweet.
  4. If the timer hits the minute mark during the bored stage of the jeans’ life, a tweet is posted and the timer reset
  5. If movement is detected, everything gets reset (New values to compare current status to and the timer) and a happy response is tweeted.


Delegation of Project Jobs

Friday, February 22nd, 2013

So the first thing we all done was come up with a concept, which is described the blog post Everware Proposal.

After this we had to delegate jobs to all team members. It’s important to note that although we had certain areas to work in, that we all contributed to the project and in some cases helped each other if they a member was stuck; it was a team effort.

Below is a list of jobs that were done by our team:

  1. Graphics
  2. Coding
  3. Research
  4. Design
  5. Arduino
  6. Web – Front End
  7. Web – Back End
  8. Presentation
  9. Marketing / Promotion

Giving emotion (Evolution of code)

Sunday, February 17th, 2013

So we have values being read by our android application, so now we need to apply some emotional sayings for it to output. For the time being, here is our list of replies 



Bored Responses:

“I’m getting bored being sat here”,
“My owner is so lazy”,
“I wonder what it is like outside…”,
“If I had legs, I would go walk myself”,
“This is dull, let’s go do something”,
“I’m so lonely”

Moving responses:

“I’m on the move”,
“Time for some fresh air!”,
“Going outside, be right back”,
“Adventure Time! YAY!”,
“Looks like we’re hitting the road. Smell ya later!”,
“Finally getting out and about”

And using it in the code like so allows me to randomly select a saying to appear on the tweet:

import cc.arduino.btserial.*;

BtSerial bt; // Create object from BtSerial class

String remoteAddress = “00:12:11:20:07:93”; // MAC address of the device to which the Android will connect

int stillVal;

int val; // Data received from the Bluetooth serial port

boolean stillvalueset = false;

String message;

PFont font;


//Stuff related to the device itself (clothing type, user keys etc)

String cloth = “Pants: “;


String[] boredMessage = {

“I’m getting bored being sat here”,

“My owner is so lazy”,

“I wonder what it is like outside…”,

“If I had legs, I would go walk myself”,

“This is dull, let’s go do something”,

“I’m so lonely”

};


String[] happyMessage = {

“I’m on the move”,

“Time for some fresh air!”,

“Going outside, be right back”,

“Adventure Time! YAY!”,

“Looks like we’re hitting the road. Smell ya later!”,

“Finally getting out and about”

};


void setup() {

size(displayWidth, displayHeight);

rectMode(CENTER);



bt = new BtSerial(this); //create the BtSerial object that will handle the connection

println(bt.list(true)); //get list of paired devices (with extended information)

remoteAddress = bt.list()[2]; //get only the hardware address for the specific entry


bt.connect(remoteAddress);

  font = loadFont(“AgencyFB-Bold-100.vlw”); }


void draw() {

background(255); // Set background to white

int value1 = stillVal;

println(value1);

int value2 = val;

println(value2);

if (value2 < (value1 – 15) || value2 > (value1 + 15)){

int blargh = int(random(0, happyMessage.length));

message = cloth + happyMessage[blargh];

fill(204); // set fill to light gray

//stillVal = value2;

}else{

int blargh = int(random(0, boredMessage.length));

message = cloth + boredMessage[blargh];

fill(0); // set fill to black

}



rect(width/2, height/2, width/3, width/3); // draw a square in the center of the screen

textSize(50);

text(“pin value ” + val, 50, 50);

textSize(20);

text(message + ” #EmotionalClothing”, 50, 150);

delay(5000);

}


void btSerialEvent(BtSerial bt) {

val = bt.read(); //update val whenever new data is received

if (!stillvalueset){

stillVal = val;

stillvalueset = true;

}

}


void stop() {

if (bt != null) {

bt.disconnect();

}

println(“Bluetooth disconnected”);

}

The code still needs the twitter integration, and a bit of cleaning up in regards to the if statement that deals with what state the clothing is currently in (Moving or not moving). The aim of it is to take a reading and put it into two variables, and use one of them as a comparison against the other to check if the clothing has been moved, but progress wise we are nearing the end.

More Android and Arduino

Friday, February 15th, 2013

After testing the compatibility of arduino and android communicating, it was time to get our own application and arduino code talking to each other. This was a right royal pain.

Firstly, I had an issue keeping the arduino powered. Both of my cheap 9V batteries ended up dying quite quickly, and since I couldn’t use USB power for testing purposes (We are working with bluetooth after all, and connecting USB would have made the arduino default to that for serial connection) I had to come up with something else.

A good thing about the arduino is the DC jack that can be used to power it, and lucky old me had a spare 7.5V power adaptor which belonged to my 5-port switch. So until we found a decent battery to power it, we have something we can test with.

Secondly, we had an issue with the arduino code itself. I’m a big fan of the firmata firmware, and had managed to get it working with an app that’s freely available on the google play store. This was mostly to confirm that it was possible to get the two things talking to each other over bluetooth. But working with the firmata library wasn’t going to be easy; not with the way I’ve always done it in processing, since the serial library from processing wouldn’t work on android.

So next I tried using the sweetblue library. This worked quite well when getting android and arduino connecting to each other, but was impossible to get the data we wanted.

Sweetblue works much in the same way as firmata, but is designed more for what we are trying to do. With sweetblue and firmata you have better control over the arduino without directly changing the code already on it. For example; instead of 


int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

On the arduino, you would have this in processing


import se.onescaleone.sweetblue.*;

SweetBlue bt;

/* Pin where the sensor is connected */

int ledpin = 13;

void setup() {

/* Connect to the ArduinoBT */

if ( bt == null ) {

bt = new SweetBlue( this );

  bt.connect(“MAC ADDRESS OF BLUETOOTH DONGLE HERE”);

  }

if ( bt.isConnected()) && !initiated ) {

// /* Once the board has established a connection, set the pin modes… */

 bt.pinMode( ledpin, SweetBlue.OUTPUT );

// /* …but only do it once! */

 initiated = true;

 }

}

 

void draw() {

/* Draw background */

background(255,255,255 );


  /* Read value from ArduinoBT */

if ( bt.isConnected()){ //&& (millis() – timer >= timerdelay) ) {

  /* Read the digital pin, PIN, from the bluetooth board */

bt.digitalWrite(ledpin, SweetBlue.HIGH);

delay(1000);

bt.digitalWrite(ledpin, SweetBlue.LOW);

delay(1000);

   }

}


/* When processing stops, send the disconnect command to ArduinoBT */

void stop() {

bt.close();

}

Both bits of code do the same thing (blinking the on board LED), but do it in different ways and requires the connectivity between the two for it to work, which was why we wanted to work with it.

Trouble was, it didn’t work. At all.

Sure, we got connection, but we couldn’t get anything to pass between the two. After constant fiddling I figured it might have been to do with us not using a proper arduinoBT board (An Arduino board with built in bluetooth). So I went back to basics with the arduino code itself.

All I needed the arduino to do was set up the correct pins and write it out through the bluetooth dongle, and this was the code I ended up using.


int groundpin = 18;
int powerpin = 19;
int xpin = 3;
int ypin = 2;
int zpin = 1;

void setup(){
  Serial.begin(9600);
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
}

void loop(){
Serial.write(analogRead(zpin));
}

Now that I knew it would always be sending out the value I needed, it was time to get android to obtain the value the arduino would just pump out (instead of going and getting it). This still needed a library to use, and fortunately I discovered the BtSerial Library.

The BtSerial library allowed us to connect to the bluetooth module and receive any data the arduino was writing, and using this code in processings android development mode


import cc.arduino.btserial.*;

BtSerial bt; // Create object from BtSerial class
String remoteAddress = “00:12:11:20:07:93”; // MAC address of the device to which the Android will connect
int val; // Data received from the Bluetooth serial port
PFont font;

void setup() {
size(displayWidth, displayHeight);
rectMode(CENTER);

bt = new BtSerial(this); //create the BtSerial object that will handle the connection
println(bt.list(true)); //get list of paired devices (with extended information)
remoteAddress = bt.list()[2]; //get only the hardware address for the specific entry

bt.connect(remoteAddress);
font = loadFont(“AgencyFB-Bold-100.vlw”);
}

void draw() {

background(255); // Set background to white
if (val == 0) { // If the serial value is 0,
fill(0); // set fill to black

}
else { // If the serial value is not 0,
fill(204); // set fill to light gray
}
println(val);

rect(width/2, height/2, width/3, width/3); // draw a square in the center of the screen
textSize(50);
text(“pin value ” + val, 50, 50);
}

void btSerialEvent(BtSerial bt) {
val = bt.read(); //update val whenever new data is received
}

void pause() {
if (bt != null) {
bt.disconnect();
}
println(“Bluetooth disconnected”);
}

void stop() {
if (bt != null) {
bt.disconnect();
}
println(“Bluetooth disconnected”);
}

void resume() {
if (bt != null) {
while (!bt.isConnected ()) {
bt.connect(remoteAddress);
}
println(“Bluetooth reconnected”);
}
}

I was able to get this resulting video



It’s not exactly what we wanted, but as long as we have the value going into a working app we can start getting to grips putting the twitter code together to make the clothing appear to have emotions. This has probably been the least trickiest part, even though we were using non-standard parts; but once the twitter stuff is integrated we can have whatever we feel like being posted to twitter and then obtained through the emotional clothing website we will have set up.

-Links to stuff mentioned

Firmata
SweetBlue
BtSerial – Had to rebuild the missing btserial.jar

Future Development

Thursday, February 7th, 2013

This blog post is for any future developments that could be put in place for the following reasons:

To iron out any bugs that may be present in the current project. Primarily programming code related, e.g., making code more efficient or just building on the code to bring more features into our project.)
To build on the current aesthetics of the project, e.g., the look, feel or how users interact with elements of the system etc.
To build on the technological aspects of the project, e.g., adding more sensors to clothing, building our application for different mobile devices such as iPhone iOS, Windows, Blackberry and the forthcoming Ubuntu mobile OS.
To increase social knowledge of the concept, e.g., connecting to different social media platforms such as Facebook and marketing etc.
Making a link between the clothes and any weather feeds, so the clothes can match themself according to weather forecasts and combining into different suggested outfits for the day.
Ironing out bugs!

Code efficiency:

Aesthetic

Real Images:
Improving people’s social life’s security and checking for leakeages into the system
Technological Aspects

energy effeciency / since so far it is running from a 9V battery, but hopefully we could switch into something more enerfy effecient such as solar pannels and etc./
Image uploading
GPS:
Camera:
Weather forecasts feeds
Social Awareness

Facebook:
Flyers
Posters
Marketing

Kickstarter:
LinkedIn:

PHP Parser / Web Interface and Aesthetics

Wednesday, February 6th, 2013

The PHP parser is an aspect of the project used to bring in tweets from twitter by sifting through XML data structure and hashtags to bring in anything that our clothing had tweeted.

Below is an image that shows what part of the project we are talking about, based on the Mind Map in our blog post “Technical Stuff“:

Explaining the Code

Below shows the PHP code used to parse our emotional clothing tweets:
<html>
    <head>
        <!–<META HTTP-EQUIV=Refresh CONTENT=”7″> –>
            <link rel=”stylesheet” type=”text/css” href=”css/styles.css”>
    </head>
    <body>
<?php
echo ‘<div id=”contentWrapper”>’;
echo ‘<div id=”logo”><img src=”images/logo.PNG” width=”900px” height=”150px” />’;
        echo ‘</div>’;
function getTweets($hash_tag) {
    $url = ‘http://search.twitter.com/search.atom?q=&#8217;.urlencode($hash_tag);
    //echo “<p>Connecting to <strong>$url</strong> …</p>”;
    $ch = curl_init($url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $xml = curl_exec ($ch);
    curl_close ($ch);
    $affected = 0;
    $twelement = new SimpleXMLElement($xml);
    foreach ($twelement->entry as $entry) {
        $author = $entry->author->name;
        $status = $entry->title;
        $published = strtotime($entry->published);
        
        echo ‘<div class=”tweetsWrapperDiv”>’;
            echo ‘<div id=”authorDiv”>’ . strtok($author, ” “) . “‘s” . ‘</div>’; 
                   $changeValue = strtok($status, ” “); 
                   $imageValue = “”;
                   if($changeValue == “Socks:”){
                            $imageValue = “images/socks.PNG”;
                        }
                         else if($changeValue == “Trousers:”){
                            $imageValue = “images/cap.PNG”;
                        }
                        else if($changeValue == “Jacket”){
                            $imageValue = “images/jacket.PNG”;
                        }
                        else if($changeValue == “Boxers:”){
                            $imageValue = “images/boxers.PNG”;
                        }
                        else if($changeValue == “Trainers:”){
                            $imageValue = “images/trainers.PNG”;
                        }
                        else if($changeValue == “Tshirt:”){
                            $imageValue = “images/tshirt.PNG”;
                        }
                        else if($changeValue == “Bag:”){
                            $imageValue = “images/bag.PNG”;
                        }
                        else{
                            $imageValue = “images/questionMark.PNG”;
                        }
                  echo ‘<div id=”itemImg”><img src=”‘ . $imageValue . ‘” width=”100px” height=”100px” /></div>’;
                         
                          $status1 = substr(strstr($status,” “), 1);
                          $status2 = substr($status1, 0, -18);
                   
            echo ‘<div id=”statusDiv”>’ . $status2 . ‘</div>  
                  <div id=”postedDiv”>’ . “Posted: “.date(‘n/j/y g:i a’, $published) . “</div>”;
        echo ‘</div>’;
        echo ‘<div id=”borderBottom” ></div>’;
    }
    return true;
}
    getTweets(“#emotionalclothing”);
    echo ‘</div>’;
?> 
    </body>
</html>

The code is based around one function named “getTweets()”, which is pretty much what is does. In the function, we parse XML to get twitter data, which is the following:

  • Author: This is the person who’s account it was tweeted from. (Whom the item of clothing belonged to); This is what makes each piece of clothing unique. I.E., Socks are socks but Jane’s socks are different from say Dean’s socks. 
  • Status: This is the status message itself or what we’d like to call the clothings emotion.
  • Published: This is the date and time the tweet was made.

Web Interface

If we displayed in the data as it was the data would look something like this
Stuart_Westgate (Stuart Westgate) Pants: I’m feeling cold today. #emotionalclothing. 2/5/13 8:09
So we needed to parse the data even further to get it looking how we wanted; this is also shown in the code above. 
Below is an image that shows how we finally got it looking on are Emotional Clothing website, which can be found at: here:

Website Aesthetic

Our aim was create a social network for clothing; a platform that would display all clothing’s emotions under one roof. For the aesthetic of the website, we wanted to give it an almost neutral look and feel; after all, it’s the textual output of the clothing that’s important here. Plus every item of clothing would be feeling different, i.e., happy, sad etc etc etc. We didn’t feel there was a color that could display all those emotions and that’s why we chose something neutral.

Images

We decided to used cartoon like images as well felt that real images would be to difficult to implement for every item of clothing, and after all this is just a concept model of our project.

However, this being said; if we were to build a full featured social network for clothes; we could attach a picture of that particular item of clothing, so when it tweeted the picture was sent with it. Maybe a camera could even be built into the clothing so that the clothing itself could take pictures of its surrounding, so we would see life through the clothing’s eyes. We believe that our project has got a lot of room for improvement if we did make this into a fully function / featured  model.

GPS Dot

We got our initial idea from a TED video called “How to fool a GPS.” By Ted Humpherys, which basically introduces the idea of objects talking and objects all having GPS devices in them. So thought we’d add this for further reference.

Video from here:

Arduino, Bluetooth, and Android

Friday, January 25th, 2013

I decided to have a go at linking arduino and android together using bluetooth.

When researching how to get the devices communicating, there are many different tutorials out there; but it was this android-firmata project I ended up basing most of the code on. Firmata allows for easier communication from whatever coding language you are using since you can use whatever information from the pin you want. Using the sample application proved troublesome, as my android device is of a higher version than the sample code allows for. Since this was only going to be a test, I used ArduinoCommander to tell digital pin 13 to be an output and to turn on and off (This turns he on board LED on or off).

This video should demonstrate more: