Ambient light that reacts to Google Calendar alerts

Made by Brian Hernandez

To make the ambient light light up red when there is an event 15 mins out

Created: December 7th, 2023

0

Intention:

The goal of this project was to create an ambient calendar alert using the 16 neopixel strip. I was able to connect my particle device to my Google Calendar through IFTT and display an alert using the neopixel LED.

0

Process

The process for this product was a long one. I first started off by going back and learning about the LED lights and how to connect the IFTTT to the particle. 

So first I was able to connect the LED lights to the breadboard and get them to light up. Then I wanted to change the color so I did and made the lights green. I then wanted to turn each individual light off one by one. After that I wanted to change the colors of the light one by one. Then came the hard part of connecting the IFTTT to the particle.  Then I created the code so that it turns red when I connect to it and finally it also fades to white.

0

Product

The product I created is an ambient calendar alert that turns a bright red when there is 15 mins left until the event. It then also slowly turns white while the event is happening and finally a white when the event is over. 

0

Reflection

I learned that I need to be careful with the key that is connected to my particle device. Also, the there are many different libraries and you have to go into the library and link it to your code. Becuase if you try to type out "#include <neopixel.h>" it won't work. 

Some of the other things I would have loved to do would be to connect the other IFTTT to the particle code like emails. This would be very helpful for me as sometimes I don't check my emails as much as I would like to.

0

Here we have the beginning of me learning how to connect a light to the bread board and exploring what all I can do with it.

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

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

void setup() {
    
    strip.begin();
    strip.show();
}

void loop() {

                // Add This Part back if you want to make it rotate changing colors 
 
//     for( int i = 0; i < strip.numPixels(); i++ ){
//      strip.setPixelColor(i, 255, 40, 40 ); // set a color 
//     strip.show();
//     delay( 10 );
// }
//       for( int i = 0; i < strip.numPixels(); i++ ){
//      strip.setPixelColor(i, 70, 70, 255 ); // set a color 
      
//     strip.show();
//     delay( 10 );
//       }

                 // This makes it go brighter and then dim back down

    for( int k = 0; k <256; k++ ){
        for( int i = 0; i < strip.numPixels(); i++ ){
            strip.setPixelColor(i, k / 2, 0, k ); // set a color 
        }
    strip.show();
    delay( 10 );
}
    for( int k = 255; k >=0; k-- ){
      for( int i = 0; i < strip.numPixels(); i++ ){
      strip.setPixelColor(i, k / 2, 0, k ); // set a color
      }
    strip.show();
    delay( 10 );
      }
}
Click to Expand
0

Here we have the beginning of the calendar being attached to the code so that it turns a bright red.

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

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

bool eventLightUp=false; 

void setup() {
    strip.begin ();
    strip.show();  
    
    Particle.function("eventLightUp",handleHandleLightUp);
}

void loop() {
    if (eventLightUp==true){
        for (int k=0; k<256; k++){
            for (int i=0; i<strip.numPixels(); i++){
                strip.setPixelColor(i, k/2,k,k);
            
                strip.show();
                delay(100);
                }
         }
    
        for (int k=256; k>=0; k--){
            for (int i=0; i<strip.numPixels(); i++){
                strip.setPixelColor(i, k/2,k,k);
            
                strip.show();
                delay(20);
                }
        }
    
    delay(100);
    
    }
    else{
        for(int i=0;i<strip.numPixels();i++){
            strip.setPixelColor(i,250,0,0);
        
        strip.show();
        delay(20);
        }
    }
}

int handleHandleLightUp (String cmd){
   
    eventLightUp=true;
    
    return -1;
}
Click to Expand
0

  Here we have the device turning white while the event is ending.  

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

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

int durationFade = 1000*60*15;
long timeStart = -1; //The Action starts
bool timerStarted = false; //If the timer for fading has started 

void setup() {
    strip.begin ();
    strip.show();  
    
   
    Particle.function("fadeUp", handleFadeUp);
}

void loop() {
    if (timerStarted==true){
        
        long timeNow = millis();
        long timeElapsed = timeNow - timeStart;
        
        if(timeElapsed < durationFade){
            int colorValue = map(timeElapsed, 0, durationFade, 0, 255); 
            
            int r=colorValue;
            int g=0;
            int b=0;
            
            for(int i=0; i<strip.numPixels();i++){
                strip.setPixelColor(i,r,g,b);
                
            }
            strip.show();
        }else{
            timerStarted = false;
             for(int k=256; k>=0; k--){
                 for(int i=0;i<strip.numPixels();i++){
                    strip.setPixelColor(i,0,0,250);
                    strip.show();
        
               delay(10);
                }
             }
        }
    }

    else{
        for(int i=0;i<strip.numPixels();i++){
            strip.setPixelColor(i,10,10,10);
        
        strip.show();
        delay(10);
        }
    }
}

    
int handleFadeUp(String cmd){
    
    timeStart = millis(); 
    timerStarted =true;
    return 1;
}
Click to Expand
x
Share this Project

Courses

48-675 Designing for the Internet of Things

· 11 members

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


About

To make the ambient light light up red when there is an event 15 mins out