Introduction: Post to Google Docs With Arduino
Lets get right into this. I was logging temperature of a room to an Excel sheet via Serial.print commands, then importing CSV files and yada yada. I couldn't get to the data unless I was at home, and also I had to leave my computer running in order to log the data. I needed a better way to log temperature (or anything for that matter) and be able to access it from anywhere.
Google Docs is a great free service that fits the bill perfect. There are tons of tutorials showing how to do this HOWEVER they are all out of date due to Google changing things up on their forms. So I am here to re-write everything I learned to help you get started and logging real time to the internet.
You will need:
Ethernet shield (probably can be done with a YUN or WiFi, but I used Ethernet.)
** I added a screen shot of my dashboard which displays all the data that I am collecting. This is all based on 3 temperature sensors.**
Step 1: Get Accounts (FREE)
Step 2: Create a Google Form and Get FORM KEY
Inside of google Drive you can create a 'Form' . For the sake of making this simple. I will create a single question TEXT response form as shown. When that is complete, click send form.
A screen will pop up which will have the option to show URL. Click that then Copy the URL that it spits out. Paste that into your web browser and you will find yourself at the form you created.
From here you will need to right click and select 'Inspect Elements'. This will load the HTML code for the form. You are looking for the line of code that is defining the Text input box. You will find a section of the code that is "entry.12734623852784" (numbers are dependent on your form, I typed nonsense) Take note of this. I will be referring to this as "FORM KEY"
Step 3: Pushingbox, Service and Scenarios
Head over to pushingbox.com and log in with the same google information that you created the form with.
Go to My Services and create a new custom service. You will need to go to your google form and submit a response. This will load the response page of your form. Copy this URL and paste it into the pushingbox Service URL field. Name it whatever you want and set method to GET.
Now go to my scenarios. This is where the FORM KEY will be used. Following my template, past this into the scenarios field to add:
?entry.1917223082=$status$&submit=Submit Change the bold text with your FORM KEY that you gathered in step 2. Leave the ? and the other stuff, just replace the bold with your stuff. Now copy that whole string and past into the add scenario field. Now click ADD. Then it will say nice job! or something positive like that. Click ADD AN ACTION. Then select the Service you created only moments ago.
This will give you a DEVICE ID remember this, in fact. write it down or copy and paste it into a notepad doc. This will be used in the Arduino code.
Congrats, you are done with that and now its time to code the Arduino.
Step 4: CODE THE ARDUINO
I have attached my very simple code to run this example. You will find a section of things to be edited. This code will send responses to the form you created in the form of data. You will see google then creates a spreadsheet and logs all the responses WITH time stamps! Use this to create data logs of temperature, light levels, humidity, motion whatever you want! The example attached uses a DHT11 thermo/humidity sensor. Can easily be modified for something else.
I hope this lets you walk through the steps and get some data posted to the web.