WhatToWear

Made by Haorong Ou

Found in Home Hack

Have you tried to wear a heavy coat in a super warm day in winter for rushing the schedule without checking the weather report? Would you struggle to figure out what to wear in this rapid-change weather day? Do not want to waste your time to change your clothes only when you step outside your house? Now WhatToWear can help you sense the outside temperature and humidity and send a sign to you suggesting the weather ouside and what to wear.

0

Intention

This project is to sense the outside temperature in the morning and tell you what to wear in the morning.


0

Context

Staying in the warm house without noticing the outside weather cause some trouble for me to choose what to wear especially when I am in a hurry. So in this assignment, I want to build a smart temperature sensor that can detect the temperature outside and send an SMS or Email in the morning when you wake up. You can know the temperature by the light of LED and get the information by press the button.  

0

Process

Components include: Button, LED light, Temperature sensor

The goal is to use the temperature sensor to detect the temperature and use ifttt to send SMS to the connected phone at 7:30 in the morning. At the same time the LED light is to inform the weather and the button is to detect the temperature and send the SMS right now. 

The challenge is to think about a good way to send SMS,  I don't think sending SMS every hour is a good choice, so I choose a fix time to send SMS which is in the morning.

0

Reflection

This product is my first IoT product, it's not that difficult as I imagined before. I learned a lot from putting the code and circuit 

0
#include "OneWire.h"

#include "spark-dallas-temperature.h"

#include <math.h>

OneWire oneWire( D0 );

DallasTemperature dallas( &oneWire );

double temperature = 0.0;
double temperatureF = 0.0;
int currenttime = 0;
int currentmin = 0;
int buttonPin = D1;
int redPin = A0;
int greenPin = D2;
int bluePin = D3;
int photoResistorCheckTime = 60000;
int lastPhotoResistorReport;

void setup()
{

    Particle.variable( "temperature", &temperature, DOUBLE );
    Particle.variable( "temperatureF", &temperatureF, DOUBLE );
    Particle.variable( "time", &currenttime, INT );
    Particle.variable( "min",&currentmin, INT );

    pinMode( redPin, OUTPUT);
    pinMode( greenPin, OUTPUT);
    pinMode( bluePin, OUTPUT);


    pinMode( buttonPin, INPUT_PULLUP );


    dallas.begin();

    Serial.begin( 9600 );

    lastPhotoResistorReport = millis();

}

void loop()
{

      int buttonState = digitalRead( buttonPin );

      dallas.requestTemperatures();

      sin( 23423 );


      float tempC = dallas.getTempCByIndex(0);

      temperature = (double)tempC;
      Time.zone(-5);
      currenttime = Time.hour();
      currentmin = Time.minute();


      float tempF = DallasTemperature::toFahrenheit( tempC );

      temperatureF = (double)tempF;


      Serial.print( "Temp in C = ");
      Serial.print( tempC );
      Serial.print( "\t\t F = ");
      Serial.println( tempF );
      Serial.print( currenttime );
      Serial.print( currentmin );


      if( temperature <= 5 ){
        digitalWrite( redPin, 0 );
        digitalWrite( greenPin, 255 );
        digitalWrite( bluePin, 255 );
      }
      if( temperature > 5 and temperature <= 20 ){
        digitalWrite( redPin, 255 );
        digitalWrite( greenPin, 0 );
        digitalWrite( bluePin, 255 );
      }
      if( temperature >20 ){
        digitalWrite( redPin, 255 );
        digitalWrite( greenPin, 255 );
        digitalWrite( bluePin, 0 );
      }

      if( currenttime == 7 and currentmin == 30 ){
        if( (millis() - lastPhotoResistorReport) >= photoResistorCheckTime ){
          lastPhotoResistorReport = millis();
          if ( temperature <= 5 ) Particle.publish( "temperaturelevel", "Cold", PRIVATE );
          if ( temperature > 5 and temperature <= 20 ) Particle.publish("temperaturelevel", "Cool", PRIVATE );
          if ( temperature > 20 ) Particle.publish( "temperaturelevel", "Warm", PRIVATE );
        };
      };

      if( buttonState == LOW ){
        if ( temperature <= 5 ) Particle.publish( "temperaturelevel", "Cold", PRIVATE );
        if ( temperature > 5 and temperature <= 20 ) Particle.publish("temperaturelevel", "Cool", PRIVATE );
        if ( temperature > 20 ) Particle.publish( "temperaturelevel", "Warm", PRIVATE );
      };
}
Click to Expand
x
Share this Project

Found In
Courses

49-713 Designing for the Internet of Things

· 26 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

Have you tried to wear a heavy coat in a super warm day in winter for rushing the schedule without checking the weather report? Would you struggle to figure out what to wear in this rapid-change weather day? Do not want to waste your time to change your clothes only when you step outside your house? Now WhatToWear can help you sense the outside temperature and humidity and send a sign to you suggesting the weather ouside and what to wear.

Created

January 26th, 2017