Skills Dev III

Made by bmkaufma · UNLISTED (SHOWN IN POOLS)

Create a device that indicates when there is an upcoming meeting on your google calendar by fading neopixel strip from white to red.

Created: December 2nd, 2022

0

Outcome

    The outcome of this lab was a successful circuit and code that operated as intended. The circuit is very simple and only consists of the Particle Argon board and a Neopixel strip. The purpose of this device is to provide a calendar alert that fades the Neopixel from white to red 15 minutes before every calendar event in a google calendar, and then fade back to white once the event is ending.

0

Process

The first step in creating this device was to assemble the circuit. This was very straightforward and only involved placing the Argon on the breadboard and connecting the Neopixel strip to pin D2. The next step was to create the code that would control the Neopixel fading. In order to not tie up the board processor for 15 minutes, the millis() command was used to check for the passage of time and incrementally fade the Neopixel. A meetingStart function was created to handle incoming requests from the particle cloud. When called, this function starts the fading of the Neopixel. The next step was to handle the google calendar integration. This was performed by using IFTTT, which can integrate google calendar natively. IFTTT was configured to execute a webhook that calls the meetingStart particle function when there is a meeting on my calendar in 15 minutes. This required inputting the particle cloud URL and authorization key for my particle account.

0

Reflection

This was a really cool lab. It challenged my understanding of how timing works in digital devices. I never knew how difficult it could be to handle multiple things simultaneously or how thoughtful you have to be when designing your code. I also found the IFTTT integration to be really useful. There are so many things that can be accomplished, and once you figure out the integration mechanism with particle cloud the first time, it really opens up opportunities for connected devices. It was a little challenging at first to figure out what exactly needed to be done to configure IFTTT and particle, but now that I know how to do it I feel confident that I can use this integration in the future.

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

#define PIXEL_PIN D2
#define PIXEL_COUNT 8
#define PIXEL_TYPE WS2812

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

bool meetingStatus = false;
bool orbState = false;
uint32_t color;
int green = 255;
int blue = 255;
uint32_t white = strip.Color(255, 255, 255); 
uint32_t red = strip.Color(255, 0, 0); 

unsigned long startTime = 0;
unsigned long fadeDuration = 15 * 60 * 1000;

void setup() {
    
    for( int i=0; i< strip.numPixels(); i++) {
        strip.setPixelColor(i, white);
    }

  strip.begin();
  strip.show();
  
  Particle.function("meetingStart", meetingStart);
}


void loop() {

  if (meetingStatus == true) {
      
    unsigned long now = millis();
    
    while (now - startTime <= fadeDuration){
        now = millis();
        green -= (255/60);
        blue -= (255/60);
        color = strip.Color(255, green, blue);
        for( int i=0; i< strip.numPixels(); i++) {
            strip.setPixelColor(i, color);
        }
        strip.show();
        delay(1000);
    }
    orbState = true;

  }else if (meetingStatus == false && orbState == true){
    green = 0;
    blue = 0;
    
    unsigned long now = millis();
    
    while (now - startTime <= fadeDuration){
        now = millis();
        green += (255/60);
        blue += (255/60);
        color = strip.Color(255, green, blue);
        for( int i=0; i< strip.numPixels(); i++) {
            strip.setPixelColor(i, color);
        }
        strip.show();
        delay(1000);
    }
    orbState = false;
  }
}

int meetingStart(String command){
    
    startTime = millis();
    if (command == "true"){
        meetingStatus = true;
    } else if (command == "false") {
        meetingStatus = false;
    }
    return 0;
}
Click to Expand
0
x
Share this Project

This project is only listed in this pool. Be considerate and think twice before sharing.


Courses

About

Create a device that indicates when there is an upcoming meeting on your google calendar by fading neopixel strip from white to red.