Skills Dev III: Ambient Orb

Made by Alp Erbug

The goal of this project was to create an ambient calendar alert using Neopixels. The Particle Argon was connected to my Google Calendar, and was programmed to change the color displayed on the Neopixel 15 minutes before any meeting on the calendar.

Created: December 13th, 2022

0

Outcome

The outcome of this project includes an ambient calendar alert using Particle Argon, Neopixels, and IFTTT. The Particle Argon in connected to Google Calendar through IFTTT. The Neopixels display bright white color by default, and change to red 15 minutes prior to the start of an event saved on the calendar.

0

Process

I started my process by soldering the 3 required wires to the Neopixel strip. I then connected my Neopixels to my circuit, and made sure they were working by testing a few sample lines of code. I created particle functions for the 3 main colors to be able to test my Neopixels and my functions throughout the design and coding process even though this was not a requirement. I also created variables at the beginning of my code to reference them easily.   

0

Reflection

Wiring and setting up the circuit was not challenging for this project as the Neopixels only needed 3 connections. I simply needed to solder the 3 wires to Neopixels before starting the project. Setting up IFTTT was not complicated, but was hard to verify due to the lag on the platform. There was usually a 10 to 15 minutes delay for the Neopixels to get the input from IFTTT, but after testing the calendar alert a few times, I was able to establish that my code, circuit, and IFTTT integration were working correctly. Learning how to use the libraries and leveraging proven functional code were also very useful for the future class and personal projects. 

0
Ambient Orb
Alp Erbug - DIoT - https://youtube.com/shorts/4Ga-H62m5EQ
0
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

//Set pixel COUNT, PIN, and TYPE 
#define PIXEL_COUNT 8
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812

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

int red = 25;          
int green = 25;        
int blue = 25;         

int durationOfFade = 1000 * 60 * 15;        //15 minutes 
bool calendarAlert = false;                 //checkpoint for calendar alert
unsigned long lastUpdate;                   
unsigned long now = 0;                      

uint16_t i;
uint32_t cRed = strip.Color(25, 0, 0);
uint32_t cGreen = strip.Color(0, 25, 0);
uint32_t cBlue = strip.Color(0, 0, 25);
uint32_t cWhite = strip.Color(25, 25, 25);

void setup() { 

  strip.begin();
  strip.show(); 
  
  Particle.function("blue", blueControl);
  Particle.function("red", redControl);
  Particle.function("green", greenControl);
  
  Particle.function("meetingAlert", meetingAlert);
    
    for (i=0; i<strip.numPixels(); i++) {
        strip.setPixelColor(i,cWhite);
        strip.show();
    }
}

void loop() {
    
    if (calendarAlert == true) {
        now = millis();
        long timeElapsed = now - lastUpdate;
        
        if (timeElapsed <= durationOfFade) {
            
            int colorValue = map(timeElapsed, 0, durationOfFade, 0, 255);
            
            int r = colorValue;
            int g = 0;
            int b = 0;
            
            for (i=0; i<strip.numPixels(); i++){
                strip.setPixelColor(i,r,g,b);
            }
            strip.show();
        }
        else {
            calendarAlert = false; 
            Particle.publish("MeetingStarted-FadingToWhite");    
        }
    }
    else {
        now = millis();
        long timeElapsed = now - lastUpdate;
        
        if ((timeElapsed >= durationOfFade) && (timeElapsed <= 2*durationOfFade)) {
            
            int colorValue = map(timeElapsed, 0, 2*durationOfFade, 0, 255);
            
            int r = colorValue;
            int g = colorValue;
            int b = colorValue;
            
            if (r>25) {
                for (i=0; i<strip.numPixels(); i++) {
                   strip.setPixelColor(i,(255-r),g,b);
                }
                strip.show();
            }
        }
    }
}

//IFTTT function
int meetingAlert(String command) {
    
    if(command == "True") {
        calendarAlert = true;
        lastUpdate = millis();
        Particle.publish("MeetingStarting-FadingToRed");      
        return 1;
    }
    return -1;
}

int blueControl(String command) {

    for(i=0; i< strip.numPixels(); i++) {
    strip.setPixelColor(i, cBlue);
		strip.show();
		delay( 0 );
    }
  return 1;
}

int redControl(String command) {
    
    for(i=0; i< strip.numPixels(); i++) {
    strip.setPixelColor(i, cRed);
		strip.show();
		delay( 0 );
    }
  return 1;
}

int greenControl(String command) {
    
    for(i=0; i< strip.numPixels(); i++) {
    strip.setPixelColor(i, cGreen);
		strip.show();
		delay( 0 );
    }
  return 1;
}
Click to Expand
x
Share this Project

Courses

About

The goal of this project was to create an ambient calendar alert using Neopixels. The Particle Argon was connected to my Google Calendar, and was programmed to change the color displayed on the Neopixel 15 minutes before any meeting on the calendar.