Google Cloud Next

An IoT Project in an Hour? Google Shows Off Cloud IoT Core

A Google senior developer advocate showed off elements of the company’s expanding IoT cloud functionalities.  

Word on the street has it that IoT is hard. That broad statement is an accurate assessment for the relatively slow perfusion of IoT devices, whether they are in industrial facilities, homes or anywhere else. The term “pilot purgatory” has been bandied about to describe the situation in the enterprise and industrial realm. Earlier this year, a McKinsey blog post posed the question whether it made more sense to think of an “industrial evolution” as a more apt term for the digitization of manufacturing than the industry-revolution-referencing term “Industrie 4.0.”

But developing an IoT application need not be so hard, declared Gabe Weiss, a senior developer advocate at Google in a session at Google Cloud Next. Flanked by four colleagues, Weiss walked the audience through the creation of a stress-monitoring IoT application that was up in running in less than an hour. “I don’t want to fool you into thinking that: ‘yes, we’re going to be building an end-to-end app today on stage’,” Weiss stressed. The developers had answered many of the project-related questions beforehand. It would also be an exaggeration to expect to craft a production-ready IoT project in such a short time, Weiss said.

The session did, however, illustrate that with sufficient strategizing and familiarity with a technology such as Google Cloud Platform, the prospect of building a single experimental IoT application can be straightforward. “What you can put together in this short amount of time is immediately useful,” Weiss said. “The data that you can get me from these simple applications can immediately be introspected, can be looked at, can be used to get ROI on whatever business that you’re doing.”

The first step in building an application is to identify an idea, which will then dictate the types of technologies needed. “The question I wanted answered was: ‘Who up here amongst us is the coolest on stage? Who is the most nervous, the most anxious in front of everyone?’” referring to his developer colleagues.

One reliable way to detect stress is the chemical cortisol, a stress hormone found in body fluids such as blood and saliva. The event organizers balked at the prospect of having a biohazard on stage, so Weiss pondered measuring blood pressure. “How elevated it is will tell you how stressed you are,” he said. “It requires you to be able to detect heart rate, and you have to be able to apply and release pressure in an even way around your arm. It's totally doable with IoT, but maybe a little ambitious for a 50-minute session. So I kind of got rid of that.”

The next option was to monitor stress via the vagus nerve, which regulates the pulse. In periods of stress, the vagal impulse is suppressed, causing the heart rate to soar.

So the developers set off to measure heart rate and pulse, benefitting from the widespread availability of off-the-shelf sensors dedicated to these applications. Next up was developing a Python app that could read data from the analog sensors, drawing on open-source Python libraries. “Our device is an Arduino. It could run analog devices easily, and connect over serial to a Raspberry Pi, which is super easy to connect and it runs Python,” Weiss said. “Obviously, for most [production] IoT, that’s not what you’re going to be using. It's not cost-effective. But for our purpose, it’s just to highlight the technology.”

The team used Cloud IoT Core for data ingestion, which is a Google Cloud Platform gateway for devices to send telemetry data to the cloud and manages device authorization, security and  management. “It allows you to configure your devices from the cloud,” Weiss said. “It allows devices to report their state, so you can check the health of your fleet from the cloud without having to talk directly to your device.”

From there, the data is transferred to Google Pub/Sub, a real-time messaging service supporting sending and receiving messages from separate applications, and from there, it goes to data storage known as Cloud Firestore. To accomplish that objective, the group used a service known as Google Cloud Functions. “Cloud Functions are serverless,” Weiss said. “It’s a low barrier to entry. It’s JavaScript. So it's easy to stand up and get going.” The catch is that it fires once per message coming in. If an application involves a million IoT devices, that functionality wouldn’t be ideal. For such applications with high throughput, Google offers managed services known as Cloud Dataflow and Dataproc.

Next up, Weiss walked through storing data in the NoSQL database known as Firestore, which supports real-time visualizations. And finally, the data goes to an Angular front end and to Google Sheets supported by Apps Script. “Angular is a batteries-included framework for JavaScript,” Weiss said. “It has components to do everything that you would need to do in a web app, animation, rendering, forms, integrated testing. All those things you would want to have in a web app, we've got in Angular.”

In the demo, the Angular app read from Cloud Firestore in real time. The sensors pushed readings once per second into the cloud. But the team used Google Sheets to look at historical data and applied a rule to change the color to the data anytime it traveled above a set threshold. “It’s a way to get a quick-and-dirty look after your data by doing some analysis in semi-real time,” Weiss said.

So who was the most stressed person on stage? It wasn’t clear, although Weiss pointed out that his pulse was the lowest of the bunch — even after sprinting across the room toward the end of the demo. More clear-cut was the conclusion that developing an experimental but functioning IoT project can be a straightforward affair when developers have both a solid idea along with comprehensive and familiar tools at their disposal.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish