Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building an AWS IoT-Enabled Drink Dispenser - IOT328 - re:Invent 2017

1,876 views

Published on

Explore and build all the components of a complete connected device workflow. We start with constructing a physical drink dispenser from provided parts and connecting it to AWS IoT. Then we use Amazon Cognito, Amazon DynamoDB, AWS Lambda, Amazon API Gateway, and Amazon S3 to build a serverless application for secure device management and control of your dispenser. Learn how AWS IoT provides flexible communication with physical connected devices and integrates with other AWS services. Also learn how to incorporate a serverless application built with other AWS services to intuitively manage and control devices from a responsive web application. This workshop involves connections to the physical drink dispenser, so bring a laptop with administrative privileges and a working USB port, and have the AWS CLI loaded and configured for your AWS account (with administrative permissions). We provide the physical hardware, USB cable, and network connectivity.

Building an AWS IoT-Enabled Drink Dispenser - IOT328 - re:Invent 2017

  1. 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Building an AWS IoT-Enabled Drink Dispenser A n t o n S h m a g i n , A W S – P a r t n e r S o l u t i o n s A r c h i t e c t G a v i n A d a m s , A W S – S o l u t i o n s A r c h i t e c t I O T 3 2 8 N o v e m b e r 2 7 , 2 0 1 7
  2. 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop Checklist • Please refer to Getting Started sheet • Team up if missing a minimum requirement • AWS Staff • Gavin, Anton, Thomas, Rudy, Chris, and Tim
  3. 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop Objectives • Team Event • Get comfortable working with hardware • Understanding secure authentication and authorization to AWS IoT • Testing and debugging local code • Familiarity with serverless services for fully integrated IoT solutions
  4. 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Our Connected Dispenser + =
  5. 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Dispenser and system features • Dispenser features • Vend drink via air pump motor • Toggle LED • Connect to AWS IoT • System features • Web application for dispenser control • AuthN/AuthZ (scoped access) • Dispense to your device • Send credits to other “production” dispensers
  6. 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Services Used Dispenser AWS IoT Dispenser shadow User policy action: update Amazon Cognito Amazon API Gateway dispenser Status Amazon S3 DispenserApp Device policy setLed updateStats dispense $aws/shadow/# Web app addCredit dispenser Events
  7. 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Services Used Dispenser AWS IoT Dispenser shadow User policy action: update Amazon Cognito Amazon API Gateway dispenser Status Amazon S3 DispenserApp Device policy setLed updateStats dispense $aws/shadow/# Web app addCredit dispenser Events
  8. 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop Activities 1.Build the dispenser 2.Deploy code and test locally 3.Connect to AWS IoT and test remotely 4.Production setup of code 5.Log in and become familiar with the Web application 6.Send credits and share the love
  9. 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 1 – Build the dispenser • Build Enclosure • Power unit and verify LED active and button activates motor • Now load drink bottle • COMPLETED: Physically assembled
  10. 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 2 – Test locally • Configure serial connection and flash ESP32 with Mongoose OS app1 which enables local testing • Place cup under dispenser and press on-board button to dispense drink • Based on output, change timing in code, rebuild/deploy and test again • COMPLETED: drink properly dispensed • Tips • Have a cup under hose at all times – things can go wrong at this point • For this test, you can use the Mongoose OS browser UI to change the timing variables, then retest
  11. 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 3 – Configure and test remotely • From your zip file, move the certificate files to the Mongoose OS app2 directory • Update code with Wi-Fi credentials, build/deploy code • Log into AWS IoT Console and subscribe to shadow topics • Publish shadow update (dispense=DISPREQ) • Verify message echoed on serial debug port for device • Publish shadow update to clear request (dispense=null) • COMPLETED: Ability to publish message to dispenser and see result in device logs
  12. 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 4 – Production setup • Verify dispenser shadow attributes • Copy certificates to Mongoose OS app3 directory, update Wi-Fi, and deploy • Subscribe to device shadow • From AWS IoT Console publish shadow update to toggle the LED: • Desired state: led=on • Desired state: led=off • COMPLETED: “LED” commands executed and dispenser status update
  13. 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 5 – Log in to Web application • Enter username and password to log in to Web application • Verify your dispenser details and credit (should be $1.00) appear correctly and dispense button is green • Verify led status matches dispenser (toggle or set if needed) • Press the green ”Dispense” button and verify drink is dispensed, and the amount is debited by $1.00 • COMPLETED: Drink dispensed from application
  14. 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Activity 6 – Send credits & share the love • For other completed dispensers, enter the dispenser number and press the “Give Credit” button in the app • Verify they see their credit balance increase by $0.25 • Do this until then have a green dispense button and that it works • Walk around the room and buy the world a drink • COMPLETED: Credits given to another attendee’s dispenser
  15. 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Getting Started • Open your envelope! It contains: • Your unique dispenser ID • A unique short URL to a zip file containing: • Certificate, private key, rootCA • Mongoose OS application code for dispenser • AWS console login URL and credentials • Lab guide helpful links • Web application URL
  16. 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Getting Started • Cat... Parrot... Dog... What? • Checkpoints and stretch goals • For questions, collaboration is key • For additional assistance, ask any AWS staff in the room
  17. 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Let’s Get Started!
  18. 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Workshop Summary • What was covered • Working with IoT hardware • Building on AWS complete workloads • Behind the scenes to monitor and troubleshoot • Takeaways in the future • Be on the lookout: Connected Drink Dispenser
  19. 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you! P L E A S E R E M E M B E R T O F I L L O U T Y O U R S U R V E Y !

×