Introduction: A Goldberg Machine Turning a Netflix Episode On

In this instructable, we will present a Goldberg Machine that plays a Netflix episode in the following way:

Supplies

To create this project you will need:

  1. 2 CPXs (Circuit Playground Express) which are connected to a ESP8266 chip (which enables the CPX to connect to the internet).
  2. Micro-USB cable
  3. Batteries
  4. The Blynk app installed on your phone
  5. The 2 attached sketches

Step 1: Preparations

  • Create an account on Integeomat.
  • Create 2 accounts on Blynk (one for each CPX).
  • On Google Drive create a new google sheets document (Column A will be dates and column B will be the values 0 or 1).

Step 2: Integromat - First Scenario

In Integromat, create a new scenario, according to the picture above.

  1. Start with a webhook activation (which will come from Blynk and will be explained later).
  2. The webhook will trigger a creation of a new line in the Google sheets document with the activation date + the value 1. In order not to overwrite an existing row (in row 2), we will copy it to a new row, and then update row 2 to be the new date + the value 1.
  3. Eventually we will create an HTTP request to run the following scenario (using a webhook).

Step 3: Integromat - Second Scenario

In Integromat, create a new scenario, according to the picture above:

  1. Start with a webhook activation (which will come from the previous scenario).
  2. The webhook will trigger checking the value in cell B2 - if the cell has the value '1', we want to play the episode (otherwise, it has the value '0', so this row is irrelevant and the scenario ends).
  3. Use an HTTP request to turn on virtual pin 2 of CPX2, using the following call:
     https://blynk.cloud/external/api/update?token=<YOUR_TOKEN>&V2=1
    (The "virtual pin" and the "token" will be explained later).
    Turning on the virtual pin causes the mouse to be clicked on the computer that CPX2 is connected to, which will play the episode on Netflix.
  4. Update cell B2 to be 0, to indicate it was used.

Step 4: Blynk Settings

In each Blynk account do the following:

1. Create new template: Click on Templates on the left. --> New Template --> Write the following settings in the window that opens --> Done.

Click on the created template, then click Datastreams --> Edit --> New Datastream

2. Create Virtual pin datastream:

  • On CPX1's Blynk, Create one virtual pin as follows:

  • On CPX2's Blynk, Create two virtual pins (one to receive the sound and the other to click on Netflix), as follows:

3. Create new device: Go to Search-->New Device--> Choose From Template:

4. Add Widgets: Click on the 3 dots on the top right and then click on edit dashboard:

  • On CPX1's Blynk: Select a switch widget, click edit and select the datastream you created for CPX1.
  • On CPX2's Blynk: Select 2 switch widgets, click edit and select the 2 datastreams you created for CPX2.

Step 5: Create Webhook (for CPX2)

On CPX2's Blynk, go to Settings --> Developers Webhooks --> Create New Webhook

The webhook URL should be the URL of the webhook in the first scenario you created in Integromat.

Step 6: Sketchs Update

Before running the code for the first time go to Blynk, click on the magnifying glass, select your device and then device info.

Paste the three lines that appear in black instead of those written in the code. This link must be made between each CPX and it's corresponding Blynk account.

Copy the value of BLYNK_AUTH_TOKEN to the URL mentioned in step 3.

In addition, the internet settings (name and password) must be changed to the internet the CPX should connect to.

Step 7: Hit Play!

In order to set the project in motion:

  1. Set both Integromat scenarios on.
  2. Connect both CPXs to the computer (using the USB cable) and upload the corresponding sketch to each.
  3. Disconnect only CPX1 from the computer and connect it to the batteries.
  4. After everything is loaded and ready to go, turn "NetflixStarter" on in your Blynk app connected to CPX1's account).
  5. Enjoy the episode you chose!