So I'm trying to make use of my Arduino Uno while I purchase the components for my next project.

I've made use of the Digital Hourglass project from the Starter Kit to make sure I get up and move around every 20 minutes while I'm at home. A temperature sensor was included in the Starter Kit as well, so I figured I might as well make use of it since I have extra I/O pins.

I wrote the code for in the Arduino IDE to display the temperature and the current time. I'm using: #include (Time.h) to also show the current time. I have two questions.

End Goal:

A Google spreadsheet (Cloud) that I can access anywhere that can show me the temperature of my apartment throughout the day. I can track how the trend changes over time through the day, week, or month.

  1. What is the best way to output the current time; as seconds since 1970 (Unix time) or date and time format? I guess it's a preference.

  2. How do I output the data from the Arduino serial port directly to Google Sheets? That may be difficult, so the other option is to energize the Arduino in the morning and remove power at the end of the day, output the Serial port to a .txt file, and then import into Google sheets. How do I do this?


3 Answers 3

  1. Use Google's time stamp format: MM-dd-yyyy hh:mm:ss, see Google Sheets API v4 - Date and Number Formats.

  2. There are a few ways. For example:

    • A PC connected to the Internet with software on it that listens for data form the Arduino. It would get the Arduino data over serial then send that via the Internet to Google.

    • A Wi-Fi, or network, shield connected to the Internet. You could then use Google's API to send the data directly from the Arduino, see Google Sheets API v4 - Writing.

    • Or - as you mentioned - physically get the SD card and manually upload.

  • The first one is the idea. I'm leaving the Arduino connected to my laptop throughout the day while I'm gone. It shouldn't be that hard to edit the script to at least send that data from being transmitted from the Arduino to a .txt document. Maybe I haven't done enough digging into the Arduino Playground. This should be able to work with any analog sensor. Jun 28, 2017 at 21:11

I'd use an ESP8266 and IFTTT.

https://ifttt.com/maker_webhooks https://ifttt.com/google_drive

You could write something on your PC that took the serial output from the Aurdino and posts a REST message to IFTTT.

  • Yes, I recently ordered the Sparkfun Photon kit for a lot of IoT training. This project that I posted about in particular is not meant to be an IoT project. It's meant to learn how to simply document data for later processing using the serial connection. Thank you though! Jun 28, 2017 at 21:07

Wouldn't it be great if the data from Arduino obtained via serial port could be inserted directly at a local google spreadsheet url, without using any api nor post requests?

As far as I know, Google Spreadsheets can be updated (by a human) in the local machine even without internet.

What would be the benefit?

If eventually internet goes offline for several hours, no arduino data would be lost.

In the good working solutions provided, internet is always mandatory, if I see correct. No internet? Lost data. It seems to me.

But I really don't know if a script can get serial data from Arduino and then update an existing google spreadsheet url, as a human would do (typing a new row).

An autoit or autohotkey script would do on Windows machines by simulating mouse clicks and typing, but it must exist more beautiful solutions.

A solution like this would accumulate data with or without internet and, as soon as internet returns, all data would be updated to the cloud. If I see correct. (I am sorry if I made any mistake).

I guess I have a not so bad solution: save all data to a txt file. Then, periodically, try to update all data to a google spreadsheet using Sheets API or any internet-dependent way (Web App, etc).

In this case, if there's no internet, data still accumulates at a txt file. When internet returns, no data would had been lost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.