[MUSIC PLAYING] GABE WEISS: Hi, friends. Thanks for, on this last
day, coming to our talk, "An Overview of Cloud IoT Core." I'm Gabe Weiss. GUS CLASS: And I'm Gus Class. GABE WEISS: We're engineers
working on Google's Cloud Platform specializing in IoT. We're going to bring Gus
back on a little bit, but first, want to have a
little chat with you guys. First thing I need
to know, who are you? Quick survey time. Who out there are engineers,
are the people that doing the work, developers? Oh, nice. OK, most of you. Good. Do we have any biz dev,
managers, C-levels, decision makers? All right, got a couple here. Good. Don't worry, I'm not going to
actually call on any of you. We call that theater of cruelty. I won't do that to you. Do we have any data
scientists in the crowd? Ah, nice. Good. Good, good. All right. Just to make sure we're
all on the same page, who knows what IoT is? OK, most of you. What about IoT Core? All right. Good. Just to make me feel
better, do you all know what Google
Cloud Platform is? Even if you don't,
raise your hands. Just make me feel good. OK, so for those that
haven't heard of it yet-- I saw a couple of
hands didn't go up-- IoT is the internet of things. I actually voted for 5TI, things
that talk to the internet. I thought it would
have been a little more indicative of what it is. So what is IoT? A computer. Your computer
connected to Wi-Fi. IoT device. Your smartphone. IoT device. Smart meters connected
to your house. Electricity, gas. All of those, IoT devices. Raspberry Pis, microcontrollers. We'll get to all of these. All of these are IoT devices. In 2015, Business Insider
along with Gartner did a study that said by 2020,
30 billion connected devices. 30 billion IoT devices. The phones and the
computers, you can see, are a tiny slice of what
we're talking about here. So why aren't we there yet? Why isn't my world
connected and smart? Well, these things take time. They take money. So to really understand
what the holdup is, I want to do a little
brief introduction to the world of electronics. If I say the word
"constrained device," does anyone know what that is? A constrained device? Couple of people
are nodding, OK. A constrained device
is a tiny computer. It's got its memory,
its processor, its analog-to-digital
signal conversion, all in a single chip. That's a constrained device. So because everything's
on that single chip, it's called constrained because
its memory, its processing, its storage are all
severely limited. This is the class
of computer we're talking about when we talk about
30 billion connected devices. Who remembers floppy disks? I'm not talking about--
hold on, hold on. I'm not talking about the
three and 1/2-inch firm ones. Five and 1/4 inch, the
really floppy ones. All right. Now, I know some of
us are old enough that remember there
were bigger ones. There were like the
dinner size plate ones. Those aren't the ones
I'm talking about. The five and 1/4-inch floppies,
those things held 360k of storage. These microcontrollers hold
less than that, on average. If we remember
those floppy disks, a single program
came on many disks. So to load an
application, we had to switch those
things in and out to load your program into RAM. We don't have that luxury
with microcontrollers. We can't just swap them in and
out to load an application. That's why we need something--
a more powerful computer, or Cloud IoT Core-- to expand the capabilities
of the device. So since I keep
bringing it up, I want to make sure we're all on
the same page with IoT Core. What is IoT Core? It's a 100% managed service. This means that you don't
have to stand up anything. You don't have to put
a service up in a VM. We handle all of that
for you in Google. There's no need for auto
scaling, redundancy, scaling. All of that is done
by the cloud for you. IoT Core provides
a global endpoint. No matter where your
devices are in the world, it's the same endpoint. So latency is to your
nearest data center and back, and that's it. IoT Core has two main pieces. It's a communication broker,
and it's a device management. For IoT Core, the organization
of it is you have IoT Core. Inside, you create registries. Registries are buckets
for your devices, so you can create some
logical organization to them, and on the devices yourselves. The messages from
your devices will-- using either HTTPS or
the MQTT protocol-- shuttle your device's
data up into the cloud. And then IoT Core brokers-- that's the communication
pieces-- your messages from IoT Core into
Cloud Pub/Sub, and we'll talk
about Pub/Sub later. Pub/Subs are event
stream manager. And from there,
it's the gateway. IoT Core gives you
access to the rest of Google Cloud's platform. So to wrap your head
around where we are now and why it's really
getting excited, I want to go back to our
little history lesson and talk about how
electronics evolved. In the before times,
your household stuff, like your blender,
your microwave, your washing
machine, all of these were made up of
electronic components, like capacitors,
diodes, resistors. Things that would respond to
electric signal strength alone. The more powerful
the signal, the more it would happen in the
electrical component. So your microwave, for example. How it works, the magnetron
inside your microwave, you increase signal strength
to it, your food gets hotter. Decrease signal strength to it,
and it reduces the temperature. That's how basic
electronics work. Because of the
physical relationship of these components
to each other, as the electrical
signal come in, each component would actuate
or not actuate the next piece it's in. It's like a Rube
Goldberg machine. And because of the tight
physical relationship to it, change was very difficult. If you wanted to
change functionality of your electrical
circuit, you had to make physical changes to it. You had to change your BOM,
your Bill of Materials, so there would be cost
associated with it. The minute you add something
to an electrical circuit, your resistance goes haywire. You might have to change the
whole layout of your circuit. If you wanted to mass
produce your circuits, this is a problem. Once you've created your
tooling for your manufacturing line in your circuit, mass
producing the same template's nice and easy. If you've introduced
change, now you have to retool everything
to recreate your circuits. So it was very expensive
to make any kind of change. Some of these
kinds of circuits-- we call them the analog
circuits-- still exist today. But modern electronics-- and
why this is all exciting-- are a little bit different. Modern electronics
are still composed of sensors, components,
actuators, all of these things that still work with
electrical signals. But instead of the way
that we used to do it, where signal strength was
what changed things, now we have things called
digital protocols. Electrical signal will go
on and off very rapidly in a predefined pattern,
a digital protocol, that is understood by
another piece in the circuit. This means that we can
center our electronics around this constrained device,
this microcontroller, which is very good at reading signals
both analog and digital, and speaking in this
digital protocol. The chip itself can
now create functional change in your circuit
without having to physically change anything around it. It's important because
they're inexpensive. Until relatively recently,
these microcontrollers were pretty expensive. But now, mass
market, I can go out and buy a microcontroller
with Wi-Fi and Bluetooth for less than $5. So adding these complex
circuits and creating these complex circuits
is now very inexpensive. The trade-off, of course, is
that microcontrollers are still relatively constrained. They don't have a
lot of memory, they don't have a lot
of storage, so they need something else
to help them achieve the capabilities that they're
not able to accomplish on their own. So hopefully, this
gives you kind of a backdrop for why
we're at this tipping point with electronics where
cost and complexity have arrived where we can
do things at scale. Being able to
create these cheap, complex circuits
with microcontrollers allows us to think
about creating those cheap or inexpensive
complex smart devices that are going to connect our world. So take a step, and let's
talk about smart devices. What is a smart device? At the simplest,
a smart device is something that can
complete an objective, that can do a task without
human intervention. I don't need to do
anything for it. Modern electronics
and the availability of these microcontrollers
makes intelligent control of these devices
economically feasible. And you might notice
I'm really harping on economically feasible
and inexpensive, and I am. If there's just one takeaway
that I want you to walk away from this talk with, it's that
what a few years ago might not have been possible because
of cost and complexity, is easily achievable now. We have the tools now to
create these ecosystems of smart devices. So smart devices, so
we can understand them. There's three basic
approaches to a smart device, and I'm holding
up three fingers. First, there's 100% on-device. Everything is contained and
done within your single device. Something like
Google Home, where I can use my voice as
the input to a device. It uses speech-to-text
to convert to text. It uses natural
language processing to analyze what I really
asked for, because maybe I didn't ask for the right thing. And runs some kind
of task on-device, and it can accomplish
it all without me having to do anything else. I have a spoken word,
and something happens. It might use the internet to
call out to do something else, but that's part of the task
it's already accomplishing. The second, there's an
edge or border routing. Sometimes we call it as the
radio protocol approach. For example, Nest has released
something called OpenThread. OpenThread allows your
device to call out to another nearby device to take
advantage of its capabilities. So say you've got a device
that can do everything except internet. But whatever the
task is, it needs to be able to call
out to the internet. Well, with OpenThread,
it can reach out to another device that's
nearby and connect it, and borrow its internet
connection in order to accomplish its task. It's still doing some
of the work on board, but it's using these other
devices to finish off what it needs to be done. And lastly, a device can
delegate all of its control to something else. A lot of the times, these
microcontrollers do that. So they will become a
very dumb but very fast gatherer of information,
gatherer of data, and then hand off all of
that IO to something else. A computer nearby, the
cloud, something else. Firmata, made
famous by Arduino-- that's the perfect
example of what this is-- over a
serial wire, you can delegate all of your
control, all of the information that you've gathered on
one device to a computer, to something else nearby. So what if I told you that the
computer that we're connecting to, that is doing all
of this power for us, didn't have to be
anywhere near the devices. And that's why we're
back to IoT Core. This side, you can start
to think about that. Like the concept of Firmata,
IoT Core connects your device to the cloud. It expands the capabilities
of this little device and all of its data
it's collecting to the power of the cloud. It gives your device
these new capabilities without adding any complexity. You don't need more
local hardware. You don't need anything local. All you need to be able to
do is talk to the cloud. So all of this so far, that
our history in electronics are talking about
smart devices, is to hammer this point
home where we're in a world where
creating devices that talk to the internet,
it's not only easy, it's inexpensive. Here's the inexpensive again. We can all do it. So I've touched on why the
cloud is integral to IoT. But just in case you
aren't convinced yet, I want to show you a couple
of things to make sure that you understand. Let's take a look at this graph. This graph is all
of the oil and gas fields in the Gulf of Mexico. There's a little
over 1,300 of them. Each of these gas fields could
have potentially thousands of sensors all streaming data. To keep our math simple,
let's say it's just 1,000. From there, let's say
that each of these sensors is only streaming
100 bytes a second. It's nothing. 100 bytes a second. Even if that's true, that's
137 megabytes a second. It's just over eight
gigabytes a minute. It's 11 and 1/2 terabytes a day. You could manage that data if
you want, but I'm just saying, there's a reason the
cloud was created. The cloud offloads all
of the infrastructure, all of the overhead of
managing this big data. You don't have to
worry about backups, you don't have to worry about
IT people to run your machines and make sure you've got uptime. The cloud handles all of this. The other point I want to
talk about is security. Some of you may
have heard about it. A couple of years ago, there was
a thing called the Mirai botnet attack. This is where a bunch
of unsecure devices-- mostly routers and
stuff like that-- were hijacked and used
to attack the domain name services of the internet, DYN. Took down huge swaths
of the internet for a pretty good amount of
time in the internet scheme. Also, a temperature
sensor in a fish tank. Last year, this happened. A temperature sensor in
a fish tank in a casino was compromised. The hacker was able to, through
this temperature sensor, pull out all of the personal
information of the casino's high rollers, all through
a temperature sensor that didn't happen to be secured. So security is
massively important. If you're doing IoT, you
need to think about security. IoT Core registers all of your
devices with an SSL key pair, and does all your encrypted
communication through TLS1.2 or later to ensure that all of
your devices are secure when they're talking to the cloud. So we understand now, hopefully,
why IoT Core is awesome. But what else? IoT Core is this gateway into
the Google Cloud Platform. What does the Cloud Platform
have for you for IoT? This is a small sampling of what
Google Cloud Platform offers. If you want a really good time,
go to cloud.google.com/products and start scrolling. And just keep scrolling,
and keep scrolling. It's really impressive. There's enough products
on there that even we don't know what all
the products really do. They're all specialized. There's a ton of products that
will fit pretty much any need that you want. But back to our sample. So first, we've got our
devices bringing their data up into GCP. As I've talked about before,
these payloads, the messages, and brokered as events into
Cloud Pub/Sub, our event stream manager. From there, once
it's in Pub/Sub, we have some products
that can respond to our incoming messages. We've got Cloud Functions. Cloud Functions are
serverless functions that just exist in
the serverless space that you can call
either with an endpoint, like you're calling
a URL, or they can respond to events within GCP. In our case, the Pub/Sub
message coming in will trigger a Cloud
Function to run on it. The other product we've got on
here is called Cloud Dataflow. Dataflow is our managed
service to handle transforming incoming streams. It's managed, so again,
like Cloud IoT Core, it will scale without you
having to do anything. However much data
it's processing, it will scale to handle it. It can be used to do things
like filter incoming data, if there is only some
data you want to make it into your final storage. Or it can massage the data
into a specific format if you need it to be
processed in a specific way. It also acts as a
pipeline for your data. Cloud Pub/Sub is temporary. Messages will stay
there for seven days. If you don't do something
with them, they go away. You don't want your
data to go away. So a product like Dataflow
can shuttle your data into the other products,
which brings us to our storage and analytics section. There's way more
than are shown here. These three are just
a very small sampling of what we've got. First, we have Bigtable. Bigtable is our NoSQL
database option. Again, manage service. It will scale with however
much data you put in it. BigQuery is our enterprise-level
data warehousing. It allows you to query your
big data, petabytes of data, with simple SQL statements. That means your data analysts
and your data scientists don't have to
learn a new system. They can just use SQL to find
insights within your data. They can spend their
time analyzing data, not learning a new system. And finally, we've
got machine learning. TensorFlow is the
open source software that allows you to
train your models and run inference
against your models. Cloud Machine Learning
engine is hosted TensorFlow. It allows you to harness all of
the power of Google's backbone to train and run
inference on your models faster and more efficiently. Finally, we have tools that
can visualize your data. We've got a couple
of options here. We've got Cloud Datalab. It's built on
Jupyter, so you can build notebooks to visualize
the data however you want. And we've got an out-of-the-box
solution, Data Studio, which lets you look at time
slices of data in charts and graphs, however you
want to visualize it. So for IoT, with all
of these together, you can do things like
perform device management and monitor your health
across fleets of devices. You can warehouse and analyze
truly absurds amount of data. And lastly, you
can perform things like predictive maintenance in
manufacturing and utilities, to see when your stuff is
going to break using tools like Machine Learning. Cloud IoT core
provides that gateway. It provides the device
management connectivity for all of your devices into the
rest of Google Cloud Platform. It's been only a year. Last year at I/O was when
we announced Cloud IoT Core. So I want to take a
sec just to highlight what we've done since then. What are the
improvements we've made? First, when we announced
that beta a year ago, it could only talk MQTT. If you didn't have a
device that could do MQTT, you're out of luck. We've added HTTPS since then, so
now a broader range of devices can connect to IoT Core and
have their data managed. A year ago when we
launched, each registry-- remember those
buckets of devices-- mapped one-to-one
to the Pub/Sub. So any device data that was
coming into your registry would only go into a
single bucket of Pub/Sub. We've now added the ability
to map multiple Pub/Sub topics to a single registry. So you can shard
your data that way. You can organize your data
into multiple Pub/Sub topics. We've added
Stackdriver logging so that you can monitor your health
through Stackdriver, which is-- it's a logging and monitoring
tools that we've got. I forgot to mention it before. And brand new-- and I don't
think anyone's actually announced this yet, so I'm kind
of excited I get to announce something-- Android Things. I'm sure you've all heard
a lot about Android Things across this conference. Android Things has
created a plug-in that they're releasing
next week that will allow you to easily
connect your Android Things devices to IoT Core. So all of those
sessions that you went to about Android Things,
and all the cool stuff you can create using it, now
let that kind of percolate in the back of your mind. What more can you do with it? If it's connected to the
cloud, what else can you do? What global reach can you
accomplish with Android Things now that it can connect
to cloud IoT Core? So now that I've
talked your ear off, I'm going to bring
Gus back up, and he's going to show you in
practice some of the stuff that I've been talking about. GUS CLASS: Thanks, Gabe. Let's have round of
applause for Gabe and his wonderful blue hair. Look at this guy. [APPLAUSE] Yeah, I don't know how
I'm going to follow that. Just kidding, actually. I'll be the yin to his yang,
and I'll show you the things that he's been talking about. So this is actually--
this is the third time that I've shown the nuts
and bolts of how Cloud IoT Core works. And this is I/O right now,
and I remember a year ago, the Cloud IoT Core team
came in front of you all and demonstrated the
product for the first time. And when they did
it, I have no idea how they were able to get such
a robust and beautiful demo at that point in time, because
there was a lot of pieces that the experience was a cliff. The first time that
I showed this demo that I'm just about to
do, it blew up in my face. And that was for a
couple of reasons. One of them was we didn't have
the cloud console features for IoT Core, so there
was no visual way of adding devices and
creating registries. And there also was no
command line utilities for managing IoT Core. And so I had to write a
sample that would make API calls with the device ID, the
registry ID, the project ID. All these values that are
really easy to fat finger. So when we went to
general availability, the Google Cloud
SDK, or gcloud-- for those who don't
know, Google Cloud ships a command line utility
that's written in Python, I believe. And it allows you
to do all the things that you can do in
cloud programmatically from the command line. And it actually works really
well from cloud resources, and if you go and
do the code lab, I'm actually having you do a
lot of cloud resource management using the gcloud SDK. And so today, I'm
going to show you how to do the nuts and bolts
of Cloud IoT Core just using the cloud SDK as
opposed to using the console, or
the command line, or some API calls that
I've hacked together in some sort of sample app. So I'll just unlock my
[INAUDIBLE] machine, and we'll switch to computer. All right. Can everyone see that? Good? Bigger, smaller? Good? OK. OK. Awesome. All right. So if you remember, the entry
point into Cloud IoT Core is Google Cloud Pub/Sub. And so before we can receive
messages and transmit-- and before we can
transmit messages and then process those
messages from Pub/Sub, we have to create a Google
Cloud Pub/Sub topic. So I'm going to create a
Google Cloud Pub/Sub topic. I'm super nervous,
so I type really bad. OK. [INAUDIBLE] OK, so I just typed in
gcloud pubsub topics creates io2018, top for topic. And so now I do gcloud
pubsub subscriptions. So the subscriptions
will-- of course, my-- got sub, and I forget the help. All right. So when you create
the subscription, you have to associate that
subscription with a topic. And then I have to add create. And if you see me
struggling up here and know how to
fix what I'm doing, don't hesitate to
yell out or something. All right. All right, here we
go-- dash dash topic. All right. So now I have created a Google
Cloud Pub/Sub subscription that is associated with the
Google Cloud Pub/Sub topic. So now whenever I publish
messages into that topic, then they get queued
up in the subscription, and I can pull those messages
from the subscription. So now I'm going to create a
Google Cloud IoT Core registry. And I'm not the best
typer and talker. And so associated
with this registry is going to be an event
notification configuration. And so what that just
means is, when messages are sent-- telemetry messages,
which could be something like sensor data from a device. When those messages
come in, then this is the topic were those
notifications can go to. And so you can also
set this so that you can have event notifications
going to other types of things, and we in the future
may offer other ways of connecting with cloud. So now I've created a registry. And after-- now that-- so the registry
will contain devices that represent the
identity your smart devices or internet-connected devices. And so now I'm ready
to add aided device. And so the device connects
using an asynchronous encrypted credential. So you give us your
public key, and then you encrypt your data
with your private key when you authorize it, and
you get a JSON Web Token. And so what this is going to
do is invoke a couple of-- I can never type those
OpenSSL commands correctly. So really, all this
is doing is just calling this OpenSSL
command, which will generate a
public-private key pair with JWT-compatible algorithms. And so now that I
have my device keys, I can register a new device. And I'm going to call
it E2E because that's the device that
I recommend using for the end-to-end example. And if you want to follow on
your own through a step-by-step example, you can find
this in the documentation at cloud.google.com/iot. And so when I
create this device, I'm going to use the EC_KEY
that was created with OpenSSL. And then I give it the ES256
string representing the type, because that is just
the signing type that's correctly named for JWT. And after this comes
back, then we're ready to connect to
Google Cloud IoT Core. And just for this
example, I'm just going to use the
HTTP example, which is the most basic way of
connecting to Google Cloud IoT Core. So this is just a Python sample. And so there's the
project ID, that's the cloud resource
associated with the device registry and the Pub/Sub
topic and so forth. And then the registry ID,
which is the container for these devices. And the device and ID and
everything else that you saw me put in the previous message. And now Docker is going
to ask me to update. I'll do that later. OK, so. All right. So here's the JWT that is
calculated from the device. And because it's a
brand new device, you'll see that its
configuration is empty. And its also associated--
yeah that's nice. Nice stack trace. So here's the configuration
for the device, and you can see
that I've published a couple of telemetry messages
that are events representing something that this device
is transmitting to the cloud. And so now, if I use
gcloud again, pubsub, and I can do subscriptions pull. All right. I'm going to forget
the name again. Subscription is io2018-sub. And when I do this, I should
see those telemetry messages that were transmitted by the
virtual device to the cloud. And this is always a scary part. There it is. So sorry for how this looks
kind of funky in here, but you can see
attributes, which is like metadata for the
device that connected. The time that--
and anything else that you want to push into
your topic inside of this data field. All right, so if you've
seen any of the talks before on Cloud
IoT Core, you see me do this a lot
of different ways. It's kind of boring. But these devices are
really-- but this is it. You've seen the entire
capabilities of the cloud. Once those messages
are in Pub/Sub, then you can process those
with all of the cloud resources that Google provides. And so this could mean
processing image data and then returning
labels, or reacting to some sort of condition
inside of that image. Or this could mean warehousing
massive [INAUDIBLE] of data, and then being able to do
analytics in real time with it. And so that's fun. But we're going to do something
a little bit different today. And I want to show you
this working on hardware. And so I have brought
with me an Arduino device. And this has been a
20% project of mine. It's an experimental library. And for those who
don't know, Arduino is a physical computing
platform that's very popular in education
and with makers. And it allows you to do
things like blink lights, actuate doors-- actuate electronic
things, which harks back to what Gabe was speaking
about with modern electronics. So modern electronics can easily
be controlled and actuated from Arduino devices. And so I'm going
to do something-- so the virtual devices
are really good for things like load testing,
and estimating, and learning about the product. And then our experimental
library with Arduino, which I cannot recommend that
you go to production yet. It says on my GitHub account,
look out, it's my code. And it's also Alvaro's. So thank you Alvaro for
all your contributions. And anyone who's interested
in contributing to our Arduino project is welcome to. And so now I'm going to go
from that virtual device, which is useful for loading, to a
physical real-world device that we can then use for
prototyping and other things to get an idea about when you
have your actual device built on one of the more
robust solutions that our partners offer. So in order to
work with Arduino, you can just install the library
using the library manager. And then after the
library's installed, inside of the
examples will appear. Google Cloud IoT Core JWT. And inside of here, each
of these is a sketch. An Arduino sketch is just a way
of specifying a source file. And it's what is open
inside of the IDE. And so inside of the sketch is
this header file, CITC config. And then inside of here are
all of your configuration that we just did in
the virtual device except as specified with
this physical device. And I'm just going to
connect to a Wi-Fi. And that's everything else. And this is the
same configuration that I just used from before. Oh. This, yes. Eh, sorry. AUDIENCE: [INAUDIBLE] GUS CLASS: Oh, the project ID. Oh, yes. Yes. So the project ID is-- ah, thank you. Thank you, yes. This could save you a lot
of frustration in a minute. But yeah, so the project
ID is the cloud resource that's associated
with all the things that you created to top it. And then I'm going
to do a transform on the private key, which
I'm going to use for creating the connection credential. And this is an OpenSSL command
that I can never remember. But maybe if we're--
yeah, there it is. OK. So I've taken that
private key, and then I turned it into this string that
looks a lot like this string. And then I'm just going replace
this string with that string. And very soon. Now when I click the run-- AUDIENCE: [INAUDIBLE] GUS CLASS: Oh. Thank you. We're doing a good job, guys. [CHUCKLES] OK. And I make sure I have the
right board, the right port. OK. And this is-- we recently,
I added this support for the Genuino boards. These are like the
Arduino-style boards. They have a feel to then
that's kind of nice. Anyway, now this device
has connected-- let's see. Going to look at my logs here. Oh, no. Something is wrong. That's not good. So then-- [INAUDIBLE]. Let's see. AUDIENCE: [INAUDIBLE] GUS CLASS: Oh, the
private key is wrong. AUDIENCE: [INAUDIBLE] GUS CLASS: Oh, did
I do the public one? Thank you. You're the best. And this would be EC-- let's try this again. AUDIENCE: [INAUDIBLE] GUS CLASS: Trace it-- AUDIENCE: Sketch. AUDIENCE: The
sketch [INAUDIBLE].. GUS CLASS: Oh, I need
to save the sketch. AUDIENCE: [INAUDIBLE] GUS CLASS: Sorry. We'll try this again. [INAUDIBLE]---- sorry,
say that again? AUDIENCE: You have to
concatenate the string to drive the key-- GUS CLASS: Oh, yeah. Actually, no. So Arduino strings
do support this. So this isn't
working as expected. Let's see here, though. Come on. Sometimes the time server
doesn't return the right time, and that can get [INAUDIBLE]. Whoops. And so if this-- there you go. OK, so now it's working. Yeah, so this is an
experimental library, everybody. And I'm-- yes. So heed my advice, yes. [APPLAUSE] And that's why you shouldn't
use it in production yet. But maybe someday. So now-- and this sample, like
with the configuration message is set to something
other than the value one, only one light will
be on on the board. And then if I set the
configuration message to one, so the configuration
for this device is set to one instead of zero,
or hello, then two lights on the board should turn on. And let's see. We'll set it to one. And then everybody
watch on that screen. The light that comes on is on
the left side of the board, I think. And so we just updated
the device configuration, and then through my blazing
fast internet connection, there it is. Yeah. All right. [APPLAUSE] OK. And so this is nice. Devices are fun. And being able to prototype
stuff with Arduino is fantastic, actually, because
you're able to do stuff really quickly, and you're able to,
in just a short period of time and inexpensively, get to
have an understanding of whether or not something
will actually work. [AUDIO OUT] GABE WEISS: To the
mic-- ooh, my mic is on. Do I need to get close to you? Can we use this mic? Oh, it's attached. That's going to end poorly. [CHUCKLES] Do I just need to
get really close to you guys? GUS CLASS: All right. All right, I will speak to Gabe,
and Gabe will speak to you. GABE WEISS: It's going to be
a great game of telephone. GUS CLASS: OK. So three weeks ago. GABE WEISS: So three weeks ago. GUS CLASS: I. GABE WEISS: Gus. [CHUCKLING] [APPLAUSE] GUS CLASS: Needed to do a demo. GABE WEISS: Needed to do a demo. GUS CLASS: To this conference. GABE WEISS: To this conference. GUS CLASS: Yeah. GABE WEISS: Yeah. GUS CLASS: And I had nothing. GABE WEISS: He had nothing. So he went to the
sound guy who's getting him a new battery pack. GUS CLASS: And I had
lights, actually. GABE WEISS: He had some lights. He had some projects he
was working with with LEDs. GUS CLASS: And, uh-- oh, we're back! Yeah! [APPLAUSE] Let's hear it for the sound guy. All right. And so yeah, I had lights. And I thought you all
would be much more excited if I showed you robots. And so I had this toy,
it's a toy like this. I want to show
you it under here. So it's this toy. And this little toy has-- remember Gabe was talking about
digital systems, on and offs. Well, this toy has something-- I saw this on this toy. It's got an infrared receiver. And it has this little
remote associated with it, which I have smudged
off anything that will hint at what it actually is. But this little toy responds
to a blinking light on here. And I just showed
you a blinking light. So what if instead
of that little light, these signals, these
configuration messages that are transmitted to the devices,
are then instead interpreted into the motion commands
for this little toy? And I thought that was cool. And so I started prototyping
on boards very similar to that other one I showed
you, and I came up with this. My friend added some
flair and some character to this little guy. And so what happens is, when
the device comes online, it should wiggle a little bit. And that way, I will know
it's connected to the Wi-Fi. So there's a little
blinking light that indicates the various
stages of the boot. And I'm going to
start a Flask app. All right, there it is. So when it just nods, it
nodded its little head there. What was going on was it's
now connected to Wi-Fi. Oh. GABE WEISS: You do your thing. GUS CLASS: OK. It's now connected to Wi-Fi. And-- this is not the device. And now I can go into my
device registry here again, and I can send configuration
messages and then control this. And what's interesting
is that no longer is it something that's like
a device that's locally here. This device could be anywhere. And it doesn't really-- and at the end there could
be millions of these devices, and you can do things
like coordinate across those devices. Anyway, so let's send
a configuration message to device that will cause
the device to turn its head. And so when the device
responds to the command, it should just nudge
a little bit there. There it is, OK. And so what you'll
also notice that on the front of this device,
I have added a sonar sensor. And that's sonar sensor will
pretty accurately measure distance up to about
30 meters away. And so let's just do-- I wanted to do something
that shows getting data from your devices, putting
that data into the cloud, and then processing that data. So very similar to what
we do in the code lab. And so I created that
little Flask app. And then this
little Flask app has this UI that only a
developer could love. But when I click that button,
it sends a configuration message to this device, if I'm lucky. If it's not cached. Let's see. And that configuration
message will trigger this device to start
moving in this sonar pattern. And these are toys,
so it's not going to turn exactly the same
amount of degrees every time, but it's close
enough that we can get a general idea for the
surroundings around this robot. And then on the blazing fast
internet to my computer, it should render-- oh, that's nice. OK. Still good, still good. All right. And so then we render-- it's all right, you can clap. So then we render a graph of
the surroundings of this device. And so adding the internet
capabilities to this toy was as easy as just
adding a hat on top of it. And also, because of
the low requirements for the hardware
for Cloud IoT Core, I'm able to build these hats
at a the cost of maybe just $5. And so you can imagine in your
factory, or in your store, or in your office,
or wherever you have these modern
electronic systems, that you can communicate
with with internet-connected devices, then you can
add internet capabilities to those devices. And because they're
so inexpensive, we actually no longer
have to show my laptop. It's actually
possible to produce a large number of these devices
in a relatively short period of time and then have
some fun with them. So sometime after
this conference, I'm going to try to open
source this software, so if you all want to make your
own little internet-connected toys and get an idea as to how
these kinds of things work, you can check it out. And for now, I'm going to do
the thing that everyone wants me to do whenever I
show them the robots, and that is make them
move as a swarm army. OK. And it's at times like
this that I really appreciate how little data
the Cloud IoT Core product sips, because I am totally not
using my phone for connecting these devices. GABE WEISS: Totally is. GUS CLASS: [CHUCKLES] Yeah. All right. GABE WEISS: You should have
a bunch of them online. GUS CLASS: There we go. OK. And it's just about
time for them to march. Oops. All right. And we'll go back to-- and thank you, Gabe, for
wrangling all these robots. All right, [INAUDIBLE]-- uh oh. Look out. Go, robots, go! GABE WEISS: It's the Wi-Fi. GUS CLASS: It's
probably the Wi-Fi. But, I mean-- GABE WEISS: They're blinking
really pretty, though. GUS CLASS: They are
blinking really pretty. I feel pretty good about that. GABE WEISS: [CHUCKLES] Ooh! GUS CLASS: There they go, yeah! So there it is! [APPLAUSE] Thank you. GABE WEISS: [CHUCKLES]
We have a jumper. GUS CLASS: Uh-oh, uh-oh. All right. All right, they've
already become sentient. This one's trying to break free. All right. All right. AUDIENCE: Oh, there's some more! GUS CLASS: Yeah! Yes. GABE WEISS: OK. GUS CLASS: I also
wanted to do this just to make Gabe have to
dance around on stage. All right, so let's
go back to the slides and we'll just wrap up. OK. So going back to
other approaches to adding smart and intelligent
capabilities to your devices, I want to again say
there's other ways of doing this than just complete
delegation to the cloud. You can use edge
board or routing to extend the capabilities
of nearby devices to other devices. You can use on-device smarts
with things like Android Things so if you have all the
capabilities without the cloud, or some capabilities
shared with the cloud, Android Things is a really
great way to do this. And also, as Gabe mentioned
at the very beginning, we have Stackdriver logging. And Stackdriver logging,
for some people, can get them a
lot of information about things like security
audits and other-- and that combined with
the metadata of devices may be enough for a lot of
what people's IoT needs are. And because we went
a little bit over, I will try to wrap up quickly,
and I'll let Gabe close us out. GABE WEISS: So we want
to hear from you, how you thought about this talk. So please go here and enter
in our talk, the Cloud IoT Overview. Thank you for coming. If you want to-- [APPLAUSE] [MUSIC PLAYING]