Skills Dev III: Ambient Orb

Made by Justin Slusher ·

In this project, I’ve created an Ambient Calendar Alert System using an Argon Particle microcontroller and Neopixel LED Strip, which integrates with Google Calendar via IFTTT to provide visual notifications for upcoming events and uses light transitions to indicate approaching meetings, fading to red before an event and returning to white afterward.

Created: November 15th, 2023

0

Project Summary:

The primary objective of my project was to create an ambient alert system that visually notifies upcoming Google Calendar events using an Argon microcontroller and Neopixel LED strip. As such, the system fades the strip to red as a calendar event approaches and back to white after the event begins, with integration through IFTTT for the Google Calendar webhook trigger.

Process:

For this setup, a Neopixel LED strip was connected to an Argon microcontroller connected to the D2 pin. The Particle functions CalEvent enabled triggering via IFTTT linked with Google Calendar. The CalEvent function triggers the fade-to-red sequence 15 minutes prior to an event, and after the event starts, a fade back to white is triggered. I added the turnOff function for testing purposes so that I could end, or close, the previously run function.

Initially, the Neopixel strip was programmed to reach full brightness in both red and white colors. However, I found the brightness level too high, or distracting, so I adjusted the code to test different brightness levels, eventually settling on a 20% brightness setting for both colors. I achieved this by adjusting the RGB values in the fadeToColor function.

Outcome:

My project achieved its goal of providing ambient Google Calendar notifications while utilizing IFTTT to handle communication between Google Calendar and the Argon microcontroller.

*alertDuration was shortened considerably for the video to demonstrate the fade from Red to White compared to the used code which is set to 15 minutes. 

Video, IFTTT Log, Code Below

0
0
// Skill Dev 3
// Ambient Orb Google Cal Notification
#include "neopixel.h"

// Neopixel Config
#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

bool alertActive = false;
unsigned long alertStartTime = 0;
const unsigned long alertDuration = 900000; // 15 minutes

void setup() {
  strip.begin();
  strip.show(); 
  Particle.function("CalEvent", calendarAlert); // IFTTT CalEvent function
  Particle.function("turnOff", turnOff); // For testing purposes
}

void loop() {
  unsigned long currentTime = millis();
  
  if (alertActive) {
    if (currentTime - alertStartTime < alertDuration) {
      // Fade to 20% red over 15 minutes
      fadeToColor(strip.Color(51, 0, 0), currentTime - alertStartTime, alertDuration); // 20% brightness red
    } else if (currentTime - alertStartTime < 2 * alertDuration) {
      // Fade back to 20% white over the next 15 minutes
      fadeToColor(strip.Color(51, 51, 51), currentTime - alertStartTime - alertDuration, alertDuration); // 20% brightness white
    } else {
      alertActive = false;
      setStripColor(strip.Color(51, 51, 51)); // Set to 20% white
    }
  }
  delay(500); // Placing a small delay here
}

int calendarAlert(String param) {
  alertActive = true;
  alertStartTime = millis();
  return 1;
}

int turnOff(String param) {
  alertActive = false; 
  setStripColor(strip.Color(0, 0, 0)); // Turning LED off
  return 1;
}

void fadeToColor(uint32_t color, unsigned long elapsedTime, unsigned long totalDuration) {
  float ratio = (float)elapsedTime / totalDuration;
  uint8_t red = (uint8_t)(ratio * ((color >> 16) & 0xFF));
  uint8_t green = (uint8_t)(ratio * ((color >> 8) & 0xFF));
  uint8_t blue = (uint8_t)(ratio * (color & 0xFF));
  setStripColor(strip.Color(red, green, blue));
}

void setStripColor(uint32_t color) {
  for (int i = 0; i < strip.numPixels(); i++) {
    strip.setPixelColor(i, color);
  }
  strip.show();
}
Click to Expand
0

Next Steps:

One way I'd like to expand on my project is the integration of a temperature or light sensor. In doing so, this could enable the system to change its behavior based on environmental conditions. For example, the color or brightness of the alert could change depending on the room's temperature or light level, making the system even more dynamic.

Reflection:

One challenge was figuring out each step of integration between the microcontroller, Neopixel LED strip, and IFTTT. Furthermore, balancing the brightness levels to create a more relaxing ambient effect that was not incredibly intrusive was also fun to learn and implement --  specifically adjusting the values to find the right balance of color and brightness intensity was enjoyable to test. 

x
Share this Project

This project is only accessible by signed in users. Be considerate and think twice before sharing.


Courses

48-675 Designing for the Internet of Things 24

· 11 members

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


Focused on
About

In this project, I’ve created an Ambient Calendar Alert System using an Argon Particle microcontroller and Neopixel LED Strip, which integrates with Google Calendar via IFTTT to provide visual notifications for upcoming events and uses light transitions to indicate approaching meetings, fading to red before an event and returning to white afterward.