SlideShare a Scribd company logo
1 of 44
Download to read offline
Full Stack Meat Project
‘GrillLog’
Kevin Kazmierczak
What are we talking about?
Creating a custom built dual probe BBQ
thermometer instead of buying one
Motivation
● Learn Arduino and basic electronics
● Be able to see grill temperatures on my devices
● Get notified when it was ready
● Learn AWS
● I thought it’d be similar in cost...
About Me
● http://www.kevinkaz.com
● @kazmiekr
● Solutions Architect for Universal Mind
● Two Alexa skills published
○ TechBuzz - MBTA Alerts
● 4 Apple Apps - Download them!
Taptronome FuelMate Battle Pet
Galaxy
MadBombz
Demo
Version 1
● Built using Parse :(
● Wifi using ESP8266
● Old blog article
Overview
● Arduino
● AWS IoT
● Lambda
● DynamoDB
● API Gateway
● SNS
● Alexa
● iOS
● Web
● Android
Warning
I am not an expert in any of this. Please feel free to add additional
context or information as needed.
Architecture Overview
Arduino Basics
● 14 Digital I/O Pins ( 6 PWM )
● 6 Analog
● 5V
● Embedded code written in C/C++ as a ‘Sketch’
Arduino Yun
● Device details
○ Built in wifi
○ Two processors, traditional ATmega and AR9331 (Linux)
○ Linux processor handles all the more CPU intensive tasks ( wifi / data processing )
○ ATmega handles reading/writing outputs
● How does it compare to others?
● Could you replace this with a RPi?
Fritzing Circuit Diagram
Learn more about Fritzing
GrillLog Implementation
● Every 10 seconds the device reads two
analog inputs
● Using a Steinhart–Hart equation, it
converts the analog resistance to
temperature
● Equation coefficients calibrated by
taking 3 different temperatures and
plugged into an online calculator
● Current readings are dumped to Serial
and the LCD display
AWS Fine Print
● Sign up for a free tier trial account
● One year of free tier account services
● Some of the core services have very generous free limits even
without a trial account
● Pay for what you use
● Security
○ Ensure that there are roles setup that have access to execute the pieces of the
different services
AWS IoT
● Allows device to communicate over MQTT with encrypted traffic
● MQTT - Lightweight messaging protocol, think JMS or Pub/Sub
● Each device gets a signed certificate to use with messaging
● Devices can have shadows for offline sync
● Compatible devices - Anything that can do secure MQTT
● Use command line mosquitto to simulate device messaging
AWS IoT
AWS IoT Rules
● Rules can filter messages into different channels
● SQL query like syntax to set them up
● Use built in actions
● Lambda is most flexible action
GrillLog Implementation
● Yun has certificates installed
● Yun constructs JSON document of
temps
● Yun posts message on ‘templogs’ topic
● AWS has a rule that all incoming
‘templog’ messages are forwarded to a
lambda function
● Tweaked AWS config to solve memory
issues
AWS Lambda
● Runs code in response to events
● Pay for what you consume
● Develop in Javascript/Java/Python
● No servers to manage or scale
● Core service used to integrate across AWS
● Pricing
○ First 1 million requests per month are free
○ $0.20 per 1 million requests thereafter ($0.0000002 per request)
Lamba Basics
● Can start from one of their many templates
○ Language specific
○ Voice templates
○ Microservices
○ Hello world
● Export a ‘handler’ that takes and event, context, callback
● Do whatever
exports.handler = function(event, context, callback) {
console.log("value1 = " + event.key1);
console.log("value2 = " + event.key2);
callback(null, "some success message");
// or
// callback("some error type");
}
GrillLog Implementation
● Three lambda functions
○ Handle incoming IoT messages
○ Handle web requests
○ Handle voice requests
● All three lambdas just forward
into a custom
controller/service layer written
in Node.js
Custom Service Layer
● AWS supports Node 4.3 (finally!!!)
○ ES2016 (ES6) features
■ Promises/arrow functions/etc - check for support before using
● Controller processes input and utilizes services needed
○ Could swap out service implementations later if needed
● Promise based - AWS sdk methods can return a promise
● Easy to test via command line locally
● Use any packages you need via npm
● Service layer gets packaged with lambda
GrillLog Implementation
● Utilizes the aws-sdk package
● Deployed via shell script
○ Creates a zip file of required files
○ Calls AWS specific CLI tooling
○ Cleans up
● Uploads a zip per each lambda
endpoint
AWS DynamoDB
● NoSQL database similar to MongoDB
○ Schema-less
● Event driven hooks
● Easy to save data, not as easy to query
● Integration with other AWS services with streams/triggers
● Pricing
○ 25 GB in free tier, pay per usage
○ “For a little less than $0.25/day ($7.50/month), you could support an application
that performs 1 million writes and reads per day”
DynamoDB Basics
● Each table has a primary key (hash key) - Most unique
● Optional sort key - What will I most likely sort on?
● Get data out via either a ‘scan’ or ‘query’
○ ‘query’ requires primary key then you add filter criteria
● Indexes are required to speed up queries
● Sorting is tricky
● No date datatype, have to use a timestamp number
● Save whatever!
GrillLog Implementation
● Contains 3 tables
○ DeviceStatus
■ Current status information per device
○ TempLogs
■ Raw temp data from device
○ CookLogs
■ Archived cook data
AWS SNS - Simple Notification Service
● Pub-sub messaging
● Deliver across multiple protocols
○ iOS/Android
○ Email
○ SMS
● Hooks into other services
● Pricing
○ Your first 1 million push requests are free
○ $0.50 per 1 million Amazon SNS requests thereafter.
SNS Basics
● Create platform application
○ Need certificates to handle push integration with Apple/Google
● Devices can register to application with token
● Messages can be sent to the endpoints registered
● Raw or JSON
● Can tie multiple endpoints together via subscriptions
○ Topic could post to email and push together
● Push messages via AWS dashboard
GrillLog Implementation
● Devices are manually registered with
device token on dashboard
● Application endpoint created with
Apple push certificates from iTunes
provisioning portal
● Custom services push JSON formatted
messages for Apple devices
AWS API Gateway
● Deploy a customized API
● Define the resources that can be called
● SDK generation
● Authentication - keys, IAM, CORS
● Pricing
○ Free tier includes one million API calls per month for up to 12 months
○ $3.50 per million API calls received, plus the cost of data transfer out, in gigabytes.
API Gateway Basics
● You can create an API endpoint from the lambda ‘API endpoints’ tab
● Create resources as endpoints like
○ /status or /logs
● Add methods to those resources
○ GET/POST/PUT
● Point those endpoints to a lambda or proxy
● Configure the mappings - How will data pass through
● Customize as needed
● Create multiple ‘stages’ that you can deploy to
GrillLog Implementation
● Exposes REST endpoints
○ status/logs/startgrill/startcook/endgrill
● CORS enabled on status/logs for web
● Mobile clients handle state movement
● Entire request information is
forwarded to a lambda
● Lambda determines what the URL
should do and call proper controller
method in custom services
Alexa Integration
● Registered skill on amazon developer site
● Forward to lambda or custom deployed services (HTTPS)
● Register intents ( voice input formats )
● Deploy to app store - Requires approval
○ They are VERY strict that you follow the guidelines
○ You could get a free t-shirt
● Test on developer site
○ Lets you hear responses and see source JSON
● Detailed skill creation walkthrough
Alexa Skill Configuration
UtterancesIntents
GrillLog Implementation
● Registered skill forwarding to lambda
● Simple ‘what’s the status’ intent
● Calls into custom services to grab
current status
● Converts response into a text string
passed back to voice services
Logging
● Configure services to write CloudWatch logs
● Add alerts if needed
iOS Application
● Apple developer account - $99
○ Be able to deploy to devices and provision
● Configured app in iTunes connect
● Generate APNS certs imported to SNS
● Written in Swift
● Polls for temp status every 10 sec
● Regenerates chart every 30 sec
● Uses ‘Charts’ project for charting
● Sends push notifications
○ Warm temperature threshold
○ Food temperature
● Background fetch to detect offline situations
Web Application
● Deployed on http://grilllog.kevinkaz.com
● Written in ES2016 transpiled in webpack
● Uses D3 to handle charting
● Uses a fetch polyfill
● Styling done in Less
Android Application
● Written by coworker, Chris Scott
● Mortar and Flow for view lifecycles
● Dagger for dependency injection
● RxJava and Retrofit for service integration
Future Plans
● PID Controller for fan controlled temperature
control
● Apple Watch Complication
● Waterproof case
● More notifications
● Review past cooks
● Archive condensed logs
Questions

More Related Content

What's hot

Ibm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinalIbm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinal
aspyker
 
Netflix0SS Services on Docker
Netflix0SS Services on DockerNetflix0SS Services on Docker
Netflix0SS Services on Docker
Docker, Inc.
 

What's hot (20)

Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015
 
AWS temporary credentials challenges in prevention detection mitigation
AWS temporary credentials   challenges in prevention detection mitigationAWS temporary credentials   challenges in prevention detection mitigation
AWS temporary credentials challenges in prevention detection mitigation
 
NetflixOSS Meetup S6E2 - Spinnaker, Kayenta
NetflixOSS Meetup S6E2 - Spinnaker, KayentaNetflixOSS Meetup S6E2 - Spinnaker, Kayenta
NetflixOSS Meetup S6E2 - Spinnaker, Kayenta
 
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
Part 3 of the REAL Webinars on Oracle Cloud Native Application Development (J...
 
NetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & ContainersNetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & Containers
 
Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...Building a Serverless company with Node.js, React and the Serverless Framewor...
Building a Serverless company with Node.js, React and the Serverless Framewor...
 
REAL Expert Alliance OCI series part 4 - OKE
REAL Expert Alliance OCI series part 4 - OKEREAL Expert Alliance OCI series part 4 - OKE
REAL Expert Alliance OCI series part 4 - OKE
 
End-to-end test automation with Endtest.dev
End-to-end test automation with Endtest.devEnd-to-end test automation with Endtest.dev
End-to-end test automation with Endtest.dev
 
CMP376 - Another Week, Another Million Containers on Amazon EC2
CMP376 - Another Week, Another Million Containers on Amazon EC2CMP376 - Another Week, Another Million Containers on Amazon EC2
CMP376 - Another Week, Another Million Containers on Amazon EC2
 
Netflix oss season 1 episode 3
Netflix oss season 1 episode 3 Netflix oss season 1 episode 3
Netflix oss season 1 episode 3
 
Ibm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinalIbm cloud nativenetflixossfinal
Ibm cloud nativenetflixossfinal
 
CS80A Foothill College Open Source Talk
CS80A Foothill College Open Source TalkCS80A Foothill College Open Source Talk
CS80A Foothill College Open Source Talk
 
Netflix OSS Meetup Season 5 Episode 1
Netflix OSS Meetup Season 5 Episode 1Netflix OSS Meetup Season 5 Episode 1
Netflix OSS Meetup Season 5 Episode 1
 
Icinga Camp Kuala Lumpur 2015 Opening By Eric Lippmann
Icinga Camp Kuala Lumpur 2015 Opening By Eric LippmannIcinga Camp Kuala Lumpur 2015 Opening By Eric Lippmann
Icinga Camp Kuala Lumpur 2015 Opening By Eric Lippmann
 
DCEU 18: From Monolith to Microservices
DCEU 18: From Monolith to MicroservicesDCEU 18: From Monolith to Microservices
DCEU 18: From Monolith to Microservices
 
Netflix0SS Services on Docker
Netflix0SS Services on DockerNetflix0SS Services on Docker
Netflix0SS Services on Docker
 
Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool Terrascan - Cloud Native Security Tool
Terrascan - Cloud Native Security Tool
 
Netflix Open Source: Building a Distributed and Automated Open Source Program
Netflix Open Source:  Building a Distributed and Automated Open Source ProgramNetflix Open Source:  Building a Distributed and Automated Open Source Program
Netflix Open Source: Building a Distributed and Automated Open Source Program
 
NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1NetflixOSS Meetup season 3 episode 1
NetflixOSS Meetup season 3 episode 1
 
Serverless Architectures
Serverless ArchitecturesServerless Architectures
Serverless Architectures
 

Similar to Full Stack Meat Project with Arduino Node AWS Mobile

AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
Luciano Mammino
 
Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developers
Ciklum Ukraine
 

Similar to Full Stack Meat Project with Arduino Node AWS Mobile (20)

Low Cost AWS Services For Application Development in the Cloud
Low Cost AWS Services For Application Development in the CloudLow Cost AWS Services For Application Development in the Cloud
Low Cost AWS Services For Application Development in the Cloud
 
Write less (code) and build more with serverless
Write less (code) and build more with serverlessWrite less (code) and build more with serverless
Write less (code) and build more with serverless
 
AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
 
AWS Bulgaria: Re:invent 2017 Recap
AWS Bulgaria: Re:invent 2017 RecapAWS Bulgaria: Re:invent 2017 Recap
AWS Bulgaria: Re:invent 2017 Recap
 
Architecting applications on amazon web services with node.js
Architecting applications on amazon web services with node.jsArchitecting applications on amazon web services with node.js
Architecting applications on amazon web services with node.js
 
AWS Developer Ecosystem.pdf
AWS Developer Ecosystem.pdfAWS Developer Ecosystem.pdf
AWS Developer Ecosystem.pdf
 
Spring 21 Salesforce Release Webinar
Spring 21 Salesforce Release WebinarSpring 21 Salesforce Release Webinar
Spring 21 Salesforce Release Webinar
 
Introduction to amazon web services for developers
Introduction to amazon web services for developersIntroduction to amazon web services for developers
Introduction to amazon web services for developers
 
Lessons learned after a year of lambda - AWS Community Day SF 2017
Lessons learned after a year of lambda - AWS Community Day SF 2017Lessons learned after a year of lambda - AWS Community Day SF 2017
Lessons learned after a year of lambda - AWS Community Day SF 2017
 
What is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 DepokWhat is Google Cloud Platform - GDG DevFest 18 Depok
What is Google Cloud Platform - GDG DevFest 18 Depok
 
State of serverless
State of serverlessState of serverless
State of serverless
 
Crio.do - Deployment on AWS Masterclass
Crio.do - Deployment on AWS MasterclassCrio.do - Deployment on AWS Masterclass
Crio.do - Deployment on AWS Masterclass
 
PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
 
Lamba scaffold webinar
Lamba scaffold webinarLamba scaffold webinar
Lamba scaffold webinar
 
Serverless Computing with AWS
Serverless Computing with AWSServerless Computing with AWS
Serverless Computing with AWS
 
AWS IoT Edge Management
AWS IoT Edge ManagementAWS IoT Edge Management
AWS IoT Edge Management
 
AWS Lambda and Serverless Cloud
AWS Lambda and Serverless CloudAWS Lambda and Serverless Cloud
AWS Lambda and Serverless Cloud
 
ITV& Bashton
ITV& Bashton ITV& Bashton
ITV& Bashton
 
Monkey Server
Monkey ServerMonkey Server
Monkey Server
 

Recently uploaded

Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
drm1699
 

Recently uploaded (20)

Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
Abortion Pill Prices Jozini ](+27832195400*)[ 🏥 Women's Abortion Clinic in Jo...
 
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
CERVED e Neo4j su una nuvola, migrazione ed evoluzione di un grafo mission cr...
 
Rapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and InsightsRapidoform for Modern Form Building and Insights
Rapidoform for Modern Form Building and Insights
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
 
Software Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements EngineeringSoftware Engineering - Introduction + Process Models + Requirements Engineering
Software Engineering - Introduction + Process Models + Requirements Engineering
 
The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)The mythical technical debt. (Brooke, please, forgive me)
The mythical technical debt. (Brooke, please, forgive me)
 
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
Abortion Clinic In Pretoria ](+27832195400*)[ 🏥 Safe Abortion Pills in Pretor...
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
Abortion Clinic Pretoria ](+27832195400*)[ Abortion Clinic Near Me ● Abortion...
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphGraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 

Full Stack Meat Project with Arduino Node AWS Mobile

  • 1. Full Stack Meat Project ‘GrillLog’ Kevin Kazmierczak
  • 2. What are we talking about? Creating a custom built dual probe BBQ thermometer instead of buying one
  • 3. Motivation ● Learn Arduino and basic electronics ● Be able to see grill temperatures on my devices ● Get notified when it was ready ● Learn AWS ● I thought it’d be similar in cost...
  • 4. About Me ● http://www.kevinkaz.com ● @kazmiekr ● Solutions Architect for Universal Mind ● Two Alexa skills published ○ TechBuzz - MBTA Alerts ● 4 Apple Apps - Download them! Taptronome FuelMate Battle Pet Galaxy MadBombz
  • 6.
  • 7.
  • 8. Version 1 ● Built using Parse :( ● Wifi using ESP8266 ● Old blog article
  • 9. Overview ● Arduino ● AWS IoT ● Lambda ● DynamoDB ● API Gateway ● SNS ● Alexa ● iOS ● Web ● Android
  • 10. Warning I am not an expert in any of this. Please feel free to add additional context or information as needed.
  • 12. Arduino Basics ● 14 Digital I/O Pins ( 6 PWM ) ● 6 Analog ● 5V ● Embedded code written in C/C++ as a ‘Sketch’
  • 13. Arduino Yun ● Device details ○ Built in wifi ○ Two processors, traditional ATmega and AR9331 (Linux) ○ Linux processor handles all the more CPU intensive tasks ( wifi / data processing ) ○ ATmega handles reading/writing outputs ● How does it compare to others? ● Could you replace this with a RPi?
  • 14. Fritzing Circuit Diagram Learn more about Fritzing
  • 15. GrillLog Implementation ● Every 10 seconds the device reads two analog inputs ● Using a Steinhart–Hart equation, it converts the analog resistance to temperature ● Equation coefficients calibrated by taking 3 different temperatures and plugged into an online calculator ● Current readings are dumped to Serial and the LCD display
  • 16.
  • 17. AWS Fine Print ● Sign up for a free tier trial account ● One year of free tier account services ● Some of the core services have very generous free limits even without a trial account ● Pay for what you use ● Security ○ Ensure that there are roles setup that have access to execute the pieces of the different services
  • 18. AWS IoT ● Allows device to communicate over MQTT with encrypted traffic ● MQTT - Lightweight messaging protocol, think JMS or Pub/Sub ● Each device gets a signed certificate to use with messaging ● Devices can have shadows for offline sync ● Compatible devices - Anything that can do secure MQTT ● Use command line mosquitto to simulate device messaging
  • 20. AWS IoT Rules ● Rules can filter messages into different channels ● SQL query like syntax to set them up ● Use built in actions ● Lambda is most flexible action
  • 21. GrillLog Implementation ● Yun has certificates installed ● Yun constructs JSON document of temps ● Yun posts message on ‘templogs’ topic ● AWS has a rule that all incoming ‘templog’ messages are forwarded to a lambda function ● Tweaked AWS config to solve memory issues
  • 22. AWS Lambda ● Runs code in response to events ● Pay for what you consume ● Develop in Javascript/Java/Python ● No servers to manage or scale ● Core service used to integrate across AWS ● Pricing ○ First 1 million requests per month are free ○ $0.20 per 1 million requests thereafter ($0.0000002 per request)
  • 23. Lamba Basics ● Can start from one of their many templates ○ Language specific ○ Voice templates ○ Microservices ○ Hello world ● Export a ‘handler’ that takes and event, context, callback ● Do whatever exports.handler = function(event, context, callback) { console.log("value1 = " + event.key1); console.log("value2 = " + event.key2); callback(null, "some success message"); // or // callback("some error type"); }
  • 24. GrillLog Implementation ● Three lambda functions ○ Handle incoming IoT messages ○ Handle web requests ○ Handle voice requests ● All three lambdas just forward into a custom controller/service layer written in Node.js
  • 25. Custom Service Layer ● AWS supports Node 4.3 (finally!!!) ○ ES2016 (ES6) features ■ Promises/arrow functions/etc - check for support before using ● Controller processes input and utilizes services needed ○ Could swap out service implementations later if needed ● Promise based - AWS sdk methods can return a promise ● Easy to test via command line locally ● Use any packages you need via npm ● Service layer gets packaged with lambda
  • 26. GrillLog Implementation ● Utilizes the aws-sdk package ● Deployed via shell script ○ Creates a zip file of required files ○ Calls AWS specific CLI tooling ○ Cleans up ● Uploads a zip per each lambda endpoint
  • 27. AWS DynamoDB ● NoSQL database similar to MongoDB ○ Schema-less ● Event driven hooks ● Easy to save data, not as easy to query ● Integration with other AWS services with streams/triggers ● Pricing ○ 25 GB in free tier, pay per usage ○ “For a little less than $0.25/day ($7.50/month), you could support an application that performs 1 million writes and reads per day”
  • 28. DynamoDB Basics ● Each table has a primary key (hash key) - Most unique ● Optional sort key - What will I most likely sort on? ● Get data out via either a ‘scan’ or ‘query’ ○ ‘query’ requires primary key then you add filter criteria ● Indexes are required to speed up queries ● Sorting is tricky ● No date datatype, have to use a timestamp number ● Save whatever!
  • 29. GrillLog Implementation ● Contains 3 tables ○ DeviceStatus ■ Current status information per device ○ TempLogs ■ Raw temp data from device ○ CookLogs ■ Archived cook data
  • 30. AWS SNS - Simple Notification Service ● Pub-sub messaging ● Deliver across multiple protocols ○ iOS/Android ○ Email ○ SMS ● Hooks into other services ● Pricing ○ Your first 1 million push requests are free ○ $0.50 per 1 million Amazon SNS requests thereafter.
  • 31. SNS Basics ● Create platform application ○ Need certificates to handle push integration with Apple/Google ● Devices can register to application with token ● Messages can be sent to the endpoints registered ● Raw or JSON ● Can tie multiple endpoints together via subscriptions ○ Topic could post to email and push together ● Push messages via AWS dashboard
  • 32. GrillLog Implementation ● Devices are manually registered with device token on dashboard ● Application endpoint created with Apple push certificates from iTunes provisioning portal ● Custom services push JSON formatted messages for Apple devices
  • 33. AWS API Gateway ● Deploy a customized API ● Define the resources that can be called ● SDK generation ● Authentication - keys, IAM, CORS ● Pricing ○ Free tier includes one million API calls per month for up to 12 months ○ $3.50 per million API calls received, plus the cost of data transfer out, in gigabytes.
  • 34. API Gateway Basics ● You can create an API endpoint from the lambda ‘API endpoints’ tab ● Create resources as endpoints like ○ /status or /logs ● Add methods to those resources ○ GET/POST/PUT ● Point those endpoints to a lambda or proxy ● Configure the mappings - How will data pass through ● Customize as needed ● Create multiple ‘stages’ that you can deploy to
  • 35. GrillLog Implementation ● Exposes REST endpoints ○ status/logs/startgrill/startcook/endgrill ● CORS enabled on status/logs for web ● Mobile clients handle state movement ● Entire request information is forwarded to a lambda ● Lambda determines what the URL should do and call proper controller method in custom services
  • 36. Alexa Integration ● Registered skill on amazon developer site ● Forward to lambda or custom deployed services (HTTPS) ● Register intents ( voice input formats ) ● Deploy to app store - Requires approval ○ They are VERY strict that you follow the guidelines ○ You could get a free t-shirt ● Test on developer site ○ Lets you hear responses and see source JSON ● Detailed skill creation walkthrough
  • 38. GrillLog Implementation ● Registered skill forwarding to lambda ● Simple ‘what’s the status’ intent ● Calls into custom services to grab current status ● Converts response into a text string passed back to voice services
  • 39. Logging ● Configure services to write CloudWatch logs ● Add alerts if needed
  • 40. iOS Application ● Apple developer account - $99 ○ Be able to deploy to devices and provision ● Configured app in iTunes connect ● Generate APNS certs imported to SNS ● Written in Swift ● Polls for temp status every 10 sec ● Regenerates chart every 30 sec ● Uses ‘Charts’ project for charting ● Sends push notifications ○ Warm temperature threshold ○ Food temperature ● Background fetch to detect offline situations
  • 41. Web Application ● Deployed on http://grilllog.kevinkaz.com ● Written in ES2016 transpiled in webpack ● Uses D3 to handle charting ● Uses a fetch polyfill ● Styling done in Less
  • 42. Android Application ● Written by coworker, Chris Scott ● Mortar and Flow for view lifecycles ● Dagger for dependency injection ● RxJava and Retrofit for service integration
  • 43. Future Plans ● PID Controller for fan controlled temperature control ● Apple Watch Complication ● Waterproof case ● More notifications ● Review past cooks ● Archive condensed logs