This is the second in a series of tutorials examining various uses of the Arduino Yún. In this article we’ll examine how your Arduino Yún can send data that it captures from the analogue and digital inputs and a real-time clock IC to an online Google Docs spreadsheet. Doing so gives you a neat and inexpensive method of capturing data in real-time and having the ability to analyse the data from almost anywhere, and export it with very little effort.

Getting Started
If you haven’t already done so, ensure your Arduino Yún can connect to your network via WiFi or cable – and get a Temboo account (we run through this here). And you need (at the time of writing) IDE version 1.5.4 which can be downloaded from the Arduino website. Finally, you will need a Google account, so if you don’t have one – sign up here

Step 1: Testing the Arduino Yún-Google Docs Connection

In this first example we’ll run through the sketch provided by Temboo so you can confirm everything works as it should. First of all, create a spreadsheet in Google Docs. Call it “ArduinoData” and label the first two columns as “time” and “sensor”, as shown in the screen shot above.

Always label the required columns. You can call them whatever you need. For new Google users, the URL shown in my example will be different to yours. Next, copy the following sketch to the IDE:

Demonstrates appending a row of data to a Google spreadsheet from the Arduino Yun
using the Temboo Arduino Yun SDK.
This example code is in the public domain.
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// Note that for additional security and reusability, you could
// use #define statements to specify these values in a .h file.
const String GOOGLE_USERNAME = "your-google-username";
const String GOOGLE_PASSWORD = "your-google-password";
// the title of the spreadsheet you want to send data to
// (Note that this must actually be the title of a Google spreadsheet
// that exists in your Google Drive/Docs account, and is configured
// as described above.)
const String SPREADSHEET_TITLE = "your-spreadsheet-title";
const unsigned long RUN_INTERVAL_MILLIS = 60000; // how often to run the Choreo (in milliseconds)
// the last time we ran the Choreo
// (initialized to 60 seconds ago so the
// Choreo is run immediately when we start up)
unsigned long lastRun = (unsigned long)-60000;
void setup() {
// for debugging, wait until a serial console is connected
Serial.print("Initializing the bridge...");
void loop()
// get the number of milliseconds this sketch has been running
unsigned long now = millis();
// run again if it's been 60 seconds since we last ran
if (now - lastRun >= RUN_INTERVAL_MILLIS) {
// remember 'now' as the last time we ran the choreo
lastRun = now;
Serial.println("Getting sensor value...");
// get the value we want to append to our spreadsheet
unsigned long sensorValue = getSensorValue();
Serial.println("Appending value to spreadsheet...");
// we need a Process object to send a Choreo request to Temboo
TembooChoreo AppendRowChoreo;
// invoke the Temboo client
// NOTE that the client must be reinvoked and repopulated with
// appropriate arguments each time its run() method is called.
// set Temboo account credentials
// identify the Temboo Library choreo to run (Google > Spreadsheets > AppendRow)
// set the required Choreo inputs
// see https://www.temboo.com/library/Library/Google/Spr...
// for complete details about the inputs for this Choreo
// your Google username (usually your email address)
AppendRowChoreo.addInput("Username", GOOGLE_USERNAME);
// your Google account password
AppendRowChoreo.addInput("Password", GOOGLE_PASSWORD);
// the title of the spreadsheet you want to append to
AppendRowChoreo.addInput("SpreadsheetTitle", SPREADSHEET_TITLE);
// convert the time and sensor values to a comma separated string
String rowData(now);
rowData += ",";
rowData += sensorValue;
// add the RowData input item
AppendRowChoreo.addInput("RowData", rowData);
// run the Choreo and wait for the results
// The return code (returnCode) will indicate success or failure
unsigned int returnCode = AppendRowChoreo.run();
// return code of zero (0) means success
if (returnCode == 0) {
Serial.println("Success! Appended " + rowData);
} else {
// return code of anything other than zero means failure
// read and display any error messages
while (AppendRowChoreo.available()) {
char c = AppendRowChoreo.read();
// this function simulates reading the value of a sensor
unsigned long getSensorValue() {
return analogRead(A0);

Now look for the following two lines in the sketch:

const String GOOGLE_USERNAME = "your-google-username";
const String GOOGLE_PASSWORD = "your-google-password";

This is where you put your Google account username and password. For example, if your Google account is “CI5@gmail.com” and password “RS2000Escort” the two lines will be:

const String GOOGLE_USERNAME = "CI5@gmail.com";
const String GOOGLE_PASSWORD = "RS2000Escort";

Next, you need to insert the spreadsheet name in the sketch. Look for the following line:

const String SPREADSHEET_TITLE = "your-spreadsheet-title";

and change your-spreadsheet-title to ArduinoData.

Finally, create your header file by copying the the header file data from here (after logging to Temboo) into a text file and saving it with the name TembooAccount.h in the same folder as your sketch from above. You know this has been successful when opening the sketch, as you will see the header file in a second tab, for example in the second image above.

Finally, save and upload your sketch to the Arduino Yún. After a moment or two it will send values to the spreadsheet, and repeat this every sixty seconds – for example in the third image above.

If your Yún is connected via USB you can also watch the status via the serial monitor.
One really super-cool and convenient feature of using Google Docs is that you can access it from almost anywhere. Desktop, tablet, mobile… and it updates in real-time.

So with your Yún you can capture data and view it from anywhere you can access the Internet. Now let’s do just that in the next step...

<p>Hey there, I need to control my tricopter through an Android application which connects with the Arduino Yun through Wi-Fi. Can you please explain me the approach of it and the programming related to it?</p>
<p>Hey TronixStuff !</p><p>I'm getting an error massage when I applied that code at IDE that &quot;No matching function for call to TembooChoreo::TembooChoreo&quot; and IDE shows that &quot;TembooChoreo AppendRowChoreo&quot; row for an error. Can you please help me how can I fix ?</p>
<p>I am getting an error as followed for step 1:</p><p>&quot;sketch_dec22e.ino:5:20: fatal error: Temboo.h: No such file or directory</p><p>compilation terminated.&quot;</p>
<p>I am getting an error as followed for step 1:</p><p>&quot;sketch_dec22e.ino:5:20: fatal error: Temboo.h: No such file or directory</p><p>compilation terminated.&quot;</p>
<p>I am getting an error as followed for step 1:</p><p>&quot;sketch_dec22e.ino:5:20: fatal error: Temboo.h: No such file or directory</p><p>compilation terminated.&quot;</p>
<p>Hey Tronixstuff!, <br>Great tutorial on the yun and google docs. A question comes to mind though, and perhaps you would know. Since the Yun can upload live data to google docs, would it be possible for another Yun to read that data and then do something with it? Such as Yun #1 logs temp sensor data to google docs. Yun #2 reads the updated cell and then displays on lcd 16x2. Or is the Yun only set to post data?</p>
<p>Looks like it may be very possible. Just need to use a different Tembo choreo</p><p>the above uses the Google&gt;Spreadsheet&gt;AppendRow Choreo.</p><p>I looks like there is many choreos associated with Google Spreadsheet.</p><p>One that looks promising is Google&gt;Spreadsheet&gt;RetrieveLastColumnValue.</p><p>Thanks again for the tutorial</p>
now the wat if somes ones account name and pass word is wat u put in there mhmmmmm?
You clearly were never a fan of &quot;The Professionals&quot;.

About This Instructable




Bio: Technical person. Visit http://tronixstuff.com for Arduino and other tutorials, projects, kits, reviews and more. VK3FJBX http://arduinoworkshop.com
More by tronixstuff:Arduino “Book Monster” Arduino Tutorial - Numeric Keypads Google Docs and the Arduino Yún 
Add instructable to: