NBA Game Alerter

About: I'm busy building machines.

Intro: NBA Game Alerter

Hello World! In this instructable, we will be connecting IFTTT services to our ESP8266 via Blynk to do some very useful things. IFTTT (IF This Then That) as the name suggests, triggers an event B based on the occurrence of event A. Using IFTTT you can, for example, turn on your porch lights when the pizza's on the way (only works with Domino's) or tweet your Instagrams as native Twitter photos. IFTTT can help us make our world more connected and the best part about IFTTT is that you can create your own Applets! This means you can connect seemingly unrelated events together using IFTTT.

It's the NBA season now and since I am not living in the US, it's hard for me to keep track of match timings. Thankfully, IFTTT provides a service together with ESPN that can trigger an event when your favourite team's game is about to start. Using that trigger you can, for example, turn on your Philips Hue Lights or sound a buzzer but since I don't have any of those with me right now, I decided to turn on the built-in LED of the ESP8266 dev board. Let's get started.

Step 1: Creating a New IFTTT Applet

To create a new applet, head over to IFTTT and sign in/sign up. Then click on your profile name on the top right-hand corner of the webpage. Click on the New Applet button and it will take you to the New Applet page. There you will see a banner containing the phrase if +this then that. To create the main trigger, click on the +this button.

Step 2: Choosing and Configuring the Appropriate Service

IFTTT offers a lot of services that can act as triggers thanks to its partnerships with companies. As stated earlier, we will be focusing on the services provided by ESPN that triggers when our favourite NBA team starts their game. Search for ESPN on the search bar and then connect it to the IFTTT applet. Once connected, you will see a variety of events that can act as triggers, we are interested in the New Game Start trigger, so click on that. I am going with Golden State Warriors, you can choose any team you like. Once you have chosen your team, hit Create Trigger and your trigger is good to go.

Step 3: Setting Up Webhooks (Part 1)

Now that our This is ready, let's go ahead and configure an appropriate response by clicking on the +that button. Once in, search for Webhooks and click on the Webhooks action service. We only have one action in our Webhooks action service so go ahead and click on that. You will now have a form that you have to fill in. The first part will ask you for a URL to push or request data to/from. The URL in our case would be the Blynk API endpoint. Let's go ahead and get our API endpoint URL.

Step 4: Setting Up a Blynk Project

Download and install the Blynk App for your iOS or Android device if you have not done so and create a new project by clicking the New Project button in the app. Type in the name for your project and choose ESP8266 from the list of devices under Choose Device. Hit create and an Auth Token would be sent to your email (the email you signed up with). Copy the Auth Token and save it into a text file (recommended) in your working directory.

Step 5: Setting Up Webhooks (Part 2)

Now open terminal/command prompt and issue the following command,

ping blynk-cloud.com

Copy the IP address that replies to your ping and paste it into the same text file where you saved your Auth Token. Now open the IFTTT Webhooks page that we visited earlier on, frame and paste the URL in the following format,

http://{IP_ADDRESS_YOU_COPIED}/{AUTH_TOKEN}/update/d2?value=0

The Request Type should be GET and the Content Type and Body should be left blank. Now hit the Create action buttonand you should be done setting up the response.

Step 6: Final Touches to the Applet

Now review your changes and hit the Finish button. Make sure your Applet is turned on and hit the Check now button to ensure your Applet starts running.

Step 7: Uploading the Code

Open the Arduino IDE and head over to the library manager. Search and install the Blynk library. Now Type in the following code and upload it to your ESP8266 board.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// Auth token
char auth[] = "BLYNK_AUTH_TOKEN";

// WiFi
char ssid[] = "YOUR_SSID";
char pass[] = "YOUR_WIFI_PASSWORD";

void setup()
{
  // Debug console
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Once your favourite team's game begins, the built-in LED of your ESP8266 will light up! Never miss a game with this!

Share

    Recommendations

    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    Discussions