Adafruit Playground Express Rob Goldberg Machine

by sonegoh in Circuits > Arduino

88 Views, 0 Favorites, 0 Comments

Adafruit Playground Express Rob Goldberg Machine

2023-02-01 20_47_33-Window.png

We wanted to create our own version of Rob Goldberg machine.

This machine will create a sequence of operations that the main idea behind them is simply to make sure that if one of our friends will fall a sleep while studying we will wake him up in Rob Goldberg fashion.

Supplies

2023-02-01 20_53_58-Window.png
2023-02-01 21_22_25-קורס עצמים אינטרקטיביים.png
2023-02-02 23_23_19-ac – חיפוש Google.png
2023-02-02 23_22_01-small rope – חיפוש Google.png
2023-02-02 23_22_32-glass of water – חיפוש Google.png
2023-02-02 23_24_28-tv – חיפוש Google.png
  • A - Adafruit playground express X 3 - Here
  • B - Micro USB cable X 1 - Can be found in your local convenience store
  • C - 3 X AAA batteries X 9 - Can be found in your local convenience store
  • D - 3 X AAA battery holder X 3 - Here
  • ESP 8266 Wifi board for the arduino X 3 - Here
  • Soldering iron kit X 3 - Here
  • Small rope X 1
  • Glass of water X 1
  • AC X 1
  • TV X 1
  • Fridge X 1

Project Video

The Arduino Alarm clock

The video of the project

Solder the ESP8266 Board to Your Arduino

2023-02-01 21_24_39-קורס עצמים אינטרקטיביים.png

First you will have to solder the ESP8266 board to your arduino.

To do so, use the electrical wires that comes with the kit of the solder, and solder the Arduino to the ESP8266.

As the picture shows, you need to connect the GRN on the Arduino to the GRN place on the ESP8266.

Do the same for all the wiring instructions in this photo.

The Code

This GitHub repository contains 3 files, each one of these files is a C++ code file that can be compiled and uploaded to your Arduino (Adafruit playground express).

You can use your preffered IDE to edit and upload the code to your Arduino.

In our project we worked with Arduino IDE that can be found Here

Reading and Sending IR Signals Using Adafruit Playground Express

Picture1.png
Picture2.jpg
Picture3.png

1.First, in order to discover and decode the specific protocols and code of our devices (TV and AC), we have used the Infrared_Read.ino Example sketch for IRLib2 and Circuit Playground Express.

As you can see, while running this program and pressing the buttons on our remote controller , we can see the data that is printed on the serial monitor (picture 2)

2.Define the Values: (check picture 3)

3.In order to use the IR signals of our devices (TV and AC) as follows:

CircuitPlayground.irSend.send(MY_PROTOCOL,MY_TV_POWER,MY_BITS);

Setup Blynk

2023-02-01 21_43_53-Blynk.Console.png
2023-02-01 21_45_36-Blynk.Console.png
2023-02-01 21_45_53-Blynk.Console.png
2023-02-01 21_46_07-Blynk.Console.png
2023-02-01 21_46_18-Blynk.Console.png
2023-02-01 21_46_33-Blynk.Console.png
2023-02-01 21_46_50-Blynk.Console.png
2023-02-02 23_40_34-Blynk.Console.png
WhatsApp Image 2023-02-08 at 8.47.57 PM.jpeg

This project is using the power of these two application -

1.Blynk

2.Integromat

First create a user for Blynk, just go to their websites and follow the create new account instructions.

The Blynk side -

  1. Create a template for your application - you will use it to create your Blynk application.
  2. Follow the attached photos and configure the pins as shown.
  3. Your Blynk app should have a token that we will use later, you can find it on the main page of your application, save if for later, we will need it.
  4. Create a dashboard with the relevant pins as shown in the dashboard picture.
  5. To create the webhook go to Blynk settings, and open the Webhooks section from the side menu.
  6. add a new Webhook with the configuration from the last image.

Setup Integromat

WhatsApp Image 2023-02-01 at 23.09.18.jpg

The Integromat side -

1. Create an account in Integromat

2. Go to the scenarios page, and create a new scenario.

3. Attach to the scenario a WebHook action

4. copy the new webhook URL, and open a new tab on the browser, go to the following link - <WEB_HOOK_URL>&pin=0

5. The action above will help the WebHook action to learn what param it will accept

6. Attach a new Http call action, and make a GET request to the Blynk api, with the using the "pin" value from the WebHook as the Blynk pin we are changing and also its value - (V<pin_value>=<pin_value>

NOTE: The URL for Blynk looks like - https://sgp1.blynk.cloud/external/api/update?token=<The token of your Blynk app from step 4.3>&V{{1.pin}}={{1.value}

Why Using Both Blynk and Integromat

The connection between Blynk and Integromat -

We experienced some problems with letting 3 Arduinos to communicate with the same Blynk app.

Due to these problems we came out with a solution - Let's make one of the Blynk pins be used as a webhook "router".

In our code, we are writing to the pin V1 on Blynk, the value that we provide this pin, is actually the pin number that we want to trigger.

By saying trigger, we mean that the writing to the V1 pin, will change the state of the other pin from 0 to 1.

For example - If we will write the value 2 to the pin V1, then a webhook will be triggered that will connect back to Blynk and set the value of V2 to 1 (Switch it on).

This way we created some kind of event base Rob Goldberg machine, V1 pin is acting the the message broker for this solution.


Set Up the Stage

For our Rob Goldberg machine we will need to setup a room to preform the flow with.

What will you need

  1. 3 participants.
  2. Fridge.
  3. Tv that can be turned off with IR signal.
  4. Air conditioner that can be managed with IR signal + Has shutters that can move.
  5. Glass of water.
  6. Small rope

The Workflow

NOTE: To preform the workflow, We gave numbers to each Arduino and participant, each one of them is responsible for a certain part of the workflow, from now on, we will call each Arduino by it's number and same for the participants.

1.Participant #1 will have Arduino #1 next to him, once this participant will fall asleep on the Arduino #1, the Arduino #1 will detect that there is a change in the light sensor.

2.Arduino #1 will notify the Blynk application light toggle to turn on.

3.The Blynk application will trigger a webhook call to Integromat that will trigger a webhook call to Blynk app back.

4.Once Blynk got the webhook, it will switch the light sensor indicator on.

5.Arduino #2 will read from this light sensor indicator and will trigger a songs that will be played by the Arduino #2.

6.Once Arduino #2 will start playing music, participant #2 will start to dance.

7.The dancing moves will shake the Arduino #2 and will cause the accelerometer to hit a threshold.

8.This will trigger the same webhook via pin #V1, that will again go to integromat and will trigger a webhook back.

9.Once Blynk got the webhook, it will switch the movement sensor to On state.

10.This will trigger Arduino #1 to play a song (Rick Astley - Never Gonna Give You Up, which we all can't stand).

11.participant #1 will wake up, will get angry and will place the Arduino #1 in the fridge.

12.The temperature inside the fridge will hit a certain threshold and will trigger the next webhook.

13.Once Blynk got the webhook, it will switch the temperature sensor indicator to On state.

14.Arduino #3 will read from this temperature sensor indicator and will trigger an IR call that will turn off the TV.

15.particepant #3 will get upset from the fact his favorite TV show was interrupted, participant #3 will yell at participant #1, the yell will trigger an IR call to the AC.

16.The AC shutters will start to move, this will cause the rope that is connected to a glass of water which is placed above participant #1.

17.The water will spill all over participant #1 and he will eventually wake up.