Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT...

14
January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. AT&T IoT Platforms Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting your AT&T IoT Starter Kit to the AWS IoT platform and setting it up for use with the AWS IoT Embedded C SDK. After following the steps in this guide the Starter Kit will be able to communicate with the AWS IoT platform wirelessly. For longer documents, include a link section or a table of contents at the top of the document using the Link Paragraph style and creating hyperlinks within the document: Lists and processes Table sample Image sample Alt text for CATO-compliant objects Prerequisites An AT&T IoT Starter Kit A MicroSD card Python 2.7.11 A Serial Console Program The ATT_AWS_IoT_demo binary for the FRDM-K64F, and the ATT_AWS_IoT_Demo_GUI.py. Both can be found in the mbed project. Tutorials For information about setting up your FRDM-K64F to accept mbed binaries, see the FRDM- K64F mbed page For information about setting up your Avnet Shield and SIM Card Activation, see the IoT Starter Kit Quickstart For information about setting up Python 2.7.11 for use with this demo see the AWS IoT SDK for Python page Connecting Your AT&T IoT Starter Kit The rest of this tutorial assumes you have gone through the tutorials above to the point where you can: Successfully drag-and-drop binary files to flash the FRMD-K64F target. Successfully connect to the AT&T LTE network with the provided SIM card.

Transcript of Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT...

Page 1: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property.

AT&T IoT Platforms

Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS

This guide provides step-by-step instructions for connecting your AT&T IoT Starter Kit to the AWS IoT platform and setting it up for use with the AWS IoT Embedded C SDK. After following the steps in this guide the Starter Kit will be able to communicate with the AWS IoT platform wirelessly.

For longer documents, include a link section or a table of contents at the top of the document using the Link Paragraph style and creating hyperlinks within the document:

Lists and processes Table sample Image sample Alt text for CATO-compliant objects

Prerequisites

An AT&T IoT Starter Kit

A MicroSD card

Python 2.7.11

A Serial Console Program

The ATT_AWS_IoT_demo binary for the FRDM-K64F, and the ATT_AWS_IoT_Demo_GUI.py.Both can be found in the mbed project.

Tutorials

For information about setting up your FRDM-K64F to accept mbed binaries, see the FRDM-K64F mbed page

For information about setting up your Avnet Shield and SIM Card Activation, see the IoTStarter Kit Quickstart

For information about setting up Python 2.7.11 for use with this demo see the AWS IoT SDKfor Python page

Connecting Your AT&T IoT Starter Kit

The rest of this tutorial assumes you have gone through the tutorials above to the point where

you can:

Successfully drag-and-drop binary files to flash the FRMD-K64F target.

Successfully connect to the AT&T LTE network with the provided SIM card.

Page 2: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 2

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Run a Python 2.7.11 based script on your PC.

Sign in to the AWS IoT Console

Sign in to the AWS Management Console and open the AWS IoT console at https://aws.amazon.com/iot. On the Welcome page, choose Get started with AWS IoT.

If this is your first time using the AWS IoT console, you will see two buttons: Get Started and Start interactive tutorial.

Page 3: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 3

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Choose Get Started. The following page should appear.

If you don't see a blue banner with Create a thing, Create a rule, Create a certificate, and Create a policy buttons, choose the Create a resource button:

Page 4: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 4

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Create and Attach a Thing (Device)

A thing represents a device whose status or data is stored in the AWS IoT cloud. The Thing Shadows service maintains a thing shadow for each device connected to AWS IoT. Thing shadows allow you to access and modify thing state data.

Choose Create a thing. Type a name for the thing, for example “ATT_IoT_Kit”, and then choose Create:

Page 5: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 5

AT&T IoT Platforms IoT Starter Kit Powered by AWS

In addition to a confirmation message, the View thing button will be displayed:

Choose View thing to display information about your thing:

Choose the Connect a device button to download a key pair and a certificate generated by AWS IoT.

Page 6: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 6

AT&T IoT Platforms IoT Starter Kit Powered by AWS

On the Connect a device page, select the Embedded C SDK to use, and then choose Generate certificate and policy:

This will generate an X.509 certificate and key pair; activate the X.509 certificate; and create an AWS IoT policy and attach it to the certificate.

The following page will be displayed:

Create a directory called C:\Temp\certs where these files will be stored. Click the links to download your public and private keys and certificate and save them in the C:\Temp\certs directory. Rename the private key and certificate to match the generic names below. These are the name/paths the Python demo script will look for by default.

Page 7: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 7

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Create an MQTT Config Text File

Choose Confirm & start connecting. The following page will be displayed:

In the C:\Temp\certs create a file named mqtt_config.txt. With the information from the

screen above fill in these MQTT parameters in the text file.

AWS_IOT_MQTT_HOST=[TODO]

AWS_IOT_MQTT_PORT=8883

AWS_IOT_MQTT_CLIENT_ID=[TODO]

AWS_IOT_MY_THING_NAME=[TODO]

For example:

Page 8: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 8

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Download a root CA certificate here. Copy the root CA into the C:\Temp\certs folder, and then

name it rootCA-certificate.crt. At this point the C:\Temp\certs folder should look like this.

Copy Certificates and Private Key to MicroSD

Format a MicroSD card to use the Fat32 file system. This can be done with a tool like SD Card

Formatter. Copy the C:\Temp\certs folder from above to the root directory on the SD card.

Page 9: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 9

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Build the AT&T AWS IoT Demo Binary from mbed

In order to run the demo on the AT&T IoT Starter Kit you need to build the demo binary and

flash the binary onto the FRDM-K64F target. To get started open the ATT_AWS_IoT_demo

project page.

Click Import into Compiler which should take you to your mbed compiler page.

Now click Compile. This should download the ATT_AWS_IoT_demo_K64F.bin (binary) file into

your Downloads folder on your PC.

Page 10: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 10

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Plug in the power for your AT&T IoT Kit (both the Shield and the FRDM). An MBED window should open. Open the Serial Console Program (of your choice) and connect to the MBED virtual USB COM port (115200/None/8/1). This example uses RealTerm.

Page 11: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 11

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Drag-and-drop the ATT_AWS_IoT_demo_K64F.bin into the MBED window to flash the FRDM board.

Page 12: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 12

AT&T IoT Platforms IoT Starter Kit Powered by AWS

The console should reflect that the Starter Kit has connected to Amazon and is syncing with the device Shadow.

Setup your PC to run the Python GUI

Before you can use the Python GUI you must have Python setup on your PC. Install Python 2.7.11 from here.

Next open a command shell and use pip to install the Paho MQTT Python client library.

Page 13: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 13

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Now use pip to install the AWS IoT Python SDK.

Run the Python GUI

From the same mbed project the binary was built from right click the ATT_AWS_IoT_Demo_GUI.py file and choose Export File… and this will download the Python script to your PC.

Page 14: Getting Started with AWS IoT on the AT&T IoT …...Getting Started with AWS IoT on the AT&T IoT Starter Kit Powered by AWS This guide provides step-by-step instructions for connecting

January 16, 2017 © 2016 AT&T Intellectual Property. All rights reserved. AT&T and the Globe logo are registered trademarks of AT&T Intellectual Property. Page 14

AT&T IoT Platforms IoT Starter Kit Powered by AWS

Now you can open the Python file which should open the AT&T AWS IoT Demo GUI. If the Starter Kit is powered on and connected to Amazon the reported values should update every 3 seconds. You can use the button at the bottom to request new LED colors, and within 3 seconds the RGB LED on the Starter Kit should respond.