Azure IoT Service Configuration

Here we introduce some required steps to prepare for your IoT Service. For Azure IoT Examples, it is recommended to set up Azure IoT Hub and DPS on your Azure Service Portal for testing. And for Ameba IoT Hub Plug and Play Examples, you can either choose to connect to Azure IoT Hub/DPS or connect to Azure IoT Central for simpler deployment.

Azure IoT Hub and DPS

IoT Hub and DPS can be created on your Azure Portal. You can perform the following steps to set up your own IoT Service on Azure Portal and manage your resources.

  1. Create your IoT Hub on Azure Portal. Once created, you will be able to retrieve your IoT Hub hostname on your IoT Hub menu. This IoT Hub hostname is required for Azure examples in our SDK and will be used as HUB_HOSTNAME in the example.

  2. Now you can add a device to your IoT Hub by either manually adding or by device provisioning. You have to specify the Device ID for your device and choose Symmetric key or X.509 for device connection if you add the device manually. If you use device provisioning, the Device ID will be assigned by DPS which will be the same as the Registration ID of the device enrollment. Also, the registered device will keep the same authentication type as the DPS device enrollment.

Once you have your device created, you can run the Azure example to connect your device to IoT Hub by giving HUB_HOSTNAME, device id as HUB_DEVICE_ID, connection authentication type either Symmetric key as HUB_SAS_KEY or X.509 certificate/private key as X509CERTIFICATE/ X509PRIVATEKEY.

  1. Create your Device Provisioning Services (DPS) on Azure Portal and have your device enrollment ready. The ID scope of the DPS and the Registration ID of device enrollment will be used in Azure Examples as ID_SCOPE and REGISTRATION_ID. Here we introduce individual enrollment only. When you add individual enrollment to your DPS, you can select Symmetric Key or X.509 mechanism.

    SAS (Symmetric Key):

    Specify the Registration ID, IoT Hub Device ID and IoT Hub hostname you want to assign to. The Primary key will be auto-generated and will be used in the Azure examples as SAS_KEY. Once device provisioning is done, the device with name as your IoT Hub Device ID will be registered to your IoT Hub. The registered device will use the same symmetric key for connection.

Azure IoT Central

Azure IoT Central is an integrated platform for users to develop their Azure IoT Service. You can customize your IoT solution on this platform and manage your IoT resources easily and gracefully.

First, you have to create an application on your Azure IoT Central and then select and publish Ameba device on Device Template. Next, navigate to Devices and create a new device. For individual enrollment, follow the steps below to set up your device connection.

IoT_Central_device_connection

  1. Click on your device.

  2. Click on the Connect icon on your device page, you will see the Device connection window pop up.

  3. Select Individual enrollment on the Authentication type.

  4. Choose Shared access signature (SAS) or Certificate (X.509) on the Authentication method.

  5. Enter the SAS Primary key or Upload the X.509 Certificate. Here are some tips for creating the SAS key and X.509 Certificate.

Now you can fill in the connection information in the Ameba IoT Hub Plug and Play examples where ID scope as ID_SCOPE, Device ID as REGISTRATION_ID, SAS key as SAS_KEY and X509 certificate/private key as X509CERTIFICATE/X509PRIVATEKEY.

Note that due to IoT Central’s limitation, command wifi_scan mentioned in the Realtek device model is temporarily not supported in IoT Central.