Setting up your Sidewalk product

To complete the set up of your Sidewalk product, you have to generate provisioning and add MQTT to destination.

Preconditions

Before creating a Sidewalk provisioning file, you have to:

  • Create an AWS account

  • Set up an AWS user with permissions to create resources

  • Set up user’s AWS credentials file on your local machine

  • Complete the Amazon Sidewalk IoT Prerequisites instructions

Provisioning generation

  1. Go to AWS IoT Core for Sidewalk tools:

    cd tools/aws-iot-core-for-sidewalk
    
  2. Populate the config.yaml configuration file. Set NORDIC hardware platform:

    Config:
      AWS_PROFILE: default  # Name of your AWS profile from .aws/credentials
      DESTINATION_NAME: TemplateAppDestination  # Sidewalk destination used for uplink traffic routing
      HARDWARE_PLATFORM: NORDIC  # Available values: NORDIC, TI, SILABS or ALL
      USERNAME: null
      PASSWORD: null
      INTERACTIVE_MODE: True
    Outputs:
        DEVICE_PROFILE_ID: null
        WEB_APP_URL: null
    _Paths:
        PROVISION_SCRIPT_DIR: tools/provision
        SILABS_COMMANDER_TOOLS_DIR: null  # Not needed if Silabs Commander is already in system Path. Only needed for SILABS.
    
  3. Run device provisioning scripts:

    1. Set up Python virtual environment for the provisioning tools:

      python3 -m pip install --user virtualenv
      python3 -m virtualenv sample-app-env
      source sample-app-env/bin/activate
      python3 -m pip install --upgrade pip
      python3 -m pip install -r requirements.txt
      python3 -m pip install pyjwt -t ./ApplicationServerDeployment/lambda/authLibs
      
    2. Run the device provisioning scripts:

      python3 EdgeDeviceProvisioning/provision_sidewalk_end_device.py
      

      You should see the following output:

      INFO:root:Status: 200
      INFO:root:Saving wireless device to file
      INFO:root:Generating MFG by calling provision.py
      INFO:root:  Generating MFG.hex for Nordic
      INFO:root:Done!
      
    3. Exit the Python virtual environment:

      deactivate
      
  4. Flash the Nordic_MFG.hex file.

    Your provisioning file is located in the EdgeDeviceProvisioning directory. Devices are grouped in the device profile’s subdirectory as shown in the structure below:

    EdgeDeviceProvisioning \
    - DeviceProfile_<profile-id> \
       - DeviceProfile.json
       - WirelessDevice_<device-id>\
           --  Nordic_MFG.bin
           --  Nordic_MFG.hex
           --  WirelessDevice.json
    
    1. Go to the device subdirectory:

      cd EdgeDeviceProvisioning/DeviceProfile_<profile-id>/WirelessDevice_<device-id>
      

      For example:

      cd EdgeDeviceProvisioning/DeviceProfile_102d750c-e4d0-4e10-8742-ea3698429ca9/WirelessDevice_5153dd3a-c78f-4e9e-9d8c-3d84fabb8911
      
    2. Flash the Nordic_MFG.hex file with the provisioning data:

      $ nrfjprog --sectorerase --program Nordic_MFG.hex --reset
      

      Note

      If you reflashed the Nordic_MFG.hex file on an already working device, make sure to perform a factory reset (Button 1 long press) to deregister the previously flashed device. This will allow you to register a new product (new Nordic_MFG.hex) in the Sidewalk network.

Add MQTT to destination

  1. Log in to AWS. Open the AWS IoT Core service.

    ../_images/AWSIoTCore.png
  2. Navigate to Manage → LPWAN devices → Destinations.

    ../_images/AWSIoTCoreDestinations.png
  3. Select your destination end press Edit.

    ../_images/AWSIoTCoreDestinationEdit.png
  4. Edit the destination details.

    1. Select Publish to AWS IoT Core message broker.

    2. Type your MQTT Topic name.

      ../_images/AWSIoTCoreDestinationTestMQTT.png
    3. Edit permissions.

    4. Select Create a new service role and click Save.

      ../_images/AWSIoTCoreDestinationTestRole.png

MQTT client

  1. Open the MQTT test client.

  2. Type your MQTT topic in the filter field and click Subscribe.

    ../_images/AWSIoTCoreMQTT.png