Skills Dev III Ambient Orb

Made by Nik Kim

Ambient glowing Neopixel lights and IFTTT

Created: November 22nd, 2023

0

Product

Ambident Neopixel schedule notifier connected to Google Calendar using IFTTT service.

0

Outcome



0
0

Process

1. Wiring up the circuit.

2. Code ambient adjustment function of Neopixel lights.

3. Hook up with the Google Calendar and bring information using IFTTT service.

0

Reflection

Wiring process was fairly simple. However, realizing ambient effect through code was tricky. Through this project, I could become more familiar with coding in the Particle platform and using physical computing languages. Also, using the Particle function and Serial Monitor made the process more responsive.

Image of console monitor. I like the pattern it generates.


Call result from the IFTTT.


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

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D3
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812

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

uint32_t c;

int fadeDur = 1000 * 60 * 20;
long timeStartedAt = -1;
bool eventStart = false;

void setup() {
    Serial.begin(9600);
    Particle.function("lightUp", lightUp);
    Particle.function("denotice", denotice);
    strip.begin();
    strip.show();
}

void loop() {
    // original state
    if (eventStart == false) {
        for (int i = 0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, 0, 0, 0);
        }
        strip.show();
        delay(1000);
    }
    
    // when fadeOutTimerStarted is true
    if (eventStart == true) {
        long timeNow = millis();
        long timeLap = timeNow - timeStartedAt;
        int colorVal;
        if (timeLap <= fadeDur / 4) {
            colorVal =  map(timeLap, 0, fadeDur / 4, 0, 100);
            display(0, colorVal, 0);
        } else if (timeLap > fadeDur / 4 && timeLap < 3 * fadeDur / 4) {
            colorVal =  map(timeLap, fadeDur / 4, 3 * fadeDur / 4, 1, 100);
            display(colorVal, 0, 0);
        } else if (timeLap >= 3 * fadeDur / 4 && timeLap <= fadeDur) {
            colorVal =  map(timeLap, 3 * fadeDur / 4, fadeDur, 100, 0);
            display(colorVal, 0, 0);
        } else {
            eventStart = false;
        }
    }
} 

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

int lightUp(String cmd) {
    timeStartedAt = millis();
    eventStart = true;
    return 1;
}

int denotice(String cmd) {
    eventStart = false;
    return 1;
}
Click to Expand
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

Ambient glowing Neopixel lights and IFTTT