Motion sensor alarm with sound and weather updates

Hi, I am new to the Arduino community, and I have never used an arduino microcontroller before, but I have some experience with Java. Simply put, I would like to set up a motion sensor alarm that senses when I wake up, and then, I want to write a program that will gather information about the weather somehow, either by taking it from weather.com, a thermometer and a barometer, etc. Then, based on that information, I will have a series of "if" statements that will then play an mp3 that corresponds to the correct weather. For example: I wake up, the program sees that it is raining and cold, a message that corresponds to this weather condition is played through a speaker, and BAM, I know what to wear today. So I need to know, what will I need (specific microcontroller, wires, motion sensor), how do I connect all of it? (I dont have much experience with wiring, so I need to know how to run the program by activating the motion sensor) how do I write a program that will do this (how will it get information about the weather into the program, and then, and how will I make variables that take that will hold that information, how will I play the mp3)? Do I need any special cables to connect my computer to the microcontroller? Is it possible to store the mp3 files in the microboard? And finally, what do I need to do to connect the microcontroller to the speaker, so it will play the sound? I know that I need to learn a lot, but I would really appreciate the help, I like challenges. Thanks!

but I would really appreciate the help, I like challenges.

Don't try to do the project in one step. Start with some portion. Perhaps start with the MP3 part. You'll need an MP3 shield, which will constrain the kinds of Arduino you can use.

Get the Arduino to play random tracks.

Then, get the Arduino to read the serial port to determine which track to play. Open the Serial Monitor and send "Sunny" or "Cold" or "Rain". Then, play the correct track.

Next, send the serial port two values, like "<80, 30>". Have the Arduino parse the temperature and chance of rain. Then, decide what to play based on that.

Then, get the Arduino an Ethernet shield, and have it get data from a server, and parse that to get the temperature and chance of rain.

Ok, that sounds like a good plan, but how would i make that program with the mp3s?

but how would i make that program with the mp3s?

Most people use a text editor. Which MP3 shield are you using? Most come with at least a link to a library with examples.

I think i am going to use the Arduino Uno board, i think it has one in it, and I will use a text editor to write the program, i meant that i dont know how to make a program that plays a specific mp3 file

I have made the attected weather forcast program for the Ethernet shield based on Ethernet examples. The weather information is displayed in a LCD display (20x4). I hope the code is usefull for you !

CODE:

/*
  Web client
 
 This sketch connects to the Yahoo website and read the local weather forcast. Display the weather forcst in
 a LCD 20x4 display and which is automatically updated.

 Steps to configure your own weather forcast station:
 1) Connect the LCD to your Ethernet shield
 2) Configure the LCD connection (LiquidCrystal lcd)
 3) Connect and configure the Ethernet shield to the internet
 4) Visit the homepage http://developer.yahoo.com/weather/ and find the webpage addres for your weather forcast 
 5) Enter you webpage address into the Arduino program (lient.println("GET ............")); --> 2 codelines have to be changed
 6) Select the data you want to show in the LCD (//Print the result)
 
 Circuit:
 * Ethernet shield with LCD connected
 
 created 15 Jun 2013
 by Jan Pietraszek
 
 */

#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(87,248,122,181); 

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

String StrWeather="",
    NowWindChill,NowDirection,NowSpeed,NowHumidity,NowTemp,
    TodayLowTemp,TodayHighTemp,TodayCondition,
    TomorrowLowTemp,TomorrowHighTemp,TomorrowCondition,
    TodayDate,NowCondition,
    Line1,Line2,Line3,Line4;
int NextStr = 1,Dummy;
boolean StringFound = false, Connected = false;

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(115200);
  
  lcd.begin(20, 4);
  // Print a message to the LCD.
  lcd.print("Weather station!");
  delay(2000);

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP, waiting forever seconds");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.println("GET http://weather.yahooapis.com/forecastrss?w=551908&u=c HTTP/1.0");
    client.println();
  } 
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

boolean SearchText(int NextStr)
{
  // search for the next text string
  switch (NextStr) {
    case 1: Dummy=StrWeather.indexOf("wind chill=\"",1);
            break;
    case 2: Dummy=StrWeather.indexOf("direction=\"",1);
            break;
    case 3: Dummy=StrWeather.indexOf("speed=\"",1);
            break;
    case 4: Dummy=StrWeather.indexOf("humidity=\"",1);
            break;
    case 5: Dummy=StrWeather.indexOf("condition  text=\"",1);
            break;             
    case 6: Dummy=StrWeather.indexOf("temp=\"",1);
            break;
    case 7: Dummy=StrWeather.indexOf("low=\"",1);
            break;
    case 8: Dummy=StrWeather.indexOf("high=\"",1);
            break;
    case 9: Dummy=StrWeather.indexOf("text=\"",1);
            break;
    case 10: Dummy=StrWeather.indexOf("date=\"",1);
            break;
    case 11: Dummy=StrWeather.indexOf("low=\"",1);
            break;
    case 12: Dummy=StrWeather.indexOf("high=\"",1);
             break;
    case 13: Dummy=StrWeather.indexOf("text=\"",1);
            break;
    default: Dummy=-1;
    }
  if (Dummy>-1)  {
    return true;
  }
  else  {
    return false;
  }
} 

void StorValue(int NextStr) {
  Dummy=StrWeather.length();
  switch (NextStr) {
    case 1: NowWindChill = StrWeather.substring(0,Dummy-1);
            break;
    case 2: NowDirection = StrWeather.substring(0,Dummy-1);
            break;
    case 3: NowSpeed = StrWeather.substring(0,Dummy-1);
            break;
    case 4: NowHumidity = StrWeather.substring(0,Dummy-1);
            break;
    case 5: NowCondition = StrWeather.substring(0,Dummy-1);
            break;
    case 6: NowTemp = StrWeather.substring(0,Dummy-1);
            break;
    case 7: TodayLowTemp = StrWeather.substring(0,Dummy-1);
            break;
    case 8: TodayHighTemp = StrWeather.substring(0,Dummy-1);
            break;   
    case 9: TodayCondition = StrWeather.substring(0,Dummy-1);
            break; 
    case 10: TodayDate = StrWeather.substring(0,Dummy-1);
            break;   
    case 11: TomorrowLowTemp = StrWeather.substring(0,Dummy-1);
            break;   
    case 12: TomorrowHighTemp = StrWeather.substring(0,Dummy-1);
            break;     
    case 13: TomorrowCondition = StrWeather.substring(0,Dummy-1);
            break;    
    default: ;
    }
}

void loop()
{
  if (client.available()) {
    // Add next char to string
    char c = client.read();
    StrWeather += c;
    if ((StringFound) && (c == '"')) {
      // First quote after string found
      StorValue(NextStr);
      NextStr+=1;
      StrWeather="";
      StringFound=false;
    }
    if (SearchText(NextStr)) {
      // String found
      StrWeather="";
      StringFound=true;
    }
    if (StrWeather.length() > 40) {
      // reduce the stringlenght 
      StrWeather = StrWeather.substring(10);
    }
  }
 
  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    // Disconnecting
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    //Print the result
    lcd.clear();
    lcd.setCursor(0,3);
    Line1=NowTemp+"C/"+NowWindChill+"C,"+NowSpeed+"ms,"+NowHumidity+"%";
    lcd.setCursor(0,0);
    lcd.print(Line1);
    Line2=TodayLowTemp+"C/"+TodayHighTemp+"C";
    lcd.setCursor(0,1);
    lcd.print(Line2);
    Line3=NowCondition.substring(0,19);;
    lcd.setCursor(0,2);
    lcd.print(Line3);
    Line4="Tomorrow:"+TomorrowLowTemp+"C/"+TomorrowHighTemp+"C";
    lcd.setCursor(0,3);
    lcd.print(Line4);
    Serial.println();
    Serial.println(Line1);
    Serial.println(Line2);
    Serial.println(Line3);
    Serial.println(Line4);
    NowTemp="";
    NowWindChill="";
    NowSpeed="";
    NowHumidity="";
    TodayLowTemp="";
    TodayHighTemp="";
    NowCondition="";
    TomorrowLowTemp="";
    TomorrowHighTemp="";
    StrWeather="";
    NextStr=1;
    StringFound=false;
    Serial.println("---------------------------------------");


    // Wait for some milli seconds - 1 hour = 3600000
    delay(1800000);
  
    // if you get a connection, report back via serial:
    if (client.connect(server, 80)) {
      // Connected
      Serial.println("connected");
      // Make a HTTP request:
      client.println("GET http://weather.yahooapis.com/forecastrss?w=551908&u=c HTTP/1.0");
      client.println();
    } 
    else {
      // Connection to the server failed
      Serial.println("connection failed");
    }
  }
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

i think it has one in it,

One what? No Arduino has, natively, the ability to store, decode, and play MP3 files.

Wow, thanks so much for taking the time to write out that entire code, that was really helpful! Also, if I get an Arduino, I would also need to buy an mp3 and ethernet shield separately right?