Skills Dev III: Ambient Orb - Ponn

Made by Ponn Thanasathit

A light that reminds you about your upcoming meeting. It will start to emit light 15 mins before the meeting, then slowly turn to red at 5 mins mark before the meeting and glow more intensely until the meeting time, then it will slowly fade.

Created: November 17th, 2022

0

Outcome

    • This should provide at least one clear illustration of the final outcome (photo or video as appropriate).
  • It should ideally have several supporting images as well as a video demonstrating the working prototype, circuit diagrams, etc.)
  • Add completed code and any supporting documentation and file (and/or a completed zip folder containing all of your source code)
    • a clear overhead (or top-down) photo of your completed circuit
  • Link to a video: https://drive.google.com/file/d/14816mbD2yQGNZXmJ6QoHQagASCZl2dds/view?usp=sharing

0

Process

Outline your approach to the project? What ideas did you generate and how did you refine or reject them? What did you research and explore? what were the design choices? What challenges were encountered and how did you resolve them?


I made sure to create the light sequence first and then connected it to the IFTTT function. However because my function was too long, IFTTT could not complete and response back in time. As a result it showed error response, even if my device worked properly.

0

Reflection

Reflect on the process of making this project. What did you learn? What would you do differently?


I spent too much time debugging why IFTTT stated that it failed to send a command to the Particle Argon, I should have leveraged my classmates more to solve this issue.

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

// 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);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  Particle.function("alarm_15", alarm_15);  
  uint32_t w = strip.Color(10, 10, 10); // White
  for( int i = 0; i < strip.numPixels(); i++ ){
  strip.setPixelColor(i, w); 
  }
 strip.show(); 
}

void loop() {}


  
int alarm_15(String command)
{
//   int R = R1.toInt();
  int W = 0;
  int n = 0;
  int m = 0;
//   unsigned long now = 0;
//   Particle.publish( "new-event", String(now) );
   unsigned long stamp = millis();
   for(unsigned long now = 0; now <= 99999999999999999999;)
    {
        now = millis();
        if (now - stamp  <= 60000)
            {
            uint32_t w = strip.Color(W, W, W); // Red
            for( int i = 0; i < strip.numPixels(); i++ )
                {
                strip.setPixelColor(i, w); // set a color
                }
           strip.show();
           W = W + 255/60;
           delay(1000);

            } else if (now - stamp <= 90000)
                {
                    uint32_t r = strip.Color(255, 255 - n,255 - n);
                    // uint32_t w = strip.Color(W,W-n,W-n);
                    for( int i = 0; i < strip.numPixels(); i++ )
                        {
                        strip.setPixelColor(i, r); 
                        }    
                    strip.show();
                    n = n + 255/30;
                    delay(1000);
                }
                     else if (now - stamp <= 120000)
                                {
                                    uint32_t o = strip.Color(255 - m, 0,0);
                                    // uint32_t w = strip.Color(W,W-n,W-n);
                                    for( int i = 0; i < strip.numPixels(); i++ )
                                        {
                                        strip.setPixelColor(i, o); 
                                        }    
                                    strip.show();
                                    m = m + 255/30;
                                    delay(1000);
                                }
                                    else 
                                                {
                                                    uint32_t o = strip.Color(0, 0,0);
                                                    // uint32_t w = strip.Color(W,W-n,W-n);
                                                    for( int i = 0; i < strip.numPixels(); i++ )
                                                        {
                                                        strip.setPixelColor(i, o); 
                                                        }    
                                                    strip.show();
                                                    return now - stamp;
                                                }
    // return now - stamp;
    }
  return millis();
}
Click to Expand
x
Share this Project

Courses

About

A light that reminds you about your upcoming meeting. It will start to emit light 15 mins before the meeting, then slowly turn to red at 5 mins mark before the meeting and glow more intensely until the meeting time, then it will slowly fade.