Weather Getter

Made by VANESSA MANZ

Found in DioT 2019: Augmented Objects

This integration enchants a bedside lamp to give a weather update when prompted.

0

Problem Statement: 
The device is for my mom. I picked her because she spent most of her life caring for me and I wanted to build her something. She's a recent retiree who can finally indulge her night owl habits now that she doesn't have to report to a job every day. She loves to spend her evenings relaxing late into the night while reading, listening to the radio, keeping tabs on my dad, and tracking the weather.


The weather is really important to her because it gives her something to talk to my dad about. It also helps her to plan her days- what she will wear and where she will go. The weather is probably the very first thing she thinks of when she wakes up in the morning.


She sleeps in a really dark room. Since she goes to bed late and wakes up late, she has to keep it dark so she doesn't miss her beauty sleep. This means that when she wakes up, she doesn't know what is going on with the weather outside. And since that is one of the first things she thinks about in the morning, this presents a problem.


She has a phone but doesn't like sleeping with it in her room in case it rings. She could get out of bed to look, but then she'd get up before she was ready. What she really needs is a way to learn the weather from the comfort of her bed without using a screen.


When exploring her room, I learned that she really likes the lamp on her dresser. She's had it for years. I remember her having it when I was growing up. We both thought it would be nice to give it some enchantment.

0

Goal:

The solution will visually communicate whether it is warm or cold outside and will turn on when it is spoken to. This will allow my mom to learn the weather before getting out of bed.

0

Process: 

I developed the prototype systemically, using the techniques we learned in class.

1. I sketched out in plain language what I wanted to accomplish with the solution.

2. I researched on adaFruit to find the right components and examples of code.

3. I explored the IoT station and selected a number of options for the sensor and the light.

4. I wired each of the components and coded them separately to make sure that they worked.

5. I built a webhook that would "GET" the temperature for my mother's zip code when called.

6. I integrated the components and their code a step at a time. This is the point at which I entered what I call, the "washing machine". 

Despite days of googling and trying different code to effectively use the webhook, the microphone, and the neopixels, they would not work together. Layering a webhook on top of them stretched my meager coding skills to their limit.

0

Process (continued):

7. After many iterations that failed to work, I share my vision with Daragh and Taylor. As I stepped them through my approach, they were able to help me put the neopixel code where it belonged, create variables to store the sound and temperature data, and revised the webhook to work correctly by inserting the API code into the address.

0

Reflections:

In the end, the light was successfully triggered to turn on when activated by sound. It turned red or blue depending on the temperature of the town it pointed to. I learned that my approach was right and that with more experience I will need less help getting the code aligned properly. I am proud that I was able to deliver a prototype to my mom that met her expectations 100%.

0

Completed circuit

0

Completed Code

0
o// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_COUNT 16
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

/****************************************
Example Sound Level Sketch for the 
Adafruit Microphone Amplifier
****************************************/

int loudNoise = 1;

const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;

double temperature = 0;

void setup() 
{
   Serial.begin(9600);
   strip.begin();
   strip.show();
   Particle.publish( "weather" );
   Particle.subscribe("hook-response/weather", myHandler, MY_DEVICES);
}

void myHandler(const char *event, const char *data) {
  // Handle the integration response
  
  temperature = (double)(String( data ).toFloat());
  
}
          



void loop() 
{
   unsigned long startMillis= millis();  // Start of sample window
   unsigned int peakToPeak = 0;   // peak-to-peak level

   unsigned int signalMax = 0;
   unsigned int signalMin = 4095;

   // collect data for 50 mS
   while (millis() - startMillis < sampleWindow)
   {
      sample = analogRead(0);
      if (sample < 4095)  // toss out spurious readings
      {
         if (sample > signalMax)
         {
            signalMax = sample;  // save just the max levels
         }
         else if (sample < signalMin)
         {
            signalMin = sample;  // save just the min levels
         }
      }
   }
   peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
   double volts = (peakToPeak * 5.0) / 4095;  // convert to volts
   
   if( volts > 0.07 ){

       if( loudNoise < 1 ){
           Particle.publish( "weather" );
       }

       loudNoise = 100;
       
   }
   
   if( loudNoise > 0){
        //int color = map( loudNoise, 0, 100, 0, 255);
        int t = (int)(temperature * 100);
        
        int color = map( loudNoise, 0, 10000, 0, 255);
        
        // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
        for(int i = 0 ; i < strip.numPixels(); i++ ){
            strip.setPixelColor(i, strip.Color(t,0,255-t)); // Blue.
        }

       strip.show(); // This sends the updated pixel color to the hardware.
       loudNoise = loudNoise - 1;
   }else{
        for(int i = 0 ; i < strip.numPixels(); i++ ){
            strip.setPixelColor(i, strip.Color(0,0,0)); // Red.
        }
        strip.show(); // This sends the updated pixel color to the hardware.

   }
   
   

   delay( 50 );

// //code to turn on the light
// if (volts > .03)
// {
//     // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
//     strip.setPixelColor(0, strip.Color(0,0,255)); // Blue.

//     strip.show(); // This sends the updated pixel color to the hardware.
// }
// else
// {
//      strip.setPixelColor(0, strip.Color(255,0,0)); // Red.

//     strip.show(); // This sends the updated pixel color to the hardware.
// }
   Serial.println(loudNoise);
   Serial.println(volts);
}
Click to Expand
0

Wiring Schematic

0

List of Parts:

  • 1 Particle Microcontroller
  • 1 Breadboard
  • 8 Jumper Wires
  • Neopixel ring
  • MAX 4466 microphone
  • 1 USB Micro B Cable 
x
Share this Project

Courses

49713 Designing for the Internet of Things

· 18 members

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


Focused on
About

This integration enchants a bedside lamp to give a weather update when prompted.

Created

January 29th, 2019