Skills Dev IV: Working with Outputs

Made by Alp Erbug

Turn on the fan when a new song is added to a shared playlist on Spotify

Created: December 14th, 2022

0

Outcome

I was able to create a circuit composed of a Particle Argon, a fan, a diode, and a transistor that is connected to a shared playlist I have with a friend through IFTTT. When a new song is added to the playlist, the fan turns on and alerts the user (me).

0

Process

This circuit was more complex compared to the previous circuits we created in class. The transistor, the diode, the fan, and the required external power supply were all new elements. I first constructed the circuit, connected my fan, and tested functionality. Once this was successful, I added the Particle function. I then created an IFTTT applet, and integrated my Spotify account with it, indicated the playlist, and created the webhook trigger. The webhook was configured to trigger the fan when a new song was added to the shared playlist.   

0

Reflection

This project had a great outcome. I use Spotify daily, and have multiple shared playlists with friends; therefore, getting notifications when a new song I might be interested in was added to my playlist was beneficial. The different output elements we considered in this lab function similarly, that's why I think that my capabilities increased tremendously. I also became very familiar with Particle integrations, IFTTT, and webhooks, which were all very helpful in the final group project. 

0
int fanPin = D3;

bool shouldActivate = false;

void setup() {
    
  Particle.function( "activate", activateFan );
  pinMode(fanPin, OUTPUT);
}

void loop() {
    
  if( shouldActivate ) {
    doFan(  );
    shouldActivate = false;

  }
  delay( 100 );
}

void doFan() {
  
  for( int i = 0; i < 5; i++ ) {
      
    digitalWrite(fanPin, HIGH);
    delay( 300 ) ;
    digitalWrite(fanPin, LOW);
    delay( 100 );
  }
}

int activateFan( String command ) {
  
  shouldActivate = true;
  return 1;
}
Click to Expand
0
Events and Networking
Alp Erbug - DIoT - https://youtube.com/shorts/SJAnvab5y6U?feature=share
x
Share this Project

Courses

About

Turn on the fan when a new song is added to a shared playlist on Spotify