Rube Goldberg Machine - IoT Reichman University

by gilanavi in Circuits > Arduino

12 Views, 0 Favorites, 0 Comments

Rube Goldberg Machine - IoT Reichman University

IMG_5217.jpg

We made a Rube Goldberg Machine that detects when the door to a room opens and the light turns on, to send a notification to your cell phone that the door was opened. (See attached video)

Supplies

cpx01.jpg

2 Circuit Playground Express (CPX) boards

Write CPX Code

Write the CPX code for both boards; this will use Blynk as an intermediary to Integromat (Make.com), which sends notifications and such. There are also light outputs from both boards using the Adafruit Neopixel library (not mandatory for the final result though). The first board will detect when the light is turned on and then send notification to Integromat to send a notification to a cell phone that it's touching. The cell phone will vibrate, and the same board will detect the vibration and send a signal to Integromat to send a final notification to the cell phone that the door was opened (ideally we'd have a second phone that would receive the final notification and not the same phone that got the first one, otherwise what's the point?).

Set Up Blynk and Integromat

Blynk is only used as a signal for Integromat to do the heavy lifting. You'll need to create a template for the device, and you'll only need to create as many datastreams as you need signals to Integromat. In our case, a minimum of 2. Integromat will retrieve the value sent by the CPX, and verify that the value is correct before sending a notification to the phone. You can also add extra nodes in Integromat such as the OpenAI node we used; every time it needs to send a door notification, it asks OpenAI for a random joke about someone opening the door. This will require extra steps that Integromat walks you through (such as, in the case of OpenAI, getting an API key and organization ID, or whatever extra nodes you want to add). Integromat will need to use HTTP requests of the form:

https://[BLYNK-SERVER].blynk.cloud/external/api/get?token=[TOKEN]&[PIN]

to get the signal from the board, and of the form:

https://[BLYNK-SERVER].blynk.cloud/external/api/update?token=[TOKEN]&[PIN]=[VALUE]

to send a signal back to the board, where BLYNK-SERVER is the blynk server, known by checking Blynk's interface, TOKEN is the Blynk device's token, and PIN and VALUE are the specific pin you want to retrieve, or set with the specified value.

Watch the Magic Happen

This step is pretty self explanatory. You'll plug in the boards with battery packs, set a phone down for the vibration, and every time the door and light are opened, you should get a notification to your cell phone.

(give or take 30 minutes because Integromat decides to be problematic and only lets things happen automatically in 15 minute intervals, so with 2 Integromat scenarios that leads to a highest possible delay of 30 minutes. Note that in the video attached, we manually ran the Integromat scenarios to make it as fast as possible.)

Downloads