Skip to content

WurthElektronik/Calypso-IoT-PnP-Design-Kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to create an demo IoT application using the Calypso IoT design kit with Azure IoT Central?

Prerequisites

The Calypso IoT design kit comes pre-flashed and is ready-to-use out-of-the box. The following items are necessary to go through this process.

power-up

  • The design kit with M0 Feather stacked with Calypso Wi-Fi FeatherWing, the Sensor FeatherWing and the OLED FeatherWing.

  • A Micro-USB cable to power up the design kit stack.

  • A Wi-Fi access point (IEEE 802.11 b/g/n compatible) with internet access.

  • A Wi-Fi enabled computer with a browser (Chrome or edge recommended).

  • A Microsoft Azure account. This can be created under the following link: https://azure.microsoft.com/en-us/free/

ℹ️ A valid credit cart is required for creating an Azure subscription.

⚠️ This tool works only on Windows platform

⚠️ The design kit will always be delivered with the latest Firmware version (> v2.2.0). In case you use a Calypso FeatherWing which you received separately, make sure that the Calypso FeatherWing has a Firmware version > v2.2.0 (More Info).

Quick start guide

This section will guide you through the process of creating an end-to-end IoT solution. This process involves the following 5 steps at the end of which you should be able to see the telemetry data from the device on the cloud platform.

Each of these steps are described in detail in the subsequent sections.

1. Create an IoT Central Application: In this step, we create an instance of the Azure IoT central platform from the scratch.

2. Create device config files: In this step all the files that are necessary to configure a device and the IoT platform are created.

3. Upload Root Certificate to IoT Central: In this step, the root certificate created in the previous step is uploaded to the cloud platform to configure the same.

4. Configure the device: This step fully configures the device to connect to cloud.

5. Interact with the device on the cloud: View device dashboard and interact with the device from the cloud platform.

Creating an IoT central application

a. Sign in to the Azure portal. If a subscription does not exit, please create a subscription as described in this link.

b. From the Azure homepage, select the "+ Create a resource button" and then enter "IoT Central application" in the Search the Marketplace field.

c. Select "IoT Central application" from the search results and the select "Create".

Create IoT Central

On the Basics tab, complete the fields as follows:

Create Basic

a. Subscription: Select the subscription to use for the application.

b. Resource group: Select a resource group or create a new one. To create a new one, select Create new and fill in the name you want to use. To use an existing re source group, select that resource group. For more information, see Manage Azure Resource Manager resource groups.

c. Resource name: Type in a name for the IoT central application. For example, "wuerthelektronik".

d. Application URL: This will be automatically set to < Resource name>.azureiotcentral.com. In this example, "wuerthelektronik.azureiotcentral.com"

e. Template: From the drop down, select "Custom application".

f. Region: Select the region in which the application will be located. Select a location that is geographically the closest. FOr example, West Europe.

g. Pricing Plan: Choose the appropriate pricing tier. The standard tier 0 is good to start prototyping. More details on pricing can be found at, https://azure.microsoft.com/en-us/pricing/details/iot-central

h. Click on "Review + Create".

i. On the following page, review the terms and click on "Create".

j. Wait for the deployment to complete. After the process is complete, click on "Go to resource" button to open the application.

Deployment Complete

k. Click on the IoT central application URL to open the newly created IoT central platform.

Application URL

l. In the IoT central app open, after expanding the menu bar, click on "Permissions > Device connection groups" and note down the ID scope parameter for use in further steps.

Home

ID Scope

Create device configuration files

In order to securely connect the device to IoT central application, the device needs to implement certain methods for authentication. In this case, the X.509 certificate based authentication is implemented. This method requires creation of certificates for every device. In order to enable easy prototyping, Würth Elektronik eiSos’s Certificate creation tool can be used. This tool creates all the certificates necessary to get started.

Inside the WE Certificate Generator tool, fill in the following fields to generate the required certificates for the cloud service

Certificate Generator Tool_Create Config File

  1. SSID and Password: Select your Wi-Fi network and type in the password. The device will connect to internet through this Wi-Fi network.

  2. Security: Check if the selected security type is correct for the selected Wi-Fi network.

  3. Device ID: This is the name of the device as it appears in the IoT central APP. It needs to be unique per device. In this example, the name "test-dev" is used.

  4. Scope ID: Type in the ID scope noted in the previous section. ID scope is unique per application but common across devices.

  5. NTP server: If needed change the time server of choice that the module will use to get the current time.

  6. Time zone: Select the appropriate time zone.

Device root certificate:

This is the self-signed certificate that acts as the root of trust for all devices. The device root certificate is used to generate leaf certificates. Each device has a unique leaf certificate that identifies the device. The root certificate can be generated once and used for generating leaf certificates for several devices. The WE cerificate uploader tool allows creation of a new root certificate, saving the same and loading it back for subsequent usage.

Device Root Certificate

  1. On first time use, set the validity time in month. For example, 1 month.

  2. Click on "Create root certificate" to create a new root certificate.

  3. [Optional] If a root certificate already exists, click on "Load root certificate". This opens a file browser. Browse to the correct location to choose the previously used root certificate. Use .pfx format certificate for loading.

  4. [Optional] Click on "Save root certificate" to save the generated root certificate for future use. This can be used generate the certificate in .pfx format which is the format used during loading a certificate.

  5. [Optional] Click on "Export root PEM" to export the certificate in PEM format. This file needs to be uploaded to the IoT central application

  6. [Optional] Click on "Display root certificate" to view the certificate in the standard Windows format.

Device certificate:

Every device requires a unique device certificate to securely connect to the IoT central application. Each device certificate generated is exclusively linked to the device through the device ID and cannot be used on any other device.

Device Certificate

  1. For every device ID, set the validity time in months. For example, 1 month.
  2. Click on "Create device certificate" to create a new device certificate
  3. [Optional] Click on "Export device PEM" to export the certificate in PEM format. This file needs to be uploaded to the device.
  4. [Optional] Click on "Display device certificate" to view the certificate in the standard Windows format.

Device private key:

Device Key

This is the private key corresponding to the public key in the device certificate and is also uniquely linked to a device ID. Click on "Export device private key" to export the key in PEM format. This file needs to be uploaded to the device as will be explained in the subsequent sections.

Certificate Generator Tool Steps

After completing the processes of generating the root and device certificates, export all the files by clicking "Export All Files". All the certificate files will be created and stored under "Azure" folder inside the main directory.

Certificates Generated in the output directory:

Azure Device Certificate

After exporting all the necessary files, a new directory will be created in the same folder as the executable file with all the necessary configuration file and certificates.

Upload the Root certificate to IoT central

In this step, the device root certificate is uploaded to IoT central and a policy is set to allow all devices with leaf certificate that are generated from this root to connect to the platform.

If an organization does not exist, create an organization as described in this link.

Create New Profile

  • In the IoT central app open, "Permissions > Device connection groups" and click on "+New"

Create_Enrollment Group

  • In the subsequent window,
    • a. Enter a name for the enrollment group.
    • b. Set the "Automatically connect devices in this group" to "On".
    • c. Set the group type to "IoT devices"
    • d. Set the attestation type to "Certificates (X.509)"
    • e. Click on "Save".

Manage Certificate

  • Once the enrollment group is created, the root certificate needs to be added to this group. In order to do this,
    • a. Click on "Manage primary" in the "Certificates (X.509)" section of the enrollment group.
    • b. In the pop-up window, click on "Add certificate" and select the device root file generated using the WE certificate generator.
    • c. Set the "Set certificate status to verified on upload" option to "On".
    • d. Click on "Upload"
    • e. On completion of the upload process, close the pop-up window.

Configure the device

The IoT design kit comes with the Firmware pre-installed. In this step, a one-time configuration of the kit is done which enables connection to the desired Wi-Fi network and the previously created IoT central application

  • Ensure that all the four boards are stacked up correctly with the Adafruit FeatherWing OLED on the top.

  • Power up the IoT design kit stack via USB or a Li-Po connector on the Adafruit M0 Feather board.

power-up

  • After a short initialization process, the device waits for the user to start the configuration process. The following message appears on the display "Device not configured. To configure double press button C".

  • Double press button C on the OLED display FeatherWing to enter the configuration mode.

Wait To Config

  • In the configuration mode, perform the following five steps,

    Config Mode

    a. In the configuration mode, the Calypso Wi-Fi module is set to access point mode with an SSID "calypso_<MAC_ADDRESS>" and password "calypsowlan". Connect your PC (Laptop/tablet/smartphone) to this access point, displayed on the screen.

Connect to AP

b. On the PC open a browser.

c. In the browser, navigate to calypso.net/azure.html.

Upload

Select All Files d. Click on the "Choose Files" button. This opens the file browser. Browse to the location where the configuration files were generated as described in the previous section. Select all the files in the directory and click on "Upload" button. On success, the message "Success: 204 No content" at the bottom of the page indicates successful configuration of the device.

e. Restart the device by clicking the "Reset" button.

Reset

  • On restarting, the device goes through the following steps automatically,

    a. Initialize the hardware.

    b. Connect to the configured Wi-Fi network.

    c. Connect to the Microsoft Azure Device provisioning service (DPS).

    d. After authentication, the DPS assigns the address of the IoT hub (Device management service of Azure) to connect.

    e. This address is saved in the secure storage of the Calypso Wi-Fi module for further use.

    f. Finally, the device connects securely to the IoT central platform and starts exchange of data.

At this stage, the device is fully configured, securely connected and ready to use. On subsequent boot-up the device directly connects to the platform using the saved address and starts exchanging data with the platform.

Connected

Connect the PC to the Internet by reconnect to the your local Wi-Fi network.

Congratulations! The set-up is now complete. It's not time to check the telemetry data on the cloud.

View the device default dashboard

To access the device on the IoT platform, navigate to "Devices -> All devices -> ".

Click on the device name to open the device page.

Select Device

In the "about" tab, the properties are displayed.

About

The telemetry data is displayed graphically in the "Overview" tab.

Overview

Send commands to device

In order to send a command to change the mini neo-pixel LED on the device, click on the command tab on the device page. Enter the RGB values and click on Run. A few sample colors,

Color R G B
Red 255 0 0
Green 0 255 0
Blue 0 0 255
Yellow 255 255 0
White 255 255 255
Cyan 0 255 255

The message is processed by the device and the color of the LED is changed accordingly.

Run Command

Update device property:

This device allows changing the frequency with which the sensor data is read and sent to the platform. This can be done from the IoT central platform. To do so, open click on "Manage device drop down and select "Device properties". This opens the property update page.

Device property

To update the send frequency, type in ""telemetrySendFrequency": "" and click on "Send to device". This updates the device's send frequency on the device.

Telemetry send frequency

Factory resetting the device

In order to reset the device to factory state, press the "button C" once, then Press and hold "button C" till the following message is displayed on the screen, "Reset device to factory state". This procedure resets the device to default state. Follow the device configuration process defined earlier to reconfigure the device.

About

A design kit to build and evaluate end to end IoT application using the Calypso IoT design kit and Microsoft Azrue IoT Central

Resources

Stars

Watchers

Forks

Packages

No packages published