6. Break into three steps
Weather
API data
Data
Processing
IOT
devices
Sent for
Send
configuration
changes to
Website that allows users to
choose a weather,
then send weather data
1 2 3
13. {“weather”: “sunny”} ? {“fan”:”on”,
“umbrella” : “open”
“menu” :
“menu_for_sunny_days”}
What goes in here?
14. Cloud Functions
Serverless, scalable functions
Used to connect services together
Can be triggered via HTTP
Just pass it a function and it will take care of provisioning an instance to run the
function on
15. Use Cloud Functions to convert Weather data to
Device Configuration data
Fan Umbrella Menu Recommendation
Sunny On Open Sunny
Cloudy Off Close Cloudy
Rainy On Open Rainy
{“weather” : “sunny”} is converted to {“fan” : “on”,
“umbrella” : open”,
“menu” : “sunny”}
Devices
Weather
16. So far..
Getting weather data
Website (normally a
weather API)
Updates
current
weather
Database
Sends
weather
data
Updates
database
Data Processing
?
Cloud
Functions
Sends New
Device
Configuration
17. Step 3: Build the hardware, connect
them to the cloud
18. Things I used:
1. Motors and servos
2. Raspberry Pi: a miniature computer
a. Its GPIO pins allow it to control devices eg. Motors
3. Cloud IoT Core - a service to connect devices into Google Cloud Platform
Cloud
IoT Core
Sends
configuration
changes to controls Servos and
motors
19. Cloud IoT Core
Use it to manage fleets of IoT devices and handle
authentication
Authentication: Private/public key pairs and JSON
Web tokens
Connects to IoT devices through MQTT or HTTP
protocol
20. Cloud IoT Core: Sending and Receiving Data
It does two main things:
1. Send data (telemetry, state data)
2. Receive data (configuration changes, one off commands)
In the case of telemetry data, data sent to Cloud Pubsub
For configuration changes, data is sent to devices via MQTT
connection
21. Cloud IoT Core
Client on Raspberry Pi listens for configuration changes over MQTT connection
On change in configuration, the Raspberry Pi will configure the devices
accordingly
Devices Sunny Cloudy Rainy
Fan On On, at lower speed Off
Umbrella Open Close Open
Menu Sunny Cloudy Rainy
22. Cloud IoT
Core
Sends
configuration
changes to
controls
Servos and
motors
Configuring Iot Devices
Getting weather data
Website (normally a
weather API)
Updates current weather
Database
Sends weather data
Updates
database
Data Processing
Sends New
Device
Configuration
Cloud
Functions
The full project
24. Ways to get started!
Documentation
Codelabs
Cloud.google.com/blog
QWIKLABS (follow their twitter for info on free credits)
Free $300 USD Credits
Google Cloud Platform podcast
For startups: apply for $3000 in credits
There’s an easy solution to the two is to start small. Build a working prototype first as a small project. Then scale up. Today I will be telling you how you could get started, by introducing the basics of Google Cloud Platform
Different services covering all you need to build working products. Your everyday apps are built on the same backend system GCP has, YouTube, Gmail, drive 150 services, can be very overwhelming to get started. So, i’ll use the project I made for today’s showcase as an example, introduce you to the services I used. First, we come up with an idea
Okay okay, hear me out: Before you start pitching then
I will show you an example of a prototype of a project.
Getting the weather data:
For the purpose of the event, we will have a webpage
Backend figures out what devices do what when it’s sunny. Maps weather patterns to devices
Normally you would call an api to get the current weather and use that to configure your device, but weather variation do not change interestingly within the span of minutes. For the purposes of this demo , we have a web app to choose
(
It is currently ___ (current weather) ___
Google has many options for website hosting. App engine, container engine
What do we do with the weather data?
When you receive data from the API/web app need to convert it to instructions for devices. What does this?
Give it a function at it will run forever, spinning up instances only when needed
You can trigger it in one of three ways:
What do we do with the weather data?
Motors and servos the actual devices moving the umbrella, turn on fan etc
The raspberry pi is
Connecting traditionally unintelligent devices to the cloud.
MQTT is a lightweight messaging protocol optimized for unreliable networks
It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited
A message broker and two types of clients. Receives all messages from clients.
Message broker and a number of cients
Devices are listening for configuration changes over the MQTT connection
Selling to restaurants everywhere a smart iot system
Cloud iot configurations
Cloud functions can do how many invocations.
Cloud firestore can store data
Fire base hosting: auto scaling
You are building on the shoulders on giants. Leverage the infrastructure they can give you to push forward your big plans
Okay, you’re interested, now how to get started?
QWIKLABS
Nothing beats actually doing its free credits
If you’re a startup, DevFest you can apply up to 3000 credits
Blog contains case studies of what other companies have done