AWS IoT demonstration using the Avnet Shield (AT&T LTE) and the FRDM-K64F target board.
Dependencies: K64F_FATFileSystem
Fork of mbed-os-example-tls-tls-client by
Diff: README.md
- Revision:
- 21:56f91bdacff1
- Parent:
- 16:02008a2a2569
- Child:
- 24:224c07ec3bd0
diff -r ee34856ae510 -r 56f91bdacff1 README.md --- a/README.md Wed Dec 07 20:37:20 2016 +0000 +++ b/README.md Wed Dec 07 21:15:56 2016 +0000 @@ -1,4 +1,10 @@ -# AT&T Amazon Web Service Internet-of-Things demo +############################################################################################################# +Summary +############################################################################################################# +This demo uses the FRDM-K64F target hardware and the Avnet Shield M14A2A (using AT&T LTE network) to connect +to an Amazon Web Services IoT "thing" (device). The AWS IoT device Shadow will reflect the FRDM LED color +along with FRDM sensor data. The (optional) Python GUI can be used to reflect the Shadow information and +request LED color changes. ############################################################################################################# Resources @@ -27,28 +33,57 @@ 1) This quickstart assumes you've gone through the "Getting Started with MBED using FRDM-K64F" and that you can successfully drag-and-drop binaries to flash the FRDM-K64F device. + AT&T IoT Kit: 1) This quickstart assumes you've gone through the "Avnet IoT Kit quickstart" and your kits sim card has been activated and verified to work with the AT&T LTE network. + Amazon AWS IoT: 1) Create an AWS IoT thing using AWS IoT Console. Makes sure to get your 'thing' certificates. + MBED: 1) In the mbed ATT_AWS_IoT_demo project open "network_interface.h" and comment in the following: #define USING_AVNET_SHIELD // NOTE: Make sure you only comment in ONE Network Connection -2) In the mbed ATT_AWS_IoT_demo project open "aws_iot_config.h" and update the following to match your AWS - IoT 'thing': - #define AWS_IOT_MQTT_HOST - #define AWS_IOT_MQTT_CLIENT_ID - #define AWS_IOT_MY_THING_NAME +2a) Option a (default) - Use an SD card: + a) Format a MicroSD card to use a "FAT32" file system (https://www.sdcard.org/downloads/formatter_4/) + + b) Create a folder on the SD card root named 'certs' + + c) Copy your AWS things certs into this folder. Your file paths should look exactly like this: + /certs/rootCA-certificate.crt + /certs/certificate.pem.crt + /certs/private.pem.key + + d) Create a file in the 'certs' directory named 'mqtt_config.txt', and copy the template below into the file + fill in these parameters with your AWS IoT thing information (minus the brackets): + NOTE: Port is always 8883 (if not using web socket) +AWS_IOT_MQTT_HOST=[1234asdf.iot.us-west-2.amazonaws.com] +AWS_IOT_MQTT_PORT=8883 +AWS_IOT_MQTT_CLIENT_ID=[MyThingName] +AWS_IOT_MY_THING_NAME=[MyThingName] -3) In the mbed ATT_AWS_IoT_demo project open "certs.cpp" and update the following to match your AWS 'thing' - private key and IoT certificate. NOTE Make sure the string format matches the format of AWS_IOT_ROOT_CA - (which is pre-populated): - const unsigned char AWS_IOT_CERTIFICATE[] - const unsigned char AWS_IOT_PRIVATE_KEY[] + e) Place SD card into the FRDM-K64F MicroSD slot before powering it on. + + +2b) Option b - Hard code certs/key and MQTT config: + a) In the mbed ATT_AWS_IoT_demo project open "aws_iot_config.h" and comment out the following #define: + //#define USING_SD_CARD + + b) In the mbed ATT_AWS_IoT_demo project open "aws_iot_config.h" and update the following to match your AWS + IoT 'thing': + #define AWS_IOT_MQTT_HOST + #define AWS_IOT_MQTT_CLIENT_ID + #define AWS_IOT_MY_THING_NAME + + c) In the mbed ATT_AWS_IoT_demo project open "certs.cpp" and update the following to match your AWS 'thing' + private key and IoT certificate. NOTE Make sure the string format matches the format of AWS_IOT_ROOT_CA + (which is pre-populated): + const unsigned char AWS_IOT_CERTIFICATE[] + const unsigned char AWS_IOT_PRIVATE_KEY[] + Python GUI (optional): 1) The Python GUI "ATT_AWS_IoT_Demo_GUI.py" is used to communicate with the 'thing' device shadow, and can @@ -56,10 +91,21 @@ through the "Python AWS IoT Tutorial" to the point where you've installed Python 2.7.11 and the libraries required to run the script (paho-mqtt, AWSIoTPythonSDK). -2) In the ATT_AWS_IoT_Demo_GUI.py script search for the "AWS IoT Config Parameters" and update them so they - match the same 'thing' parameters as the mbed project. + + +2a) Option a (default) - Use an mqtt_config.txt file: + a) Use the same mqtt_config.txt file from MBED section above. + b) Place the file where Python looks for it: + AWS_MQTT_CONFIG_FILENAME = "C:/Temp/certs/mqtt_config.txt" -3) Place your 'thing' certificates into file locations where the Python script can find them. For example: +2b) Option b - Hard code the MQTT config: + a) In the ATT_AWS_IoT_Demo_GUI.py script search for the "AWS IoT Config Parameters" and update them so they + match the same 'thing' parameters as the mbed project. + + b) In the Python file change the following variable to TRUE: + hardCodeMQTT = True + +3) Place your 'thing' certificates into file locations where the Python looks for them. For example: AWS_IOT_ROOT_CA_FILENAME = "C:/Temp/certs/rootCA-certificate.crt" AWS_IOT_PRIVATE_KEY_FILENAME = "C:/Temp/certs/private.pem.key" AWS_IOT_CERTIFICATE_FILENAME = "C:/Temp/certs/certificate.pem.crt" @@ -69,4 +115,5 @@ 2) See the FRDM board get the shadow LED color. 3) Press the SW3 button on the FRDM board to cycle the LED color -> (Off R G B W) 4) Use the AWS IoT Console to "Update shadow" to set new 'desired' colors via -> (0 1 2 4 7) -5) Use the Python GUI buttons to request 'desired' colors. The GUI should also report the "AWS Reported LED Status" \ No newline at end of file +5) Use the Python GUI buttons to request 'desired' colors. The GUI should also report the "AWS Reported LED Status" +6) See the FRDM board report the Temperature and Humidity values. \ No newline at end of file