IoT on AWS and NodeMCU FOR LESS THAN 5 EUROS
June 2016
01
About Johann• Tech Evangelist @Stylight
• 15+ years in tech
• In Germany for 2 years
• 7 years in San Francisco doing startups
• Organizer of many meetups
2
Tweet me!
@romefort @StylightTech
What are you going to learn?
4
• Discover ESP8266/NodeMCU
• Introduction to AWS IoT
• Hands-on
• Connecting a NodeMCU board
• Configuring Arduino environment for NodeMCU
• Installing AWS SDK
• Publishing sensor data to AWS IoT
• Trigger rules to invoke Lambda function
ESP8266
5
• Cheap: $2
• Very low power consumption
• WIFI
• Deep-sleep mode
NodeMCU• Micro-usb for flashing
and power
• 3v - 5v: Support Arduino sensors
• Compatible Arduino/Lua
• CHEAP
6
You said CHEAP?
7
Why?
8
• Cheap is good in IoT because it scales
• But no direct support of AWS IoT because no TLS 1.2 module yet in ESP8266
• Hackers always find workarounds
If you just want to play around/prototype
9
Introduction to AWS IoT
10
• Serverless way to connect your IoT devices and start processing data
• Supports MQTT, HTTP
• Secure - communication through use of X.509 Certificates
• Can connect huge amount of sensors, store and process the data in real-time
AWS IoT Architecture
11source: http://docs.aws.amazon.com/iot/latest/developerguide/aws-iot-how-it-works.html
What’s a Thing?
12
• An IoT Device
• Sensors, actuators,
• In our case a NodeCMU board
What’s the Message Broker?
13
• Used to securely exchange messages following the publish-subscribe pattern, between IoT applications and Things.
• MQTT to publish/subscribe
• HTTP to publish
• Note: MQTT uses TLS 1.2 which is not available in NodeMCU
• Let’s use HTTP then!
What’s the Rule Engine?
14
• Used to process messages and talk to other AWS components like Lambda, DynamoDB, etc
• SQL-Based language to select specific messages to be passed along.
What are Thing Shadows?
15
• Devices sometimes go offline
• A Thing Shadow provide a persistent representation of a Thing
• A Thing can sync its state to its Thing Shadow through the REST API
AWS IoT Console
16
Hands-on!
June 2016
01
We are going to:
18
• Create a Thing in AWS IoT
• Publish sensor data from our NodeMCU to update our Thing Shadow
• Have a look at the MQTT Client
• Create a Rule to trigger a lambda when humidity is > 50%
• Publish the data to Slack
The Fritzing
19
Create a Thing
20
Open Serial Monitor
21
MQTT Client
22
Creating your Lambda
23
Configuring your Lambda
24
Write your Lambda
25
www.stylight.com