Rizwan
Rizwan Asif I am a technopreneur exploring the field of artificial intelligence to build the next big thing in tech. My vision for the world is to reduce human capital for low level system tasks and put humans in the higher decision making positions. We are not meant to sort stamp papers, we will give up that task to create something beautiful. 5 min read

Deploying an IOT Application on Google Cloud with App Engine.

We are looking at the advent of Industry 4.0.

You might have heard this sentence many times. However, if you ask different experts about the specifics, you hear different answers. Some refer this revolution as autonomous industries [1], some say digitization [2] and some simply say that humans will no longer be working and that terminators will take over.

The truth is, in Innovation studies we evaluate the applicability each new technology by a couple of parameters. One of them is the Gartner hype-cycle[3]. Currently, it seems that all aforementioned technologies are at the peak of this hype-cycle and frankly quite close to each other. Therefore, it is unclear which one will lead the revolution.

Background

As an automation and entrepreneurship student, I can help clarify what can most probably derive the Industry 4.0 revolution. Let’s establish one thing, we are working towards less human resources. Every industry is trying to cut their employee cost because they see potential in automation. Nothing against humanity, just a fact. Don’t believe me, check out this piece from the book Factfulness, by Hans Rosling [4] as the author went to inspect a pill producing company which was selling lesser than the material costs, thus accusing them of fraud. This is how the conversation goes.

However, our industries have been dependent on human labor for centuries and it won’t be easy to replace them. More importantly, the society is not ready to accept such a change. But there is a way this can be achieved incrementally. Let me tell you how:

We know that artificial intelligence (AI) is dependent on data. More the data, the more clever the AI and thus more capable of performing more tasks. Now keep this in mind and turn your attention to the Internet-of-things (IOT) [5] technology. Imagine all machines in a factory sending data to a common database, regardless of who is operating them. This kind of system is cake for the factory managers and owners. It means that they can monitor their daily production to a micro-level and take more informed business decisions, all while keeping their human work force. This my friend is one of the perks of IOT, easy and plausible. However, the implication is that this humungous data will serve as a gateway for future AI and robotic systems. Thus, creating a passage for total automation in the Industries. Based on this case, I would say IOT will be the one to first show up in our future industries.

Now that you know the importance let’s dive into how we can deploy a cloud based IOT application within minutes.

System

We shall setup an IOT application on the cloud with the following features.

  • Create account
  • Add IOT devices
  • Test with virtual IOT device
  • Fetch the telemetry data

The system is setup using Google Cloud Platform (GCP). App Engine acts as the central server, while Google IOT Core takes care of the actual devices.

Setup

To begin we shall perform the following tasks on our local computer.

  1. Install Python 2.7
  2. Install the Google Cloud SDK
  3. Clone or Download the Github repo rizasif/gcloud-iot-appengine
  4. Install the dependencies at root of the project: pip install -t lib -r requirements.txt

Now that this is done, lets prepare our Google Project. Create a new Google Project then go to API & Services and enable the following by searching.

Next, we will create a Service Account to allow Google App Engine to talk with the IOT Core. Go to IAM & Admin then create a new service account with Editor role. Download the JSON key file and save it at the root of the project we downloaded before.

Now, just fill up the requirements in internal/config.py and viola you have a complete IOT application able to run in the cloud!

Multi-Region

We know that data laws require that data from a country should be stored in the same region. You can make that possible by creating two separate projects in GCP. The App Engine, however, can be in any region since it does not store the telemetry data.

Testing

I created a small python script testing/goo.py to test the system using a simulated IOT device. You can run this script on any Linux system (I was having trouble with windows though). The script will send random data to the cloud application as your device.

Have fun!

Reference Shelf

[1] Andersen, T. J. (2000). Strategic planning, autonomous actions and corporate performance. Long range planning, 33(2), 184-200.

[2] Muro, M., Liu, S., Whiton, J., & Kulkarni, S. (2017). Digitalization and the American workforce.

[3] Chen, X., & Han, T. (2019, June). Disruptive Technology Forecasting based on Gartner Hype Cycle. In 2019 IEEE Technology & Engineering Management Conference (TEMSCON) (pp. 1-6). IEEE.

[4] H. Rosling, Factfulness: Ten Reasons We're Wrong About the World--and Why Things Are Better Than You Think

[5] Gubbi, J., Buyya, R., Marusic, S., & Palaniswami, M. (2013). Internet of Things (IoT): A vision, architectural elements, and future directions. Future generation computer systems, 29(7), 1645-1660.

Rizwan
Rizwan Asif I am a technopreneur exploring the field of artificial intelligence to build the next big thing in tech. My vision for the world is to reduce human capital for low level system tasks and put humans in the higher decision making positions. We are not meant to sort stamp papers, we will give up that task to create something beautiful. 5 min read

Robotic Process Automation (RPA): Automating Your Office Chores

How RPA can change the way our offices operate. A case motivated guide for people who need robots in their office.

Nike, The Startup Way: An Analysis of How Nike Began as a Startup.

Startup is a buzzword these days and many of us pretty much know what they are. Although these small group of motivated individuals seem like they operate differently than what a large company looks like. The truth is all the big brands we see today one way or another operated like a startup once.

Deploy Directly From GitLab to Google App Engine - Rizwan Asif - Medium

A simple tutorial to make your application ready for continuous integration. Just push to your GitLab repository and it is deployed. Google App Engine (GAE) is a robust platform for deploying web applications quickly and safely. I have been using GAE for quite some while now and have certainly faced lesser road blocks than my friends using competitive services.