Introduction: Air.id Weather Predictor

The Air.id is an iteration of a project done by 3rd year Industrial Students Phil Adams, Tessa Goldie and Bree Sopatyk at Emily Carr University for Smart Objects CORE Study. The Air.id connects to the internet to find the Weather Networks RSS Feed about the upcoming weather conditions in Vancouver, BC, Canada. When the weather shows rain or a high chance of rain the Arduino is told to light up its LEDs.

(Disclaimer: We didn't complete how to meld the XML file used to get the RSS Feed to the LED function on the Arduino, it was slightly out of our time range. Also we didn't link the Arduino up to Wi-Fi and used the USB from our laptop to get on the internet and prove our concept. That sounds like a fun project for you to do though)

The physical object is patent pending, however the code use is on the creative commons.

Step 1: Parts

The Air.id has very simple components, they are as follows;

1-Arduino

2-LEDs

2-220 Ohms resistors

1-USB cord

Install Processing 3

Install Arduino Sketch

Step 2: Getting on the Web

This program was written in Arduino Sketch and Processing 3.

There are a few things to read up on as external links that we shall provide. Firstly is understanding what an RSS Feed is and how to find it on a website, here is the link: http://www.whatisrss.com/ Secondly is understanding what an XML file is and how to use it on Processing 3, here is the link: http://www.whatisrss.com/

It was discovered early on in this stage that hooking up to Wi-Fi was going to be exceedingly difficult, the group decided to use the internet from a laptop and run the program through a USB cord into the Arduino and that this would still prove the concept being explored. Here is the code and annotations that are used inside the Air.id to connect to the web and sort it into an INPUT;

// Below load RSS feed
String url = "http://rss.theweathernetwork.com/weather/cabc0308";

// Tell the XML feed that it is connected to the url for the Wather Network above and that its name is 'rss' now XML rss = loadXML(url);

// Get the first 'item' in the list of items in the XML feed XML firstChild = rss.getChild("channel/item/description");

// Get the value of the 'description' element and convert to string so the content can be grabbed

String weather = firstChild.getContent("description").toString();

// Check if the forecast contains the words pertaining to rain

if (weather.contains("Rain") || weather.contains("Light showers") || weather.contains("Overcast")) {

// And in the case that the XML feed does have the words stated in the above 'if()' the program tells the Arduino to //turn on the LED's

println("LED OUTPUT HIGH"); }

else

{

// And in the case that the XML feed does have the words stated in the above 'if()' the program tells the Arduino to turn on the LED's println("LED OUTPUT LOW");

}

// The line below is just to show the contents of the 'description' field. println(weather);

Step 3: Lighting Up the Arduino

The third step revolves around the output the Air.id will display to the user. We used two LEDs and put them on a Fade function. To find the Fade function follow this process; Open Arduino Sketch and got to File > Examples > Basics > Fade

Here is the code that was used for the Air.id;

//The Air.id has two LEDs attached to it, since these LEDs fade at a different values they both must be individually stated.
int ledPinA = 9; // On the Arduino pin 9 has a LED attached to in int brightnessA = 0; // The initial brightness value of pin 9 int fadeAmountA = 5; // How many points to fade the LED by

int ledPinB = 11; // On the Arduino pin 11 has a LED attached to in int brightnessB = 0; // The initial brightness value of pin 11 int fadeAmountB = 3; // How many points to fade the LED by

// The setup routine runs once void setup() { // Declare pin 9 and 11 to be outputs: pinMode(ledPinA, OUTPUT); pinMode(ledPinB, OUTPUT); }

// The loop routine runs over and over again. void loop() { // Set the brightness of pin 9 and 11: analogWrite(ledPinA, brightnessA); analogWrite(ledPinB, brightnessB);

// The brightness grows from 0 by the fadeAmount stated in the 'int' statements above to a total of 255 at a speed of 1 fadeAmount per 30 miliseconds brightnessA = brightnessA + fadeAmountA; brightnessB = brightnessB + fadeAmountB;

if (brightnessA == 0 || brightnessA == 255) { fadeAmountA = -fadeAmountA ; }

if (brightnessB == 0 || brightnessB == 255) { fadeAmountB = -fadeAmountB ; }

delay(30); }

To install the hardware onto the Arduino platform solder the cathode of each LED to a 220 Ohm resistor and place both the resistor cathodes in the GRD (ground) pin and the anodes separately into your desired digital pins (for the Air.id they are pin 9 and pin 11).

Step 4: Improve

We are happy to for you to patch up any holes you see in our project. Open Source is a great thing and we hope you learned something from our attempts and improve on them for your own self development and for future makers. Cheers.