GoogleCloudPlatform/IoT-Icebreaker

Name: IoT-Icebreaker

Owner: Google Cloud Platform

Description: The code behind the demo on the BeagleBone Green Wireless IoT Developer prototyping kit for Google Cloud Platform

Created: 2016-06-21 23:51:55.0

Updated: 2018-01-22 18:47:22.0

Pushed: 2016-07-28 03:52:55.0

Homepage: https://cloud.google.com/solutions/iot/kit/

Size: 2085

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Run the IoT developer kit icebreaker in your own project

This example code shows how to use Google Cloud Platform to process sensor data and publish it to Cloud PubSub. It is available to test drive at http://cloud.google.com/solutions/iot/ as an icebreaker demonstration for a developer prototyping kit based on the SeeedStudio BeagleBone Green Wireless. This is not an official Google product.

How it works
Authenticate the BeagleBone using a token vendor

Authentication to Google Cloud Pub/Sub uses an IAM Service Account. This service account is used to generate time-limited OAuth Access tokens used by the agent on the IoT device. See the token-vendor readme for more details.

Send sensor data from BeagleBone to Google Cloud

BeagleBone to Google Cloud Pub/sub

Using Node.js and libmraa we'll access the sensors attached to the BeagleBone. The googleapi npm package is used to publish the sensor data to Google Cloud Pub/Sub.

This way, different subscribers can subscribe to the sensor data, and process it however they want.

Store data

Google Cloud Pub/sub to Google Cloud Datastore

A Google App Engine service (module) is used to subscribe to the sensor data topic and store the data in Cloud Datastore.

View the code running in Google App Engine

Retrieve sensor values from storage

Google Cloud Datastore to API endpoint

To read the sensor data we'll use a separate Google App Engine service (module) that exposes a RESTful JSON API to the sensordata stored in Google Cloud Datastore.

View the code

Running on your own Google Cloud Project

NOTE: All of the command lines given below assume you are inside this repositories folder as the working directory.

Setup Pub/Sub topic and subscription

Note: you will be prompted to install the alpha component for gcloud

Setup service account with limited access
Setup and Deploy AppEngine services

note the warning and workaround in the above docs if you are using homebrew Python - you may need to create ~/.pydistutils.cfg if you are using Homebrew Python, and likely want to remove it after.

**Note: if you get an error on deployment, re-issue the gcloud preview app deploy command for each service (module) until you see all 6 services deployed in the services list in the console

Setup and Deploy BeagleBone Onboard WebServer

Note: the onboard server is included in the Beaglebone Community image - these instructions assume a more bare image.

Modifying the code

Now you've got it running on your own Google Cloud Project. If you want to make changes, update the appropriate code and redeploy.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.