First of all, you need a system that can take sensor information and translate it into data to be processed. There are multiple options for that, but in this tutorial, we will look at a simple and cost-effective solution called Gravio.
If you don’t have Gravio yet, you get it in three easy steps:
In this tutorial, we learn how temperature sensor data is being recorded as time series records into a Google Sheet spreadsheet.
If you have all the above, we’re ready to go. If you don’t have any sensors, you may also use Gravio and a Software Sensor such as a network/USB camera and a machine learning visual recognition model. I will cover this in other chapters.
The first step is to log in with your Google account and create a Google Form. Give it a meaningful name such as “Temperature Hallway” and create a new entry. In this case we called it Temperature and used the “Short Answer” as an input method:
Now, click on the “Send” button on the top right and select the “Link” icon tab:
Copy the link into a text editor and identify the ID of the form, which is the part between /e/ and /viewform/ marked as xxxxxxx below:
Open the URL in a browser and it should look similar to this:
Now we need to find the question ID. This requires a bit more skills because you need to inspect the source code of the form. The easiest way to do this is to use the Chrome browser.
Open the above URL in Chrome:
The question ID has the format entry.xxxxxxxxxx within the form. You can find it in the source code using the DevTools. Press F12 (PC) or press the key combination Option+Command+i on Mac to open the “Inspector”. You will get a view, similar to this, with either the code on the side, below or in a separate window (depending on your settings):
Now you have:
Remember those carefully.
Note: if you change the Google Form, either of those IDs may change, so be careful when doing so.
The next step is to take the sensor information from Gravio and HTTP Post it to the Google Form.
For this, create a Gravio Action. For details on how to use Gravio, you can consider the Gravio Documentation.
Gravio is available for Windows and macOS. In this tutorial, we use the macOS version.
Create a SendHTTPRequest Action and fill in the following fields:
URL: https://docs.google.com/forms/d/e/<Form ID>/formResponse
HTTP Method: POST
Body: "entry.<Question ID>="+av.Data
The +av.Data in the “Body” field adds the av (action variable) data (i.e. the temperature sensor data) to the string (concatenated via the + sign)
Once filled in, you can try the action by pressing the “Play” button at the top right:
It will submit any sensor data to the form, as the action has not been triggered by a sensor, but at least you can see if the data gets through. The bottom of the screen shows debugging information.
Thereafter you can open your form in edit mode again and switch to the “Responses” view:
You should see a “0” entry in the responses view or table:
When you now click on the “Create Spreadsheet” button, you will see a prompt to name the spreadsheet or add it to an existing spreadsheet. Select to create a new one:
Open the spreadsheet in Google Sheets and you will see your Time Series:
In Gravio Studio, you can now hook the Sensor to the Trigger that triggers the Action and the sensor data should come through automatically.
You can compare the “Data” tab in Gravio with the Google Spreadsheet. Data should come through in near real-time:
Needless to say, you can make nice graphs from the data gathered:
If you have any ideas or suggestions, don’t hesitate to get in touch. We have a friendly Gravio slack channel, that you can join for free!
We're looking forward to see what ideas you can come up with!