Skills Dev III: Ambient Orb

Made by youngjol

Created: December 3rd, 2021

0

Project: Ambient Orb

Objective: create an ambient calendar alert that starts to light up red fifteen minutes before a Google Calendar event and changes to a white light during fifteen minutes after the event starts.

0

Process:

I began by creating a Particle app on the Web IDE. I wrote a function that gradually lights up to red for fifteen minutes and then gradually changes the color to white for the next fifteen minutes. 

A challenge was to figure out how to gradually increase the intensity of the light. Given a specified duration, I calculated how much time should be delayed in between each increase in pixel intensity and looped through the intensity until I hit the maximum intensity specified. This seemed to work well. 

To connect this function to IFTTT, I first used "Particle.function" to publish the function to the Particle Cloud. 

Finally, I integrated Google Calendar with Particle by creating an 'applet' on IFTTT.com

0
#include <neopixel.h>

#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
int minutes = 15;
int max_intensity = 50;
int red_intensity = 0;


void setup() {

    strip.begin(); //Initialize neopixel
    strip.show(); //Initialize all pixels to 'off'
    
    Particle.function("Meeting", meetingOrb);
    Particle.variable("Red Intensity", red_intensity);

}

void loop() {

}

int meetingOrb(String input)
{
    int ms_max = minutes*60*1000;
    // unsigned long now = millis();
    
    uint32_t c = strip.Color(red_intensity, 0, 0);
    
    uint16_t i;
    uint16_t j;

    
    int delay_time = map(1, 0, max_intensity, 0, ms_max);
    
    for(i=0; i <= max_intensity; i++){
        c = strip.Color(i,0,0);
        for(j=0; j<strip.numPixels(); j++){
            strip.setPixelColor(j,c);
        }
        strip.show();
        delay(delay_time);
    }
    
    for(i=0; i <= max_intensity; i++){
        c = strip.Color(max_intensity,i,i);
        for(j=0; j<strip.numPixels(); j++){
            strip.setPixelColor(j,c);
        }
        strip.show();
        delay(delay_time);
    }
    
    
    return 1;
}
Click to Expand
0

Figure 1. Wiring of neopixel ring onto Argon

0

Figure 2. Lit up neopixel ring

0

Video 1. Light up to red phase

0
dev3 part1
Youngjoo Lee - https://youtu.be/cL3WOeuHecA
0

Video 2. Change from red to white phase

0
dev3 part2
Youngjoo Lee - https://youtu.be/SkdU4zjXYeE
0

Figure 3. IFTTT Applet Interface

x