Connect to Azure IoT Hub using WizFi360 MQTT AT Command
#
Getting startedLogin to Azure Portal.
※ In this guide we will procedd with free account. To learn how to create IoT Hub please refer to Azure Cloud Service Introduction.
#
IntroductionIt is possible to connect to Microsoft Azure Service using WizFi360, send data to cloud and monitor current status.
Data communication will be established as following.
MQTT AT Commands will be used to connect to IoT Hub Service & send data.
Data sent to IoT Hub will be saved in Blob Storage through Stream Analytics.
In this guide we will use WizFi360 with Mbed to connect to Microsoft Azure Services using MQTT AT Command.
#
Step 1: Required itemsItems below are required for this guide.
#
HadrwareDesktop or Laptop Computer
Mini USB Cable
#
Software- Mbed Studio
- Preferred Serial Terminal (TeraTerm, Hercules, etc . . .)
#
Step 2: Device preparation#
1. Hardware preparationWizFi360-EVB-Shield will be installed on top of NUCLEO-L476RG. Therefore DIP Switch and jumper cables shall be connected as following:
- SW1 : Off
- SW2 : Off
- SW3 : On
- D2 : UART Tx
- D8 : UART Rx
#
2. Device connectionAfter connecting hardware, connect NUCLEO-L476RG to Desktop or Laptop using USB Cable.
Check COM Port from Device Manager.
If COM port cannot be found in Device manager, check link below and follow instructions.
#
Step 3: Sample application#
1. Code Download & ExecutionAfter code download, open project by selecting File > Open Workspace.
Sample code is stored in following path.
samples/Wi-Fi/Mbed_Mqtt_Atcmd_Wizfi360
samples/Wi-Fi/Mbed_Mqtt_Atcmd_Wizfi360_Azure_C_Shared_Utility
In case of Mbed_Mqtt_Atcmd_Wizfi360 SAS Token was created using Device Explorer or Azure IoT Explorer.
In case of Mbed_Mqtt_Atcmd_Wizfi360_Azure_C_Shared_Utility there is no need to create SAS Token separately as azure_c_shared_utility Library was ported into Project.
#
2. Parameter updateTo connect to Azure IoT Hub, update next parameters.
For SAS Token creation refer to below.
#
3. Project Build & RunPress Run Program to Project Build & Run.
Note :
Start Stream Analytics in order to forward data to Blob Storage.
#
Step 4: ResultsIn terminal program we can check data sent from WizFi360 to Azure IoT Hub. In Blob Storage we can check received data.