Skip to content

Latest commit

 

History

History
129 lines (86 loc) · 4.98 KB

_1_APP_TELEMETRY_manual.md

File metadata and controls

129 lines (86 loc) · 4.98 KB

iothub_ll_telemetry_sample application

1. Prepare IoT Hub and Device for this example

1.1. Azure portal

In Azure portal, you need to create a device and get the connection string informations as below:

image

  • This example uses symmetric key

image image image

  • You copy the key string,"Primary Connection String" and paste the string into your code as decribed in next section.

image

1.2. Developer PC

1.2.1. SDK setting

In the following pico-azure-iot-sdk-c/application/main.c source file, find the line similar to this and replace it as you want:

(...)

// The application you wish to use should be uncommented
//
#define APP_TELEMETRY
//#define APP_C2D
//#define APP_CLI_X509
//#define APP_PROV_X509

(...)

// The application you wish to use DHCP mode should be uncommented
#define _DHCP
static wiz_NetInfo g_net_info =
    {
        .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x11}, // MAC address
        .ip = {192, 168, 3, 111},                    // IP address
        .sn = {255, 255, 255, 0},                    // Subnet Mask
        .gw = {192, 168, 3, 1},                      // Gateway
        .dns = {8, 8, 8, 8},                         // DNS server
#ifdef _DHCP
        .dhcp = NETINFO_DHCP                         // DHCP enable/disable
#else
        // this example uses static IP
        .dhcp = NETINFO_STATIC
#endif

Edit the pico-azure-iot-sdk-c/application/sample_certs.c entering the proper connection string and key value from the Azure Portal:

/* Paste in the your iothub connection string  */
const char pico_az_connectionString[] = "[device connection string]";

1.2.2. Build

Run make command

image

1.2.3. Azure IoT Explorer (preview) setting

To see the message from your IoT Device, you need to make a "Azure IoT Explorer" setting as below:

image

  • In Azure portal, you can get the "Connection String" as follows:

image

  • Copy & paste the connection string, and click "Save".

image

  • Find the device and click name

image

  • Go to "Telemetry" menu, and click "Start"

image

  • Wait for incoming message from your IoT device

image

1.2.4. Serial terminal open

  • Open "COM" port to see debug code

image

2. Run the example code

2.1. copy main.uf2 file into your W5100S-EVB-Pico

image

2.2. Serial terminal log

  • Connect to Azure IoT Hub

image

  • Send messages to Azure IoT Hub

image

2.3. Azure IoT Explorer (preview) log

  • Getting device messages from Azure IoT Hub

image