Reader small image

You're reading from  Hands-On Industrial Internet of Things

Product typeBook
Published inNov 2018
PublisherPackt
ISBN-139781789537222
Edition1st Edition
Right arrow
Authors (2):
Giacomo Veneri
Giacomo Veneri
author image
Giacomo Veneri

Giacomo Veneri graduated in computer science from the University of Siena. He holds a PhD in neuroscience context with various scientific publications. He is Predix Cloud certified and an influencer, as well as SCRUM and Oracle Java certified. He has 18 years' experience as an IT architect and team leader. He has been an expert on IoT in the fields of oil and gas and transportation since 2013. He lives in Tuscany, where he loves cycling.
Read more about Giacomo Veneri

Antonio Capasso
Antonio Capasso
author image
Antonio Capasso

Antonio Capasso graduated in computer automation in 1999 and computer science in 2003 from the University of Naples. He has been working for twenty years on large and complex IT projects related to the industrial world in a variety of fields (automotive, pharma, food and beverage, and oil and gas), in a variety of roles (programmer, analyst, architect, and team leader) with different technologies and software. Since 2011, he has been involved in building and securing industrial IoT infrastructure. He currently lives in Tuscany, where he loves trekking and swimming.
Read more about Antonio Capasso

View More author details
Right arrow

Implementing a Cloud Industrial IoT Solution with Google Cloud

In the previous chapter, we looked at using an I-IoT platform with AWS. We explored some of the most important topics—storage, time-series, microservices, protocols, data stream processing, and batch processing. The purpose of this chapter is to explore the solutions proposed by the Google Cloud Platform (GCP) and the capabilities of the GCP IoT platform.

In this chapter, we will discover the most popular cloud solutions applied to the I-IoT. We will cover the following topics:

  • Google Cloud IoT Core
  • Google Cloud Bigtable
  • Google Cloud analytics

Google Cloud IoT

Google Cloud IoT is the IoT platform proposed by Google to manage business insights from your global device network. The key components of GCP related to the I-IoT are as follows:

  • Cloud IoT Core: The device hub to receive data and manage devices
  • Cloud Pub/Sub: A publisher/subscriber service to consume data
  • Cloud Dataflow or Cloud Functions: These are used to process data for conversion, digital twins, and diagnosis
  • Cloud Bigtable: This is used for data storage

There are also some more general-purpose services:

  • Cloud Machine Learning (ML)
  • Cloud BigQuery
  • Cloud Storage

From an Edge perspective, Google is quite agnostic. However, they have recently declared that Android will be the platform that is used to develop IoT. The following diagram shows the basic flow diagram implemented by the GCP IoT:

GCP IoT key technologies and flow

Google IoT Core supports Message...

Starting with IoT Core

IoT Core is the Google Cloud IoT gateway for sending data to the cloud. To work with IoT Core, click on IoT Core from the menu on the left. The first time we do this, we will need to enable the API, as shown in the following screenshot:

Enabling the IoT Core API

Building the device registry

When the IoT Core has been enabled, GCP will ask to create a device registry, as shown in the following screenshot:

Device registry

Then, we have to provide a name for the device registry, which in our case will be iiot-book-registry. We also have to define two topics, one for signals, which will be signals, and one for statuses, which will be statuses.

GCP uses two different topics to send data and statuses about...

Bigtable

To store our data, we need the support of Cloud Storage. We can use three different data storage services—Cloud BigQuery, Cloud Bigtable, and Cloud Datastore. To store time-series, Google suggest that you use Bigtable. Bigtable is very similar to the popular open source platform Apache HBase. Bigtable is organized in tables, rows, columns, and families of columns:

  • A table is a collection of rows
  • A row is a collection of column families
  • A column family is a collection of columns
  • A column is a collection of key value pairs

In our exercise, we are going to build a schema, where a combination of device IDs and timestamps is the row key and the column families are the sensors. Please look into the layout and the content of the following table:

Column family

Column family

sensor1

sensor2

Row key

Column

Column

Column

Column

Deviceid...

Cloud Functions

Google Cloud Functions are serverless services that respond to events, such as data coming from our device. We are now going to set up a Cloud Function to extract the data sent by the device, process it immediately, and store it in the central data storage:

  1. From the Google Cloud Console's left-hand menu, click on Cloud Functions and then Enable API:
Enabling the Google Cloud Functions API
  1. Once it is enabled, we can click on the Create function section.
  1. We can then define the name of our function as iiot-book-function-1 and the memory allocated as 128 MB. The trigger is Cloud Pub/Sub and the topic is signals, which we created a few paragraphs prior on the Building the devices registry section:
The definition of iiot-book-function to process the incoming message
  1. Under the source code section of the inline editor on the index.js tab, we can copy and...

GCP for analytics

GCP provides a very powerful platform for analytics, from simple, functional analytics to machine learning. In the following section, we will discover the most common solutions for IoT.

GCP functions for analytics

From the example provided in the last section, it is very easy to implement an analytical function to check the signals and to apply a digital twin. The following function defines a simple excursion monitoring function and evaluates the value of data streaming:


const digitalTwin = {};
digitalTwin['signal1'] = {upperLimit: 40, lowerLimit: 10};

exports.helloPubSub = (event, callback) => {
const pubsubMessage = event.data;

const str = Buffer.from(pubsubMessage.data, 'base64').toString...

Summary

In this chapter, we have explored the most common functionalities of GCP, including its pitfalls and benefits. In the next chapter, we will discover the Azure IoT.

Questions

  1. Which of the following technologies is a serverless technology?
    1. Greengrass
    2. GCP Functions
    3. Docker
  2. Which of the following technologies is a device manager technology?
    1. AWS Greengrass
    2. GCP IOT Core
    3. Azure Hub
  3. Which technology can we use for fast data processing and low latency analytics?
    1. GCP Dataflow
    2. Azure Machine Learning
    3. AWS Lambda

Further reading

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Industrial Internet of Things
Published in: Nov 2018Publisher: PacktISBN-13: 9781789537222
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Giacomo Veneri

Giacomo Veneri graduated in computer science from the University of Siena. He holds a PhD in neuroscience context with various scientific publications. He is Predix Cloud certified and an influencer, as well as SCRUM and Oracle Java certified. He has 18 years' experience as an IT architect and team leader. He has been an expert on IoT in the fields of oil and gas and transportation since 2013. He lives in Tuscany, where he loves cycling.
Read more about Giacomo Veneri

author image
Antonio Capasso

Antonio Capasso graduated in computer automation in 1999 and computer science in 2003 from the University of Naples. He has been working for twenty years on large and complex IT projects related to the industrial world in a variety of fields (automotive, pharma, food and beverage, and oil and gas), in a variety of roles (programmer, analyst, architect, and team leader) with different technologies and software. Since 2011, he has been involved in building and securing industrial IoT infrastructure. He currently lives in Tuscany, where he loves trekking and swimming.
Read more about Antonio Capasso