Hang On is a coat rack which reads the weather from the internet and displays it as a simple symbol for the user to see, to aid them when choosing a coat.
Processing pulls the weather data from an XML feed via the Google Weather API and scans the forecast for key terms. These key terms allow the program to pick the nearest weather condition from four I have specified: sunny, cloudy, rainy or snowy. Firmata is installed on the Arduino board, which controls the physical output – an LED light behind a tiny screen in the coat rack.
I decided to create this project because I have been working for some time on pulling data from my Twitter timeline. This has so far proved complicated and I have not yet been successful – so I thought this would be a good opportunity to try something similar but in a more simple state. I like the simplicity of simply displaying the weather. Initially I was going to just make a device – similar to Fido, a project Adrian kindly pointed me towards – but the designer in me wanted to make something more “useful”. I consider simplicity and thoughtfulness to be the two main characteristics in all my design work and I feel Hang On captures both of these.
// Coat Rack
// Joanna Montgomery Culture Lab 2010
//Weather from the Yahoo Weather website
import processing.xml.*;
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
//input pins
int sunnyPin = 13; //pin for sunny light
int cloudyPin = 12; //pin for cloudy light
int rainyPin = 11; //pin for rainy light
int snowyPin = 10; //pin for snowy light
String condition; //weather condition from xml feed
XMLElement xml;
void setup() {
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 115200); //arduino set up
arduino.pinMode(sunnyPin, Arduino.OUTPUT); //set pin as output
arduino.pinMode(cloudyPin, Arduino.OUTPUT); //set pin as output
arduino.pinMode(rainyPin, Arduino.OUTPUT); //set pin as output
arduino.pinMode(snowyPin, Arduino.OUTPUT); //set pin as output
size(200, 200);
//The following section of code was by Tom, without whom my project would have died
//collect data from xml
//declare a new master xml element – this is the parent node which contains everything else
//the xml is invisible until you right click on the page and choose show source
xml = new XMLElement(this, “http://www.google.com/ig/api?weather=NE17RU”);
//get the next level down which is called “weather”
XMLElement weather = xml.getChild(“weather”);
//get the level below weather called current_conditions
XMLElement cond=weather.getChild(“current_conditions”);
//its always nice to count how many children each node has to give yo uan idea of wher you are at
println(cond.getChildCount());
//current_conditions has a child called condition
XMLElement current =cond.getChild(“condition”);
//and inside that child is an attribute called data which has the description
condition=current.getStringAttribute(“data”);
}
//End of code from Tom
//These are the basic weather conditions I’m working with, as well as a test which runs through all 4
//condition = “Snow”;
//condition = “Mostly Cloudy”;
//condition = “Light Rain”;
//condition = “Fair”;
//condition = “Test”;
void draw()
{ //if condition is sunny
if (condition.equals(“Fair”) ||
condition.equals(“Clear”) ||
condition.equals(“Fair with Haze”) ||
condition.equals(“Clear with Haze”) ||
condition.equals(“Fair and Breezy”) ||
condition.equals(“Clear and Breezy”) ||
condition.equals(“A Few Clouds”) ||
condition.equals(“A Few Clouds with Haze”) ||
condition.equals(“A Few Clouds and Breezy”) ||
condition.equals(“Windy”) ||
condition.equals(“Breezy”) ||
condition.equals(“Fair and Windy”) ||
condition.equals(“A Few Clouds and Windy”)
) {
//light up sunny
arduino.digitalWrite(sunnyPin, Arduino.HIGH); // turns the sunny light on
//delay(1000); // waits for a second
//arduino.digitalWrite(sunnyPin, Arduino.LOW); // turns the sunny light off
//delay(1000); // waits for a second
}
//if condition is cloudy
else if (condition.equals(“Mostly Cloudy”) ||
condition.equals(“Mostly Cloudy with Haze”) ||
condition.equals(“Mostly Cloudy and Breezy”) ||
condition.equals(“Partly Cloudy”) ||
condition.equals(“Partly Cloudy with Haze”) ||
condition.equals(“Partly Cloudy and Breezy”) ||
condition.equals(“Overcast”) ||
condition.equals(“Overcast with Haze”) ||
condition.equals(“Overcast and Breezy”) ||
condition.equals(“Fog/Mist”) ||
condition.equals(“Fog”) ||
condition.equals(“Freezing Fog”) ||
condition.equals(“Shallow Fog”) ||
condition.equals(“Partial Fog”) ||
condition.equals(“Patches of Fog”) ||
condition.equals(“Fog in Vicinity”) ||
condition.equals(“Freezing Fog in Vicinity”) ||
condition.equals(“Shallow Fog in Vicinity”) ||
condition.equals(“Partial Fog in Vicinity”) ||
condition.equals(“Patches of Fog in Vicinity”) ||
condition.equals(“Showers in Vicinity Fog”) ||
condition.equals(“Light Freezing Fog”) ||
condition.equals(“Heavy Freezing Fog “) ||
condition.equals(“Smoke”) ||
condition.equals(“Partly Cloudy and Windy”) ||
condition.equals(“Mostly Cloudy and Windy”) ||
condition.equals(“Overcast and Windy”) ||
condition.equals(“Funnel Cloud”) ||
condition.equals(“Funnel Cloud in Vicinity”) ||
condition.equals(“Tornado/Water Spout “) ||
condition.equals(“Dust”) ||
condition.equals(“Low Drifting Dust”) ||
condition.equals(“Blowing Dust”) ||
condition.equals(“Sand”) ||
condition.equals(“Blowing Sand”) ||
condition.equals(“Low Drifting Sand”) ||
condition.equals(“Dust/Sand Whirls”) ||
condition.equals(“Dust/Sand Whirls in Vicinity”) ||
condition.equals(“Dust Storm”) ||
condition.equals(“Heavy Dust Storm”) ||
condition.equals(“Dust Storm in Vicinity”) ||
condition.equals(“Sand Storm”) ||
condition.equals(“Heavy Sand Storm”) ||
condition.equals(“Sand Storm in Vicinity ”) ||
condition.equals(“Haze”)
) {
//light up cloudy
arduino.digitalWrite(cloudyPin, Arduino.HIGH); // turns the cloudy light on
//delay(1000); // waits for a second
//arduino.digitalWrite(cloudyPin, Arduino.LOW); // turns the cloudy light off
//delay(1000); // waits for a second
}
//if condition is rainy
else if (condition.equals(“Freezing Rain”) ||
condition.equals(“Freezing Drizzle”) ||
condition.equals(“Light Freezing Rain”) ||
condition.equals(“Light Freezing Drizzle”) ||
condition.equals(“Heavy Freezing Rain”) ||
condition.equals(“Heavy Freezing Drizzle”) ||
condition.equals(“Freezing Rain in Vicinity”) ||
condition.equals(“Freezing Drizzle in Vicinity “) ||
condition.equals(“Rain Showers”) ||
condition.equals(“Light Rain Showers”) ||
condition.equals(“Light Rain and Breezy”) ||
condition.equals(“Heavy Rain Showers”) ||
condition.equals(“Rain Showers in Vicinity”) ||
condition.equals(“Light Showers Rain”) ||
condition.equals(“Heavy Showers Rain”) ||
condition.equals(“Showers Rain”) ||
condition.equals(“Showers Rain in Vicinity”) ||
condition.equals(“Rain Showers Fog/Mist”) ||
condition.equals(“Light Rain Showers Fog/Mist”) ||
condition.equals(“Heavy Rain Showers Fog/Mist”) ||
condition.equals(“Rain Showers in Vicinity Fog/Mist”) ||
condition.equals(“Light Showers Rain Fog/Mist”) ||
condition.equals(“Heavy Showers Rain Fog/Mist”) ||
condition.equals(“Showers Rain Fog/Mist”) ||
condition.equals(“Showers Rain in Vicinity Fog/Mist”) ||
condition.equals(“Thunderstorm”) ||
condition.equals(“Thunderstorm Rain”) ||
condition.equals(“Light Thunderstorm Rain”) ||
condition.equals(“Heavy Thunderstorm Rain”) ||
condition.equals(“Thunderstorm Rain Fog/Mist”) ||
condition.equals(“Light Thunderstorm Rain Fog/Mist”) ||
condition.equals(“Heavy Thunderstorm Rain Fog and Windy”) ||
condition.equals(“Heavy Thunderstorm Rain Fog/Mist”) ||
condition.equals(“Thunderstorm Showers in Vicinity”) ||
condition.equals(“Light Thunderstorm Rain Haze”) ||
condition.equals(“Heavy Thunderstorm Rain Haze”) ||
condition.equals(“Thunderstorm Fog”) ||
condition.equals(“Light Thunderstorm Rain Fog”) ||
condition.equals(“Heavy Thunderstorm Rain Fog”) ||
condition.equals(“Thunderstorm Light Rain”) ||
condition.equals(“Thunderstorm Heavy Rain”) ||
condition.equals(“Thunderstorm Rain Fog/Mist”) ||
condition.equals(“Thunderstorm Light Rain Fog/Mist”) ||
condition.equals(“Thunderstorm Heavy Rain Fog/Mist”) ||
condition.equals(“Thunderstorm in Vicinity Fog/Mist”) ||
condition.equals(“Thunderstorm Showers in Vicinity”) ||
condition.equals(“Thunderstorm in Vicinity Haze”) ||
condition.equals(“Thunderstorm Haze in Vicinity”) ||
condition.equals(“Thunderstorm Light Rain Haze”) ||
condition.equals(“Thunderstorm Heavy Rain Haze”) ||
condition.equals(“Thunderstorm Fog”) ||
condition.equals(“Thunderstorm Light Rain Fog”) ||
condition.equals(“Thunderstorm Heavy Rain Fog”) ||
condition.equals(“Thunderstorm Hail”) ||
condition.equals(“Light Thunderstorm Rain Hail”) ||
condition.equals(“Heavy Thunderstorm Rain Hail”) ||
condition.equals(“Thunderstorm Rain Hail Fog/Mist”) ||
condition.equals(“Light Thunderstorm Rain Hail Fog/Mist”) ||
condition.equals(“Heavy Thunderstorm Rain Hail Fog/Hail”) ||
condition.equals(“Thunderstorm Showers in Vicinity Hail”) ||
condition.equals(“Light Thunderstorm Rain Hail Haze”) ||
condition.equals(“Heavy Thunderstorm Rain Hail Haze”) ||
condition.equals(“Thunderstorm Hail Fog”) ||
condition.equals(“Light Thunderstorm Rain Hail Fog”) ||
condition.equals(“Heavy Thunderstorm Rain Hail Fog”) ||
condition.equals(“Thunderstorm Light Rain Hail”) ||
condition.equals(“Thunderstorm Heavy Rain Hail”) ||
condition.equals(“Thunderstorm Rain Hail Fog/Mist”) ||
condition.equals(“Thunderstorm Light Rain Hail Fog/Mist”) ||
condition.equals(“Thunderstorm Heavy Rain Hail Fog/Mist”) ||
condition.equals(“Thunderstorm in Vicinity Hail”) ||
condition.equals(“Thunderstorm in Vicinity Hail Haze”) ||
condition.equals(“Thunderstorm Haze in Vicinity Hail”) ||
condition.equals(“Thunderstorm Light Rain Hail Haze”) ||
condition.equals(“Thunderstorm Heavy Rain Hail Haze”) ||
condition.equals(“Thunderstorm Hail Fog”) ||
condition.equals(“Thunderstorm Light Rain Hail Fog”) ||
condition.equals(“Thunderstorm Heavy Rain Hail Fog”) ||
condition.equals(“Thunderstorm Small Hail/Snow Pellets”) ||
condition.equals(“Thunderstorm Rain Small Hail/Snow Pellets”) ||
condition.equals(“Light Thunderstorm Rain Small Hail/Snow Pellets”) ||
condition.equals(“Heavy Thunderstorm Rain Small Hail/Snow Pellets”) ||
condition.equals(“Showers in Vicinity”) ||
condition.equals(“Showers in Vicinity Fog/Mist”) ||
condition.equals(“Showers in Vicinity Fog”) ||
condition.equals(“Showers in Vicinity Haze “) ||
condition.equals(“Freezing Rain Rain”) ||
condition.equals(“Light Freezing Rain Rain”) ||
condition.equals(“Heavy Freezing Rain Rain”) ||
condition.equals(“Rain Freezing Rain”) ||
condition.equals(“Light Rain Freezing Rain”) ||
condition.equals(“Heavy Rain Freezing Rain”) ||
condition.equals(“Freezing Drizzle Rain”) ||
condition.equals(“Light Freezing Drizzle Rain”) ||
condition.equals(“Heavy Freezing Drizzle Rain”) ||
condition.equals(“Rain Freezing Drizzle”) ||
condition.equals(“Light Rain Freezing Drizzle”) ||
condition.equals(“Heavy Rain Freezing Drizzle “) ||
condition.equals(“Thunderstorm in Vicinity”) ||
condition.equals(“Thunderstorm in Vicinity Fog”) ||
condition.equals(“Thunderstorm in Vicinity Haze “) ||
condition.equals(“Light Rain”) ||
condition.equals(“Drizzle”) ||
condition.equals(“Light Drizzle”) ||
condition.equals(“Heavy Drizzle”) ||
condition.equals(“Light Rain Fog/Mist”) ||
condition.equals(“Drizzle Fog/Mist”) ||
condition.equals(“Light Drizzle Fog/Mist”) ||
condition.equals(“Heavy Drizzle Fog/Mist”) ||
condition.equals(“Light Rain Fog”) ||
condition.equals(“Drizzle Fog”) ||
condition.equals(“Light Drizzle Fog”) ||
condition.equals(“Heavy Drizzle Fog “) ||
condition.equals(“Rain”) ||
condition.equals(“Heavy Rain”) ||
condition.equals(“Rain Fog/Mist”) ||
condition.equals(“Heavy Rain Fog/Mist”) ||
condition.equals(“Rain Fog”) ||
condition.equals(“Heavy Rain Fog”)
) {
//light up rainy
arduino.digitalWrite(rainyPin, Arduino.HIGH); // turns the rainy light on
//delay(1000); // waits for a second
//arduino.digitalWrite(rainyPin, Arduino.LOW); // turns the rainy light off
//delay(1000); // waits for a second
}
//if condition is snowy
else if (condition.equals(“Ice Pellets”) ||
condition.equals(“Light Ice Pellets”) ||
condition.equals(“Heavy Ice Pellets”) ||
condition.equals(“Ice Pellets in Vicinity”) ||
condition.equals(“Showers Ice Pellets”) ||
condition.equals(“Thunderstorm Ice Pellets”) ||
condition.equals(“Ice Crystals”) ||
condition.equals(“Hail”) ||
condition.equals(“Small Hail/Snow Pellets”) ||
condition.equals(“Light Small Hail/Snow Pellets”) ||
condition.equals(“Heavy small Hail/Snow Pellets”) ||
condition.equals(“Showers Hail”) ||
condition.equals(“Hail Showers”) ||
condition.equals(“Freezing Rain Snow”) ||
condition.equals(“Light Freezing Rain Snow”) ||
condition.equals(“Heavy Freezing Rain Snow”) ||
condition.equals(“Freezing Drizzle Snow”) ||
condition.equals(“Light Freezing Drizzle Snow”) ||
condition.equals(“Heavy Freezing Drizzle Snow”) ||
condition.equals(“Snow Freezing Rain”) ||
condition.equals(“Light Snow Freezing Rain”) ||
condition.equals(“Heavy Snow Freezing Rain”) ||
condition.equals(“Snow Freezing Drizzle”) ||
condition.equals(“Light Snow Freezing Drizzle”) ||
condition.equals(“Heavy Snow Freezing Drizzle”) ||
condition.equals(” Rain Ice Pellets”) ||
condition.equals(“Light Rain Ice Pellets”) ||
condition.equals(“Heavy Rain Ice Pellets”) ||
condition.equals(“Drizzle Ice Pellets”) ||
condition.equals(“Light Drizzle Ice Pellets”) ||
condition.equals(“Heavy Drizzle Ice Pellets”) ||
condition.equals(“Ice Pellets Rain”) ||
condition.equals(“Light Ice Pellets Rain”) ||
condition.equals(“Heavy Ice Pellets Rain”) ||
condition.equals(“Ice Pellets Drizzle”) ||
condition.equals(“Light Ice Pellets Drizzle”) ||
condition.equals(“Heavy Ice Pellets Drizzle “) ||
condition.equals(“Rain Snow”) ||
condition.equals(“Light Rain Snow”) ||
condition.equals(“Heavy Rain Snow”) ||
condition.equals(“Snow Rain”) ||
condition.equals(“Light Snow Rain”) ||
condition.equals(“Heavy Snow Rain”) ||
condition.equals(“Drizzle Snow”) ||
condition.equals(“Light Drizzle Snow”) ||
condition.equals(“Heavy Drizzle Snow”) ||
condition.equals(“Snow Drizzle”) ||
condition.equals(“Light Snow Drizzle”) ||
condition.equals(“Heavy Drizzle Snow”) ||
condition.equals(“Snow”) ||
condition.equals(“Light Snow”) ||
condition.equals(“Heavy Snow”) ||
condition.equals(“Snow Showers”) ||
condition.equals(“Light Snow Showers”) ||
condition.equals(“Heavy Snow Showers”) ||
condition.equals(“Showers Snow”) ||
condition.equals(“Light Showers Snow”) ||
condition.equals(“Heavy Showers Snow”) ||
condition.equals(“Snow Fog/Mist”) ||
condition.equals(“Light Snow Fog/Mist”) ||
condition.equals(“Heavy Snow Fog/Mist”) ||
condition.equals(“Snow Showers Fog/Mist”) ||
condition.equals(“Light Snow Showers Fog/Mist”) ||
condition.equals(“Heavy Snow Showers Fog/Mist”) ||
condition.equals(“Showers Snow Fog/Mist”) ||
condition.equals(“Light Showers Snow Fog/Mist”) ||
condition.equals(“Heavy Showers Snow Fog/Mist”) ||
condition.equals(“Snow Fog”) ||
condition.equals(“Light Snow Fog”) ||
condition.equals(“Heavy Snow Fog”) ||
condition.equals(“Snow Showers Fog”) ||
condition.equals(“Light Snow Showers Fog”) ||
condition.equals(“Heavy Snow Showers Fog”) ||
condition.equals(“Showers Snow Fog”) ||
condition.equals(“Light Showers Snow Fog”) ||
condition.equals(“Heavy Showers Snow Fog”) ||
condition.equals(“Showers in Vicinity Snow”) ||
condition.equals(“Snow Showers in Vicinity”) ||
condition.equals(“Snow Showers in Vicinity Fog/Mist”) ||
condition.equals(“Snow Showers in Vicinity Fog”) ||
condition.equals(“Low Drifting Snow”) ||
condition.equals(“Blowing Snow”) ||
condition.equals(“Snow Low Drifting Snow”) ||
condition.equals(“Snow Blowing Snow”) ||
condition.equals(“Light Snow Low Drifting Snow”) ||
condition.equals(“Light Snow Blowing Snow”) ||
condition.equals(“Light Snow Blowing Snow Fog/Mist”) ||
condition.equals(“Heavy Snow Low Drifting Snow”) ||
condition.equals(“Heavy Snow Blowing Snow”) ||
condition.equals(“Thunderstorm Snow”) ||
condition.equals(“Light Thunderstorm Snow”) ||
condition.equals(“Heavy Thunderstorm Snow”) ||
condition.equals(“Snow Grains”) ||
condition.equals(“Light Snow Grains”) ||
condition.equals(“Heavy Snow Grains”) ||
condition.equals(“Heavy Blowing Snow”) ||
condition.equals(“Blowing Snow in Vicinity”)
) {
//light up snowy
arduino.digitalWrite(snowyPin, Arduino.HIGH); // turns the snowy light on
//delay(1000); // waits for a second
//arduino.digitalWrite(snowyPin, Arduino.LOW); // turns the snowy light off
//delay(1000); // waits for a second
}
else if (condition.equals(“Test”)) {
//TEST condition runs through each condition, blinking 3 times for each
//light up sunny
arduino.digitalWrite(sunnyPin, Arduino.HIGH); // turns sunny light on
delay(1000); // waits for a second
arduino.digitalWrite(sunnyPin, Arduino.LOW); // turns sunny light off
delay(1000); // waits for a second
arduino.digitalWrite(sunnyPin, Arduino.HIGH); // turns sunny light on
delay(1000); // waits for a second
arduino.digitalWrite(sunnyPin, Arduino.LOW); // turns sunny light off
delay(1000); // waits for a second
arduino.digitalWrite(sunnyPin, Arduino.HIGH); // turns sunny light on
delay(1000); // waits for a second
arduino.digitalWrite(sunnyPin, Arduino.LOW); // turns sunny light off
delay(1000); // waits for a second
//light up rainy
arduino.digitalWrite(rainyPin, Arduino.HIGH); // turns the rainy light on
delay(1000); // waits for a second
arduino.digitalWrite(rainyPin, Arduino.LOW); // turns the rainy light off
delay(1000); // waits for a second
arduino.digitalWrite(rainyPin, Arduino.HIGH); // turns the rainy light on
delay(1000); // waits for a second
arduino.digitalWrite(rainyPin, Arduino.LOW); // turns the rainy light off
delay(1000); // waits for a second
arduino.digitalWrite(rainyPin, Arduino.HIGH); // turns the rainy light on
delay(1000); // waits for a second
arduino.digitalWrite(rainyPin, Arduino.LOW); // turns the rainy light off
delay(1000); // waits for a second
//light up cloudy
arduino.digitalWrite(cloudyPin, Arduino.HIGH); // turns the cloudy light on
delay(1000); // waits for a second
arduino.digitalWrite(cloudyPin, Arduino.LOW); // turns the cloudy light off
delay(1000); // waits for a second
arduino.digitalWrite(cloudyPin, Arduino.HIGH); // turns the cloudy light on
delay(1000); // waits for a second
arduino.digitalWrite(cloudyPin, Arduino.LOW); // turns the cloudy light off
delay(1000); // waits for a second
arduino.digitalWrite(cloudyPin, Arduino.HIGH); // turns the cloudy light on
delay(1000); // waits for a second
arduino.digitalWrite(cloudyPin, Arduino.LOW); // turns the cloudy light off
delay(1000); // waits for a second
//light up snowy
arduino.digitalWrite(snowyPin, Arduino.HIGH); // turns the snowy light on
delay(1000); // waits for a second
arduino.digitalWrite(snowyPin, Arduino.LOW); // turns the snowy light off
delay(1000); // waits for a second
arduino.digitalWrite(snowyPin, Arduino.HIGH); // turns the snowy light on
delay(1000); // waits for a second
arduino.digitalWrite(snowyPin, Arduino.LOW); // turns the snowy light off
delay(1000); // waits for a second
arduino.digitalWrite(snowyPin, Arduino.HIGH); // turns the snowy light on
delay(1000); // waits for a second
arduino.digitalWrite(snowyPin, Arduino.LOW); // turns the snowy light off
delay(1000); // waits for a second
}
}
//gone slightly insane commenting all this code