Skills Dev IV: Working with Outputs - Motors and Movement 2022

Made by Nick Possi-Moses · UNLISTED (SHOWN IN POOLS)

I'm creating a countdown alert. Whenever a Google calendar invite is about to start (1 hour away), the countdown will start and measure how many minutes remain before the event starts. Using a servo motor, I'm visualizing time remaining until an event starts.

Created: December 15th, 2022

0

Outcome

    • I created a simple countdown alert visualization to showcase how much time is left before an event starts. Using IFTTT, I created a webhook to grab the next event and alert the program within 1 hour of the start time. Once this event occurred, the program would run and visually show how much time remained until the event started. Upon the completion of the event, the countdown visualization program would reset.

0

Process

I was unfamiliar with motors, so this was an exciting project for me. I researched how they worked and how to represent data with them. I was particularly interested with how a motor could use data to communicate time.

I had to play around a lot with the timing (delay) mechanism to accurately reflect how much time was remaining until the event started. I also had to play around with the IFTTT function to ensure that the right information was being grabbed and sent back to the program.

0

Reflection

This was an interesting project. I wish I had more time to explore it during the course of this mini semester. I really enjoyed how open-ended this project was and how it allowed for more creativity than prior labs - I suppose that's because we are becoming more and more capable students of Arduino/Particle. Initially, I was going to try to create a weather forecast tool and use a neopixel ring to represent different types of weather (sunny, rainy, snowy, etc.), but I struggled to configure the neopixel ring and the servo. I also was curious about how a servo could be used to represent time, so I decided to embark on that project. With this concept in mind, I initially tried to create a clock to represent next meeting time, as per Google Calendar, but I realized that my servo could only go up to 180 degrees, so I rethought how I could use a servo to represent time. I ended up landing on a timer to show countdown for an event. I had to really tinker with the delay function to ensure that my servo was more accurately counting down the time until the event started. I improved my knowledge of IFTTT and webhooks, functions, as well as switches (which I continued to use for this project to turn the counter on and off). I also learned how to use a servo and other motors.

0
//SERVER SETUP
int servoPin = A3; 
int servoPos = 0; 
Servo servo; //sets up servo instance

//SWITCH SETUP
int switchPin = D2; 
int switchState = LOW; 


// Set Countdown Period
bool setCountdown = FALSE; 

void setup() {
    
    // Set switch as input 
    pinMode(switchPin, INPUT_PULLUP); 
    
    //Server setup
    servo.attach(servoPin); 

    servo.write(0); //set to 0 degrees
    
    // Set up cloud particle function (IFTTT)
    Particle.function("eventAlert", handleEventAlert); 
    
}

void loop() {
    
    int switchState = digitalRead(switchPin); 
    
    if (switchState == LOW) {
  
        if (setCountdown == TRUE) {
            
            for (int i = 0; i <180; i++) {
                servo.write(i); 
                delay(333.33);
            }
        }
    }
}


// Define IFTTT Calendar Function Value
int handleEventAlert ( String cmd) {
    
    if(cmd == "TRUE") {
        setCountdown = TRUE; 

        return 1; 
    }

    return -1; 
}
Click to Expand
0
Lab 4
Nicholas Possi-Moses - https://youtu.be/vJZ4NqhqRws
x
Share this Project

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


Courses

About

I'm creating a countdown alert. Whenever a Google calendar invite is about to start (1 hour away), the countdown will start and measure how many minutes remain before the event starts.

Using a servo motor, I'm visualizing time remaining until an event starts.