Hardware

Save TI CC3220 data to a Google Spreadsheet


We'll show you how to make your TI CC3220 add rows of data to a Google Spreadsheet. You can use your CC3220 to log data from sensors connected to your board like temperature readings over time, or other instances where your CC3220 is receiving information that you'd like to record.

This code uses our Google > Sheets > AppendValues Choreo.

Get Set Up

1Make sure you have a Temboo account. If you don't already have one, you can register for a free account here.

2You'll need a free Texas Instruments account to use their online IDE, CCS Cloud. You can sign up here.

3If you haven't already done so, prepare your board for making secure connections by following our Setting up CC3220 for SSL tutorial.

4Since this code uses a Google spreadsheet, you'll also need a Google account.

5Login to Google's Developer Console, and create a new Project if you haven't done so already.

6Under the API Manager section, select Library and make sure you've enabled API Access for the Google Sheets API.

7Select Library in the API Manager section, and create a new Client ID specifying Web application for the Application Type.

8When configuring the Consent Screen, make sure you fill out the Email Address and Product Name fields.

9Save the Consent Screen details and specify the callback URL below as the Authorized Redirect URI.

https://ACCOUNT_NAME.temboolive.com/callback/google

10Go to the Google > OAuth > InitializeOAuth Choreo page, and fill in the Client ID from the app you registered at Google and the following Scope: https://www.googleapis.com/auth/spreadsheets Next, click Generate Code to run the Choreo from our site.

Google OAuth Inputs

The InitializeOAuth choreo will return an authorization URL and a callback ID (required for the FinalizeOAuth step).

11Open a new web browser, navigate to the authorization URL returned by the InitializeOAuth Choreo, and click "Accept" to grant the app access to your Google account.

Google OAuth Accept

12Go to the Google > OAuth > FinalizeOAuth Choreo page, and fill in the callback ID returned earlier by the InitializeOAuth Choreo. Next, click Generate Code to run the Choreo from our site. This process will return a Refresh Token which can be used along with the Client ID and Client Secret to authenticate with Google.

13Create a Google Spreadsheet. In this example our spreadsheet has two columns as seen below: time (in milliseconds) and sensor values.

Google Spreadsheet

A screenshot of a spreadsheet taking data from a CC3220 - note the column names

14When viewing your spreadsheet, you'll see a spreadsheet ID in your browser's URL bar. Copy this ID because you'll need it when running the AppendValues Choreo. In the example below, the highlighted part is the Spreadsheet ID.

Google Spreadsheet

Auto-Generate your CC3220 Code

15Go to the Google > Sheets > AppendValues in our Library.

16Select Texas Instruments from the drop down menu, then choose your board. Make sure that you've added details about how your CC3220 is connected to the internet.

Selecting your TI CC3220

17Fill in the required Choreo inputs, then click Generate Code to test out the Choreo from our website and confirm that your Google Spreadsheet was updated successfully.

Google Spreadsheets Inputs

Testing the AppendValues Choreo from our website

18When you've confirmed that the Choreo runs successfully, scroll down to the Code box. Click the "Send to CCS Cloud" button to the right of your generated code. Name your application and click Send. Click the link that appears to visit the CCS Cloud IDE in your browser.

Sending code from Temboo to CCS Cloud

Run The Code

19Plug your CC3220 board into your computer via USB. Select its USB connection in CCS Cloud via the Target > Connect COM port... menu.

20Now, run the code on your CC3220 from CCS Cloud.

Running your code on your CC3220 board from CCS Cloud

Extending The Code

You'll notice that your code always sends the same hard-coded values to your spreadsheet. Of course, it's far more interesting to send dynamic values i.e., sensor values. We'll show how to add a sensor value and current time to our spreadsheet.

21To insert a sensor reading into a Choreo input dynamically, click the blue button inside a Choreo input field and select the sensor whose reading you wish to use. Take care when substituting dynamic variables into the JSON code that you're sending.

Inserting a sensor reading into a Choreo input

22That's it! Your new code will generate dynamic values and add them to your Google Spreadsheet.

What's Next?

Now that you've mastered working with Google Spreadsheets, why not check out the rest of the 2000+ Choreos in our Library and get inspired for your next project.

Need Help?

We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.


Back