14
Lab 4: Connect to AWS IoT

Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Lab 4: Connect to AWS IoT

Page 2: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

STM32L475 Discovery IoT Node 21

Wi-Fi

STM32L475VG

User Button

Reset Button

User LEDs

ST-Link + VCP

ST-Link Status LED

Page 3: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Tera Term Configuration• First thing we need to configure Tera Term to communicate with ST-Link over the virtual com port. This will be used

to configure the application and get debug information.

1. Open Tera Term and Select the STMicroelectronics STLink Virtual COM Port and click OK,

2. Open Setup->Serial port…,

3. Set the Baud rate to 115200, 8 bit, Parity none, Stop 1 and Flow control none and click OK,

4. Open Setup->Terminal…,

5. Set New-Line Receive to AUTO,

6. Set New-Line Transmit to LF,

7. Enable Local echo,

8. Click OK.

22

2

3

7

1

65

4

Page 4: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Open AWS_HandsOn Project

• Now we are going to configure the AWS firmware program to set the

network SSID and password, set the AWS Certificates we just

created and establish IoT MQTT connection.

1. Close the previous IAR project.

2. Double click on file located under

C:\STM32IoTDKCloudSeminar\Hands_On\BLE_and_Cloud\Projects\B-L475E-

IOT01\Applications\Cloud\AWS\EWARM

23

Page 5: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Load and Run

1. Click the GREEN ARROW to Build the Project, Download and start the debugger. (Ctrl + D),

2. Click the triple-arrow GO button! (F5),

3. Select the Tera-Term window,

24

1

2

Page 6: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Wi-Fi Configuration1. Set your network SSID

2. Select your network security mode (Type 3 for the WPA2 Security mode)

3. Enter your network password

25

1

2

3

Page 7: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Set the Root-CA certificate1. Open the VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem in a

text editor,

2. Copy the certificate content (Ctrl + A, Ctrl + C),

3. Paste the certificate in Tera-Term (Click on the mouse right button. Do not use Ctrl + V) and click OK

4. Click Enter.

26

Page 8: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Set the Thing Certificate1. Open your xxxx-certificate.pem.crt in a text editor

2. Copy the certificate content (Ctrl +A, Ctrl + C),

3. Paste the certificate in Tera-Term (Click on the mouse right button. Do not use Ctrl + V) and click OK,

27

Page 9: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Set the Private Key1. Open your xxxx-private.pem.key in a text editor

2. Copy the certificate content (Ctrl +A, Ctrl + C)

3. Paste the certificate in Tera-Term (Click on the mouse right button. Do not use Ctrl + V) and click OK

28

Page 10: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Set the Server and Thing names

1. Copy the server address from the text file and paste it to Tera-Term then press Enter

2. Set your device name (The same as in slide 6).

29

Page 11: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Send data to AWS• The board will start sending sensor date once it is connected to AWS (every 10s for 10mn).

• Press the user button (the blue button) and the board send/receive LED messages to/from AWS IoT.

• The LED on your board will toggle every time the LED message is received.

30

User Button

User LEDs

Page 12: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Monitor Your Thing Activity1. Select the AWS Console on your browser,

2. Select Registry,

3. Select Things then select your Thing,

4. Click on Activity,

31

23

3

4

Page 13: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Interact With Your Thing

1. Select MQTT Client,

2. Under Publish type $aws/things/<your thing name>/shadow/update with xx being your participant number,

3. Clear any message and type {"state":{"desired":{"LED_value":"On"}}} as a message,

4. Click Publish to topic and watch your board’s LED,

5. Change the JSON message to turn your board LED On and Off {"state":{"desired":{"LED_value":"Off"}}}

32

1

2

3

4

Page 14: Lab 4: Connect to AWS IoT - Mouser Electronics · Open AWS_HandsOn Project • Now we are going to configure the AWS firmware program to set the network SSID and password, set the

Releasing Your Creativitywith the new STM32

33

www.st.com/stm32

/STM32

@ST_World

st.com/e2e