Arduino Project - How to Make Your Roomate Do the Dishes

by ofeks10 in Living > Cleaning

909 Views, 5 Favorites, 0 Comments

Arduino Project - How to Make Your Roomate Do the Dishes

Completely Useless Rube Goldberg machine Ofek & Noam Final IOT Course Project

Hey there, folks!

We, Ofek and Noam, are both student for computer science degree in the Reichman University in Israel.


This semester we had the pleasure to take the Introduction to IOT Course and in this guide we will show you our version of a rube goldberg machine. The following machine is pointless but extremely fun and we had a great pleasure working on it.


Within this comprehensive guide, we will meticulously outline the intricate steps that will empower you to replicate our masterpiece or craft your own extraordinary rendition. We highly recommend immersing yourself in the visual splendor of our accompanying video, as it not only showcases the real-world implementation of our code but also grants you an immersive understanding of the narrative and inspiration behind our creation.


We sincerely hope that the joy and satisfaction we derived from bringing this guide to life transcends to you, our readers. May you find immense pleasure in perusing and imbibing the knowledge we present within this instructable!

Supplies

You will need the following materials:

  • 3 Adafruit Circuit Playground Express boards
  • A samsung Smart TV
  • An annoying roommate (That ignores the dishes like they don't exist)

Project Architecture

architecture_2.drawio.png

Our architecture is based on two Main flows:


The first flow - the Near-TV Device:

This part consists of 1 CPX board, the blynk server, blynk app (on a phone), make.com and a Samsung smart tv.

  1. The Cpx board communicates with the Blynk server sending updates whether a sound threshold has been passed.
  2. The Blynk server sends a webhook to make.com
  3. Make.com notifies each of the roommates through a telegram message sent from a bot.
  4. The blynk app can control the Samsung smart TV through the Cpx board (using IR commands), sending commands to through the Blynk server.


The second flow - the Bedroom Devices:

This part consists of 2 CPX boards, the blynk server and make.com.

  1. One of the Cpx boards communicates with the Blynk server sending updates whether a light threshold has been passed.
  2. The Blynk server sends a webhook to make.com
  3. Make.com notifies each of the roommates through a telegram message sent from a bot.
  4. Make.com sends a HTTP request to the Blynk server to turn on and off the other Cpx board depending on the data received from the first board.


Registering to Make

download.png

Go to the Make website and create an account.

Don't forget to choose your region accordingly (EU / USA)

Registering to Blynk

download.png

Go to the blynk website and create an account

Connecting CPX and ESP8266 Components for Internet Communication

download.png

To enable seamless communication between all of our CPX boards, we need to connect them to the internet. In this guide, we will utilize three ESP8266 components, one for each CPX, to establish an online connection. Follow the steps below to complete the setup:

Requirements:

  • Arduino IDE installed and opened (Arduino IDE)
  • Three ESP8266 components
  • Jumper wires
  • Micro USB cable
  • CPX and ESP8266 boards

Step 1: Install the ESP8266 Board Package

  • Access the "Tools" menu in Arduino IDE and select "Boards Manager."
  • In the search bar, type "ESP8266" and choose the board package provided by ESP8266 Community.
  • Click "Install" and wait for the package to download and install (ESP8266 board package for Arduino).

Step 2: Connect the CPX and ESP8266 Boards

  • Using jumper wires, establish the following connections:
  • CPX GND to ESP8266 GND
  • CPX RX to ESP8266 TX (A7)
  • CPX TX to ESP8266 RX (A6)
  • Connect the CPX board to your computer using a micro USB cable.

Step 3: Configure the Arduino IDE

  • Access the "Tools" menu in Arduino IDE and select "Board."
  • Choose "Adafruit Circuit Playground Express" from the options.
  • Again, go to the "Tools" menu and select "Port." Choose the port corresponding to the CPX board.

Step 4: Upload the Code

  • Open a new sketch in Arduino IDE and copy the provided code into it.
  • Verify the sketch for any errors by clicking the "Verify" button.
  • Upload the sketch to the CPX board by clicking the "Upload" button.

Step 5: Monitor Serial Communication

  • Open the Serial Monitor in Arduino IDE by clicking on the magnifying glass icon in the top-right corner.
  • Set the baud rate of the Serial Monitor to 9600 baud.
  • To test the connection, type some text in the Serial Monitor and press "Send." The same text should appear in the Serial Monitor, indicating that the ESP8266 received the data and forwarded it to the CPX.

Step 6: Test Communication

  • Further evaluate the connection by exchanging data between the CPX and ESP8266 using the Serial Monitor and your custom code.

Congratulations! By following these steps, you have successfully connected an ESP8266 to a CPX board using the Arduino IDE. This allows for seamless communication and opens up possibilities for a variety of internet-enabled applications.

Downloads

Setting Up the Near-tV Device

download.png
download.png
download.png
download.png
download.png
Setup the Near TV Device in Blynk.io

Create the template for our device:

  1. Login to your blink account
  2. Click on the "templates" icon on the left and then "create a template" at the top right
  3. Enter the template name and choose "Arduino" and "Wifi" in the corresponding fields.
  4. After the template has been created, click on the "datastreams" tab
  5. Add the two datastreams, the first being the sound level, which is of type "double" and range of 0 to 150 and the second being "turn tv off" being an integer with the range of 0 and 1 with default value 0.
  6. Click "save" on the top right of the page


Now, let's create a device:

  1. Click on the "search" icon on the top left of the page
  2. Click on "New Device" at the top right of the new page opened
  3. Click on "from template"
  4. Choose our Near TV template and click create
  5. Copy the information the popped up on the top right of the page (the area with the "#define BLYNK_TEMPLATE_ID)
  6. Save this information.


Now, connect your first CPX board to the computer, and burn the attached code to it, but don't forget to edit the top of the file with the defined you copied in the previous part!


Downloads

Set Up the Near-Tv Make.com Scenario

da6312ec-6ce5-4dd7-b0ec-40d0926434a5.png
image1.png
image2.png
image4.png
download.png
download.png
download.png
download.png
download.png
download.png
download.png
download.png
download.png
Setting up the Near TV Make.com scenario
  1. Go to make.com after you have registered
  2. Press the create a new scenario
  3. Press the giant purple button.
  4. Select webhooks
  5. Select custom webhook
  6. Select create a new webhook and press ok.
  7. Copy the url that was given to you and save it for the next section
  8. Under the tools section bellow, press the flow control and then click the router.
  9. To set up the filter option of the webhook you must test the connection from the blynk app to make.com using redetermine the data structure button inside the webhook.
  10. Once finished you can click on the wrench icon then set up a filter. Select data equals to 1.
  11. Press the + button on the router and select the telegram bot option for the 2 new modules that were created.
  12. Inside the telegram bot menu press the "Send a message or reply" option. Then under the connection option press "online help" to set up the bot.
  13. Click here for the guide to get the chat ID needed for steps 14 and 15
  14. After setting up the bot get the chat ID for the responsible roommate and input the following to the message field: "Your roommate is home and watching TV!"
  15. On the other Module for the router set up the telegram bot in a similar way just for the lazy roommate with the following message: "Leave the TV Alone and GO DO THE DISHES"
  16. On the bottom left corner turn on the schedule to run always and you are good to go.

Blynk.com Near TV Webhook Setup

Setting up the Near TV Blynk Webhook
  1. Go to Blynk.com
  2. Press the settings icon in the lower left
  3. Press under the development category the "webhooks"
  4. Click on "Create a webhook"
  5. Set the "WEBHOOK TRIGGER EVENT" to "Device Sends Data To Datastream"
  6. Set the "WEBHOOK NAME" to "Near TV Device"
  7. In "DEVICE" choose the "Near TV Device" and in the datastream to "Sound Level V0"
  8. In the "WEBHOOK URL" place the url from the previous step
  9. And finally in the query parameters set the "Key" to "data" and "value" to "device_pinValue"

Setting Up the Bedroom Devices

image (3).png
image (4).png

For this step we need to create 2 devices for the bedroom scenario.

Similar to step 4 create 2 templates for 2 devices with the following pins and names:

  1. Bedroom Device containing the following virtual pin: V0 = isLightOff (type integer, range 0-1, default 0)
  2. Bedroom Sound Device containing the following virtual pin: V0 = isSoundOn (type integer, range 0-1, default 0)


Add 2 devices, 1 for each template (don't forget to alter for each device the #defines received from the blynk website).

Now burn each device with one of the following code snippets:

Main2.ino

Main3.ino (PixelManager.h is a prerequisite for this module)


Set Up the Bedroom Make.Com Scenario

image.png
image1.png
image2.png
image3.png
image4.png
image5.png
image6.png
image7.png
image8.png
image9.png
image10.png
image11.png
Setting up the Bedroom Make.com scenario

This step is similar to step 5. But with a few additional modules.

In general the telegram and webhook modules are very similar to the last stage but with different messages.

In addition we added another router to differentiate between 0 and 1 values of the data stream that is called "level".

  1. Create a webhook Module.
  2. Connect the blynk server to this module calling the field "level"
  3. Add a first router after this webhook.
  4. Filter the first flow of the router to get all instances where level is eqaul to 1.
  5. Add another router afterwards.
  6. Add a telegram bot module sending a message to the good roommate letting him know that the bad roommate entered the bed but that the blynk server is taking care of it.
  7. On the other route add another telegram message to the bad roommate sending him to get out of bed.
  8. Then add another module after this one sending an HTTP request to the blynk server external api
  9. The request url is the following: https://sgp1.blynk.cloud/external/api/update?token={YOUR_AUTH_TOKEN_FOR_BLYNK_DEVICE}&V0=1
  10. Coming back to the first router add a route filtering all instances where level equals to 0.
  11. Add another HTTP module sending an HTTP request to the blynk server external api where the url should be: https://sgp1.blynk.cloud/external/api/update?token={YOUR_AUTH_TOKEN_FOR_BLYNK_DEVICE}&V0=0



Blynk.Com Bedroom Webhook Setup

image (6).png
  1. Go to Blynk.com
  2. Press the settings icon in the lower left
  3. Press under the development category the "webhooks"
  4. Click on "Create a webhook"
  5. Set the "WEBHOOK TRIGGER EVENT" to "Device Sends Data To Datastream"
  6. Set the "WEBHOOK NAME" to "Bedroom Device"
  7. In "DEVICE" choose the "Bedroom Device" and in the datastream to "Is Light Off V0"
  8. In the "WEBHOOK URL" place the url from the previous step
  9. And finally in the query parameters set the "Key" to "level" and "value" to "device_pinValue"


Physical Setup of All 3 CPX Boards

IMG20230713193141.jpg
IMG20230713193224.jpg
IMG20230713193246.jpg

Our recommendation is to setup up the devices physically like so:

  1. The first device (controlling the tv) should be as close to the IR sensor of the TV and close to it's speakers to the board would pick up all the sound from it
  2. The second device should be in a place that gets dark when the room lights are turned off and close enough to the victim for the sounds
  3. The last device (the one you burned main3.ino to) should be far from the second device so it's lights won't trigger the light sensor (and also to have stereo surround sound for the nokia song)

Final Words

In conclusion, creating this useless Rube Goldberg machine with the sole purpose of annoying a bad roommate into doing the dishes has been an incredibly enjoyable and rewarding experience. From the initial idea to the final execution, we've relished every moment of designing and constructing this whimsical contraption. It brought out our creativity and problem-solving skills in unexpected ways, challenging us to think outside the box and devise elaborate mechanisms that would ultimately achieve our mischievous goal.

We are immensely proud of how this project has turned out. It has not only accomplished its intended purpose but has also served as a reminder of the power of creativity and innovation in our daily lives. The experience has left us with a newfound appreciation for the process of invention and the impact it can have, no matter how trivial or seemingly "useless" the end result may be.

We hope this guide has inspired you to embark on your own creative endeavors, whether they serve a practical purpose or simply bring a smile to your face. Remember, the journey itself is often just as fulfilling as the destination. Embrace the joy of creation, and who knows what extraordinary possibilities may unfold.

Happy inventing!

Ofek and Noam.