This is a presentation given at the Capital Saratoga Region AWS User Group on May 18, 2017 at The Troy Innovation Garage in Troy, NY.
Before diving into AWS IoT, we take a step back and talk about IoT from a high level overview. We discuss some of the common problems and challenges with IoT projects and then take a walk through AWS IoT and discuss its approach to solve some of those common challenges. We then connect an IoT Button to an AWS IoT project and demonstrate the basic components of building AWS IoT solutions.
3. Thanks to IoT, 90% of the data in
the world today, has been created
in the past 4 years (as of 2017).
4. Not "One Size Fits All"
Internet of Things (IoT) is a sprawling
set of technologies and use cases that
has no clear, single definition.
Overview of Internet of Things
https://cloud.google.com/solutions/iot-overview
5. The Things
• Sensors
• Temperature, humidity, telemetry, acceleration,
altitude, light, flow rates, etc.
• Actuators
• Switches, flow control valves (water, gas, oil), door
locks, thermostats, cameras, robotics, embedded
controls, etc.
6. Iot Use Cases
• Smart Metering - Water, Gas, consumption
• Manufacturing - Assembly line predictive
maintenance
• Asset Tracking - From office and IT to cargo units.
• Autonomous Driving
• Fleet Management
7. IoT Use Cases
• Smart Farming
• Health and Fitness (FitBit, Watch, Running gear)
• Home Appliances
• Pest Control
• Public Trash Collection Efficiences
8. Lots of Things
It's expected that by 2020 there
will be somewhere around 50
billion connected IoT devices.
9. Back to The Things
• Sensors
• Temperature, humidity, telemetry, acceleration,
altitude, light, flow, etc.
• Actuators
• Switches, flow control valves (water, gas, oil), door
locks, thermostats, cameras, robotics, embedded
controls, etc.
10. Challenges of IoT
• Connectivity
• Battery Life (external power)
• Processing Power
• Security
• Cost (projects might require lots of sensors)
11. IoT Connectivity
• RFID (Radio-frequency identification)
• NFC (Near-Field Communications)
• Bluetooth
• Wifi
12. IoT Connectivity
Specifications RFID NFC Bluetooth wifi
Range 3meter 10cm 100meter 100meter
Communication 1-way 2-way 2-way 2-way
Data rate varies 106,212,424Kbps 22Mbps 144Mbps
Applications
EZ-pass,
SpeedPass
warehouse tracking,
cargo, crates, etc.
ApplePay,
GooglePay, etc
Laptop, phone and
peripherals
wireless
internet
13. IoT Connectivity
But there is more...
• Dash7 (multi year battery life, 0-5km)
• IEEE P802.11ah (low power Wi-Fi)
• nWave (10-30km!)
• Zigbee (low power, wireless, 10-100m los)
• Z-Wave (powered, used primarily hvac)
• TSMP (Time synchronized Mesh)
15. IoT Connectivity
The best connectivity solution for an IoT use case in
terms of power and resources will very often be a
"sometimes" connected strategy.
If that is the case, how do we programmatically
interact with an IoT device when it is usually offline or
disconnected?
16. Back to The Things
• Sensors
• Temperature, humidity, telemetry, acceleration,
altitude, light, flow, etc.
• Actuators
• Switches, flow control valves (water, gas, oil), door
locks, thermostats, cameras, robotics, embedded
controls, etc.
18. IoT Data Protocols
• MQTT (Message Queueing Telemetry Transport)
• CoAP (Constrained Application Protocol)
• XMPP (Extensible Messaging and Presence Protocol)
• DDS (Data-Distribution Service for Real-Time Systems)
• LLAP (lightweight local automation protocol)
• AMQP (Advanced Message Queue Protocol)
• LWM2M (Lightweight M2M)
• SSI (Simple Sensor Interface)
• Reactive Stream
• Many many custom JavaScript / Node.js
19. IoT Data Protocols
Just like there are many connectivity solutions, there are
many data protocol solutions.
20. IoT Data Protocols
• MQTT Strengths
• Publish/Subscribe model scales well
• Flexible subscription topics
• MQTT Weakness
• Central Broker
21. IoT Data Protocols
• CoAP Strengths
• Runs over UDP, which while less reliable than
TCP, can offer quicker "wake up and send"
bursts.
• CoAP Weakness
• Request/Report one to one interaction
28. MQTT Topics
Pub/Sub over topics (i.e. channels)
sensors/COMPUTER_NAME/temperature/HARDDRIVE_NAME
iotbuttons/ABC
iotbuttons/+
home/first_floor/living_room/bulb1/brightness
home/first_floor/kitchen/bulb2/brightness
home/first_floor/kitchen/temperature/
home/second_floor/master/bulbABC/brightness
home/first_floor/+/temperature (temperature of all rooms on first floor)
29. MQTT Payload
Each MQTT contains a Payload
• MQTT Payload is data agnostic
• Payload can be images, text, any encoding,
encrypted or not.
• Generally Json text:
{ temperature: 72, pressure_value:1013.2,
pressure_type: mbar }
35. AWS IoT Button Example
• Register a Thing
• Note its ARN, and Endpoint
• Create and download Certificate
• Create a Policy, and attach to Cert
• Subscribe a Test listner
• Configure IoT Button and Test it.
• Create a Rule to send SMS on Click
36. AWS IoT HTTPS Example
curl --tlsv1.2 --cacert root-CA.crt --cert
certificate.pem.crt --key private.pem.key -X POST -
d "{ "serialNumber": "ABC", "clickType":
"SINGLE", "batteryVoltage": "2000mV" }" "https:/
<your end point>.iot.us-east-1.amazonaws.com:
8443/topics/iotbutton/ABC?qos=1"
37. AWS IoT Node.js SDK
var awsIot = require('aws-iot-device-sdk');
var device = awsIot.device({
keyPath: "./certs/3fdf14d588-private.pem.key",
certPath: "./certs/3fdf14d588-certificate.pem.crt",
caPath: "./certs/root-CA.crt",
clientId: "NodePublisher1",
region: "us-east-1",
host: "<your end point>.iot.us-
east-1.amazonaws.com"
});
40. Closing Thoughts
• AWS IoT is a low-latency, scalable pub/sub service.
• A rules engine to connect devices with no code.
• Can pub/sub over WSS
• In a way, it is AWS’s only infinitely scalable WebSocket
service gateway into Lambda.
• But (there is always a but), its security model is complex
and cumbersome at best. Certs/SigV4. No built-in
Websocket security or ability to custom JWT AuthHeader
etc.
42. AWS Greengrass
•AWS Greengrass seamlessly extends AWS to devices so
they can act locally on the data they generate
•Respond to Local Events in Near Real-time
•Operate Offline
43. An Intro to AWS IoT
Scott Stewart
https://github.com/csr-aws-ug/aws_iot_intro