Connect to a device

Completed

Exercise 1: Configuring physical device

In this exercise, you will be introduced to setting up the MXChip IoT DevKit. The MXChip IoT DevKit (a.k.a DevKit) is an all-in-one IoT Device Kit, you can use it to develop and prototype IoT solutions that take advantage of Microsoft Azure services.

It includes an Arduino-compatible development board with rich peripherals and sensors, an open-source board package, and a growing projects catalog.

To get started with purchasing an MXChip IoT DevKit, visit https://aka.ms/iot-devkit/ and click on Get a Kit.

Task 1: Create and register the device

In this task, you will create a new customer asset and register it.

  1. Navigate to Power Apps and make sure you are in the correct environment.

  2. Select Apps and click to open the Connected Field Service application.

  3. Select Customer Assets and click + New.

  4. Enter MxChip IoT for Name, select Adventure Works for Account, and click Save.

  5. Scroll down and enter MxChip for Device ID and click Save again.

  6. Click Register Devices.

  7. Click OK.

Task 2: Flash firmware

  1. Download the latest pre-built Microsoft IoT Central firmware for the MXChip from the releases page on GitHub.

  2. Select AZ3166-IoT-Central-x.x.x.bin.

    Screenshot of the AZ3166-IoT-Central-x.x.x.bin to select.

  3. Save the file locally.

  4. Connect the DevKit device to your development machine using a USB cable.

  5. In Windows, a file explorer window opens on a drive mapped to the storage on the DevKit device. For example, the drive might be called AZ3166 (E:).

    Screenshot of Windows explorer drive name.

  6. Drag the AZ3166-IoT-Central-X.X.X.bin file onto the drive window.

  7. When the copying is complete, the device will reboot with the new firmware.

Task 3: Configure Wi-Fi

After the device reboots, you need to configure the Wi-Fi on the Device.

  1. Hold down button B. While still holding button B push and release the reset button. Then release button B.

    Image of button b and reset button on device.

  2. Your DevKit enters AP mode for configuring Wi-Fi. The screen displays the service set identifier(SSID) of the DevKit and the configuration portal IP address.

    Image of service set identifier of the DevKit and the configuration portal ID address.

    If your Wi-Fi SSID starts with AZ and not AZ3166 after applying the firmware, you need to follow the following steps to make sure the firmware gets applied correctly.

    Bad - Firmware Not Applied Correctly

    Image of firmware not applied correctly.

    Good - Firmware Applied Correctly

    Image of the firmware applied correctly.

    • Click Reset on the AZ3166

    • Hold down A+B Button AZ3166 will hard reset

    • Press Reset

    • Remove from Power

    • Place AZ3166 into AP Mode

    • If the SSID is AZ3166_XXXXXX, the firmware is applied correctly.

    • If the SSID still shows AZ-XXXXXXXXXX, please refer to IoT DevKit and use SSH to update the IoT Hub Connection String.

  3. Go to your Azure portal, select All Resources and click to open the IoT Hub.

  4. Select IoT Devices and open the device you registered.

  5. Copy the Primary Connection String.

    Screenshot of the primary connection string copy button.

  6. Use another Wi-Fi enabled device (computer or mobile phone) to connect to the DevKit SSID. Locate AZ3166 and click Connect.

  7. Wait for the device to connect.

  8. In your browser paste http://192.168.0.1/start and <enter>.

  9. Select the Wi-Fi Network you want to join and enter your Wi-Fi password.

  10. Paste the connection string you copied.

  11. Get the Pin Code from the device and enter in the Device Pin Code field.

  12. Select all telemetry options and click Configure Device.

  13. You will be asked to reset the device.

  14. Press the Reset button on the device.

  15. The device will reset and connect. Wait until you see messages getting sent to the IoT Hub.

    Screenshot of device getting messages sent to the IoT Hub.

  16. You have now configured your physical device to connect with Azure IoT Hub.

Exercise 2: Using device explorer

Task 1: Download and install device explorer

  1. Navigate to Microsoft Azure IoT Hub SDK for C# Release 2019-9-12.

  2. Scroll down to locate SetupDeviceExplorer.msi and click on it.

  3. Click Run.

  4. Click Next.

  5. Complete the installation and click Close.

Task 2: Connect

  1. Go to your Azure portal and open the IoT Hub again.

  2. Select Shared Access Policy and click on the iothubowner.

  3. Copy the Connection String - Primary Key.

  4. Start the Device Explorer you installed on your machine.

  5. Paste the Connection String and click Update.

  6. Click OK.

  7. Select the Data tab and click Monitor.

  8. You should see sensor data from your device in JSON format.

    Screenshot of the sensor data from your device in JSON format.