Morning Music

by mewong in Circuits > Arduino

89 Views, 0 Favorites, 0 Comments

Morning Music

unnamed.jpg
unnamed.jpg

I really enjoy listening to music as I get ready, so to automate this process my project opens my Spotify app when I turn on my light. Depending on the time of day, my phone is set to a certain volume and a specific playlist of mine is opened. For example, if it is 6:00 am, my volume will be set to a quieter volume and my Soul Mix playlist will open.

Supplies

  • Cardboard
  • Hot glue gun and sticks
  • Argon microcontroller
  • Breadboard
  • Tilt switch
  • 8 Wires
  • IPhone
  • Shorcuts App
  • Spotify App
  • Light Switch
  • LED light
  • Resistor
  • Portable Charger
  • Clay
  • Bobby Pin

Set Up Breadboard

unnamed.jpg

Connect the tilt switch, microcontroller, and LED to the breadboard. The LED is utilized as a tester for the code.

Create Webhooks Integration & Event

WebhookIntegration.png
  • Create an IFTTT account
  • https://maker.ifttt.com/use/nqvLGYdsb-2sTix3ihyiVXCyN225SxLBap_J-yQ33L1 use this documentation in order to create a Webhooks integration with IFTTT
  • Go to your Particle console and create an event with the Webhook

Get Ready to Program

program1.png
  • Define the output for the LED light
  • Define the switch port for the tilt switch
  • Create a bool to keep track of whether or not the webhook has been triggered
  • in the loop, if the webhook hasn't been run and the tilt switch is not activated, the LED should turn on and the webhook should be triggered
  • Else, the LED should be off and the webhook should not have been triggered.

Set Up Applet

0.png
  • Open the IFTTT app
  • Program it so that if the webhook is triggered and a request is received from the phone, an email or some other notification pops up on your phone

Use the Shortcuts App to Create a Shortcut and Automation

IMG_4651.PNG
IMG_4650.PNG
IMG_4649 (1).PNG
  • Use the shortcuts app on your phone
  • Create various conditionals that are time based
  • Depending on the time of day, input the volume you would like your phone to be set at and open a specific URL that opens a playlist on Spotify or another music app.


Set Up Automation on Shortcuts App

0.png

Here is where the applet and the shortcut work together!

Still in the shortcuts app:

  • Go to the automations
  • Press run immediately
  • The "when" should be when you receive an email from yourself regarding your webhook to be triggered
  • The "do" is the shortcut that you just made

Make a Stand for the Microcontroller

unnamed.jpg
  • Fold a small piece of carboard in half. The size of the cardboard should be more than twice the size of the microcontroller.
  • Hot glue another piece of cardboard in between the folded piece. This will act as vertical and horizontal support.
  • Add additional supports if not sturdy
  • Place command strips on the back of the piece of cardboard so that it can later be on the wall.

Set Up Shelf on the Wall and the Tilt Switch to the Light Switch

unnamed.jpg
unnamed.jpg
  • Attach the command strips to the wall below the light switch and attach the carboard shelf.
  • Place the breadboard on the shelf, and the portable charger if needed
  • Utilize clay and a bobby pin or some other stick-like object to prop the tilt switch up.
  • When the light switch is off, the tilt switch should be on. This means that the bobby pin is not propping the tilt switch on at this time.
  • When the light switch is turned on, the tilt switch is off. This is due to the bobby pin pushing the tilt switch up as the light turns on. The bobby pin is on an angle when the light switch is on, causing the tilt switch to be horizontal.

Now Turn Your Light Switch on and Watch Your App Open