the fabryq iot prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • widespread...

35
The fabryq IoT prototyping platform Will McGrath PhD Student Advised by Björn Hartmann

Upload: others

Post on 13-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

The fabryq IoT prototyping platform

Will McGrath PhD Student

Advised by Björn Hartmann

Page 2: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Motivation

Page 3: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Fitness Tracker

Page 4: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Embedded Gateway Cloud •  Embedded – Low Power device with sensors – Short range wireless

•  Gateway – Bridge between short and long range

•  Cloud – Access over Internet – Stores, aggregates, and provides data

Page 5: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Challenges •  Writing code in several languages (Server,

Mobile, Web, etc.) •  Dealing with networking asynchronicity •  Hard to quickly prototype or iterate ideas

Page 6: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

fabryq •  Platform to allow rapid prototyping of

applications for new low-power connected devices

•  Allows JavaScript web apps to communicate with smart devices via Bluetooth Low Energy (BLE)

Page 7: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Bluetooth Low Energy •  Low power short-range

protocol •  Widespread support •  Growing number of devices

Page 8: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

BLE Basics •  Variables arranged in a table

(GATT) •  Organized by services and

characteristics •  Accessed using commands – SET (Write) – GET (Read) – NOTIFY (Read on change)

•  “Star” network topology

Page 9: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

App Development •  BLE devices and

apps must be registered with fabryq before use

•  Applications specify necessary devices

Page 10: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

App Development

Run Applicationin web browser or

on phone

Define application!What kind of devices?

B DRegister devices!by demonstration

A

Write Fabryq.js Code

C

Page 11: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Example Application

Page 12: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Example Application

Page 13: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Overview

fabryq  Gateway  

BLE  

BLE  Devices  

fabryq  

fabryq  API  

fabryq  Server  

TCP/IP  

fabryq-­‐enabled  app  

Page 14: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Fabryq - Commands

fabryq-­‐enabled  app  

fabryq  Gateway  

fabryq  API  

fabryq  Server  

BLE  

TCP/IP  

BLE  Devices  

fabryq  Get  HR  HR  =  70  

Page 15: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Gateway •  Hardware that enables a device to act

as a bridge between BLE and the Internet

•  Fabryq currently supports iOS and OSX gateways

Page 16: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

fabryq Gateway Features •  Allows users to manage associated devices •  Display custom user interfaces

Page 17: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Gateway Challenges •  Backgrounding •  Device identification/management •  Power usage tradeoff

Page 18: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Server •  Stores, aggregates, and provides data •  Supports long-running apps (Agent) •  Manages – Commands – Users – Devices

•  Scaling can be challenging

Page 19: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

fabryq API Goals •  Make getting data as simple as possible •  Allow for flexibility in program structure •  Permit long running applications

Page 20: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

fabryq API Implementation •  Protocol proxy (GET, SET, NOTIFY) •  Receiving events – Command completion – System / error conditions

•  Spawning agents

Page 21: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Sporadic vs Continuous •  Two types of supported applications – Sporadic – Infrequent usage and

communication with device (i.e. light control) – Continuous monitoring – Application logic is

constantly running waiting to act on events (i.e. security system)

Page 22: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Feature Breakdown •  Sporadic – UI on gateway or Web

•  Continuous – Client UI launches/controlls agent application

running constantly in cloud – Agent can push notifications to user

Page 23: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Event Handling •  Tree-shaped event

and error handling structure

•  Supports both callback-based and Swing-like handling

Page 24: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

ID aliasing •  Hex parsing for

known devices •  Extensible json

format

Page 25: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Agents •  Agent support for long-running applications

Client  ApplicaAon  

Agent  ApplicaAon  

startAgent  messages  

commands  

Page 26: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Evaluations •  ufabryq hackathon •  Lightning hack sessions •  Class prototype

Page 27: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Example Apps

Page 28: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Home Monitor •  Easy to stream data

(~1s latency) •  Creating the rest of

app is time-consuming

Page 29: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

μfabryq •  All JavaScript

hardware prototyping

•  Based on BLE113 •  Arduino-like

Javascript commmands

Page 30: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

μfabryq •  Access to – GPIO – ADC – PWM –  Interrupts

•  Limited by latency and hardware

Page 31: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Page Served Indicator •  Easy to get running •  Easy to integrate

with existing services (JavaScript or REST)

Page 32: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

StepSense •  Easy integration into

new prototypes •  Makes it simple to

develop web applications for prototypes

Page 33: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Current Limitations •  Low latency not

guaranteed •  Rigid configuration •  iOS limitations – Backgrounding –  Identification

Page 34: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Future Work •  More gateway support •  Persistent connections •  Firmware integration / remote updates •  Longer-term studies

Page 35: The fabryq IoT prototyping platformiot.stanford.edu/seminar/sitp-w15-mcgrath.pdf · • Widespread support • Growing number of devices. BLE Basics • Variables arranged in a table

Thank You Will McGrath PhD Student Stanford CS

[email protected]