IOT Class Project - Rube Goldberg Machine
by daniel4288 in Circuits > Arduino
166 Views, 1 Favorites, 0 Comments
IOT Class Project - Rube Goldberg Machine
This instructable presents our Goldberg machine that turns the party on.
As a Goldberg machine, we of course go through unneeded complexity to ‘start the party’
Our machine works in the following way:
First, we log in to the Blynk app we created and click on ‘Start machine’ which triggers our circuit to light up (in order to indicate that the process has begun) and check the room temperature.
Once we have the temperature our device will send an event according to the temperature found back to the Blynk application which in turn will pass that information to an Integromat webhook. In addition the circuit’s Neopixels will light up with a color to indicate the temperature range.
Once the request is captured by the webhook, Integromat will extract the variables sent to the webhook and send an email to our account to notify us about the weather. Furthermore once the temperature is received our device will decide whether it’s a situation worthy of a party, if so the party will begin. Otherwise, the device will instruct us on what is needed to be done in order for the party to start and only then will the party begin. Note that even if the temperature is perfect, we still use the light sensor to make sure the lights are right, otherwise – no party. When the party is over, we want to leave no trail behind us, and we can use the slider in the Blynk to turn off the lights.
A person turns on the machine -> CPX lights up -> CPX starts measuring temperature -> (according to temp) Cpx sends blynk event -> Blynk sends information to webhook -> Integromat extracts sent parameters -> Integromat sends email with the weather status
CPX starts measuring temperature -> Cpx checks if the room has the right light exposure -> if so start the party, otherwise awaits for the right conditions.
See our presentation video below
Downloads
Supplies
To create this project you will need :
1 Adafruit playground circuit
1 ESP8266 WIFI board
1 micro USB cable
A Soldering iron kit
A Blynk user account
An Integromat user account
A Battery based power (and batteries)
You need to solder the ESP8266 WIFI board to your circuit.
To do so use the electrical wires that comes with the soldering kit and solder the Arduino to the ESP8266 according to the following diagram.
As the picture shows, you need to connect the GRN on the Arduino to the GRN place on the ESP8266.
Integromat Setup
Create an integromat user at https://www.make.com
On the websites left navigation bar choose ‘Scenarios’, then click on ‘Create a new scenario’ on the upper right side.
A scenario window will open up, add a webhook object, choose custom webhook.
A new window will appear, chose add to create a new webhook, give it a name as you please, click save.
Once you’ve done that a new url should appear with your webhook address, you will now need to access this URL and send parameters for Integromat to understand which data structure fits to your webhook. In this case we send our description of the weather so you will need to go to your url and follow up with the description as follows:
<yourURL>?weather=”The weather is nice today”
Once you do that, you should get an approved message on this url, if so go back to integromate and it should tell you that it determined the right data structure.
Next choose Tools on the bottom bar and choose get variable option in order to extract our variable from the webhook. If you have done the webhook part correctly it should give you an option to choose the variable you have sent it, in this case ‘Weather’. Choose it.
Finally choose to add new Gmail module, a new window will open. Fill in the fields as the picture shows.
You will have to set up your connections to Gmail,
To do so refer to this link:
Great now name your scenario and click save.
Blynk Setup
Start by creating your Blynk account.
Once you’ve done that you can get to the creation of the project’s template.
Click the templates option on the left sidebar, then choose create new template on the upper right side, a new ‘Create New Template’ window will appear. Fill the windows fields.
Once you created a template, it’s time to create a data stream. Choose the template you just created and in the dashboard that opens up choose the ‘Datastream’ tab. Click Edit on the upperright side, a dropdown menu will appear, choose ‘Virtual pin’ and a new window will appear.
Fill it’s fields as the picture shows
Great! Now repeat the steps to create another virtual pin
Now let’s create Blynk events that we will be able to trigger according to each of the three weather modes we support. Choose the ‘Events’ tab and click ‘Edit’ on the upper right side. Click on ‘Add new event’.
A new window will appear, fill it as the pictures show.
Now do the same for cold weather event and nice weather event. Good job!
It’s time to add our device, in the left navigation bar choose ‘Search’ then ‘My Devices’.
Click on the ‘New device’ option and fill its fields according to the projects parts. That is choose hardware to be ESP8266 and connection type to be WIFI.
Now choose your device, your dashboard will appear, next to your project’s name there will be a ‘…’ for a dropdown menu, click it and then choose ‘Edit dashboard’ in order to add widgets to your device.
For the widgets choose a button which we’ll name ‘Machine start’ and a slider which will determine the intensity of the party.
Finally create a webhook connector -
To create your webhook, choose the settings option on the left navigation bar, then choose ‘Webhooks’. Choose create a new webhook. Start filling out the fields according to variables we have set so far during this process. The webhook url you fill is the one you got from integromat.
connect the weather virtual pin. What we are doing here is saying once we get a weather update (which we will create from the code) send the parameters to the webhook so we can send an email accordingly.
We are done setting up the Blynk side of the project.
Code
Use the attached files in the supplies step, to understand how the code works we have commented the various steps.
Notice that we have our main operating file called 'Final project' and our party music's notes file called 'Notes'.