Creating an Ambient Notification for Google Calendar Events

Made by Bennett Goeke

This exercise aims to create an ambient calendar alert using a neopixel strip. Within the project, I connected my Particle device to my Google Calendar through IFTTT. This will send an alert to my particle argon device a few minutes before any appointment.

Created: December 2nd, 2023

0

Outcome

The goal of this project was to create an ambient calendar alert that would notify me of a calendar event 15 minutes before the event started. The light used to create the ambient notification was a neopixel light strip which starts off as a cool white color that slowly fades to red as the event time gets closer. Using IFTTT I was able to connect my google calendar events to make a webhook which would then call a function to my particle argon device. Before creating the code for the calendar alert I did other practice exercises like making the neopixel strip light up pixel by pixel and reversing the sequence, as well as modifying the code to light up blue, red, green, then white in sequence. As you can see in the video below I shortened the time for the transition to show the whole alert transition without making a 30 min long video. As you can see in the code though the fadeDuration was actually 15 minutes long for each fade. 

0

Process

Working on a couple practice exercises with the neopixels really helped me start to understand the different ways I could control the light strip and how to start to fade from color to color. I had a lot of debugging and working through the code part by part. Following the instructions I just went step by step, figuring out how to first get a fade from white to red and then back to white. I had some difficulties getting the fade to work the same way each time the cloud function was called. I found a good hack for this by storing a value for "fadingToRed" which would then need to be reversed after the first fade and second fade so it would always fade the right direction when the function was called.

0

Next Steps

Some things that I would've liked to get to was creating a button to stopping the ambient alert after you've been notified of an upcoming event. I also think it would be interesting to create a housing for the light so I could hang it up and really allow it to fall into the background and very casually notify me of events. I wanted to be able to put the light behind my desk monitor so that I could get a nice ambient light behind my bright display and the brightness of the neopixels wasn't so in my face. In this way I think it could become more of an established piece of calm technology that doesn't force my attention.

0
Ambient Calendar Alert
Bennett Goeke - https://www.youtube.com/watch?v=V-5qRl1SgfE
0
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

#define PIXEL_PIN D3
#define PIXEL_COUNT 8
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

int fadeDuration = 1000 * 60 * 15;
long timeStart = -1;
bool timerStarted = false;
bool fadingToRed = true;  // Added flag to track the direction of the fade

void setup() {
    strip.begin();

    // Set the initial state to white
    for (int i = 0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, 255, 255, 255);
    }

    strip.show();

    Particle.function("calEvent", calEvent);
}

void loop() {
    if (timerStarted == true) {
        long timeNow = millis();
        long timeElapsed = timeNow - timeStart;

        if (timeElapsed < fadeDuration) {
            int colorValue = map(timeElapsed, 0, fadeDuration, 0, 255);

            int r, g, b;

            if (fadingToRed) {
                // Fade from white to red
                r = 255;
                g = 255 - colorValue;
                b = 255 - colorValue;
            } else {
                // Fade from red to white
                r = 255;
                g = 0 + colorValue;
                b = 0 + colorValue;
            }

            for (int i = 0; i < strip.numPixels(); i++) {
                strip.setPixelColor(i, r, g, b);
            }
            strip.show();

        } else {
            if (fadingToRed) {
                // Toggle the direction of the fade
                fadingToRed = !fadingToRed;

                // Reset the timer and flag
                timeStart = millis();
            } else {
                // Set the light bar to white and stop the timer
                for (int i = 0; i < strip.numPixels(); i++) {
                    strip.setPixelColor(i, 255, 255, 255);
                }
                strip.show();
                timerStarted = false;
                fadingToRed = !fadingToRed;     //allows function to be called multiple times and still have the same fade each calendar event
            }
        }
    }

}

int calEvent(String cmd) {
    timeStart = millis();
    timerStarted = true;
    return 1;
}
Click to Expand
0

Reflection

Through this project my coding skills really expanded and I was given the chance to really start to understand for() loops better. I think in the future I would try to do better in writing the code piece by piece as I got a little caught up at the beginning as I tried to write most of light transitions right away. After getting caught up I went back to some of the flipped classroom videos to better start from the basic functions and then work my way up to the more complex actions I wanted for the end result.

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

This exercise aims to create an ambient calendar alert using a neopixel strip. Within the project, I connected my Particle device to my Google Calendar through IFTTT. This will send an alert to my particle argon device a few minutes before any appointment.