These are the available versions of this Windows 10 IoT Core sample:
This sample demonstrates how to connect to IoT Hub, send telemetry, and monitor and respond to device twin state changes.
The sample is Microsoft IoT Central compatible. See below for a complete walk-through.
01/10/2018 5 minutes to read
- David Campbell
- George Mileka
This article describes how, as a device developer, to connect a device running a Windows 10 IoT Core device (like Raspberry Pi) to your Microsoft IoT Central application using the C# programming language.
To complete the steps in this article, you need the following:
- A Microsoft IoT Central application created from the Sample Devkits application template. For more information, see Create your Microsoft IoT Central Application.
- A device running the Windows 10 IoT Core operating system. For this walkthrough, we will use a Raspberry Pi.
- Visual Studio installed (only needed if you are going to build/deploy the source code).
- With 'The Universal Windows Platform development' workload installed.
In Microsoft IoT Central,
- Add a real device from the Raspberry Pi device template.
- Make a note of the device connection string. For more information, see Add a real device to your Microsoft IoT Central application.
To setup a physical device, we need:
- A device running Windows IoT Core operating system.
- To do that, follow the steps described here.
- A client application that can communicate with Microsoft IoT Central.
- You can either build your own custom application using the Azure SDK and deploy it to your device (using Visual Studio). OR
- You can download a pre-built sample and simply deploy and run it on the device.
To deploy the client application to your Windows IoT Device,
- Ensure the connection string is stored on the device for the client application to use.
- On the desktop, save the connection string in a text file named connection.string.iothub.
- Copy the text file to the device’s document folder:
- [device-IP-address]\C$\Data\Users\DefaultAccount\Documents\connection.string.iothub
- Go to the device web portal (in any browser, type http://[device-IP-address]:8080) (This will allow you to manage many aspects of your Windows IoT device. The feature we’ll need for this exercise is app installation).
- On the left, expand the ‘Apps’ node.
- Click ‘Quick-run samples’
- Click ‘Azure IoT Hub Client’
- Click ‘Deploy and run’
The application should launch on the device, and will look something like this:
In Microsoft IoT Central, you can see how the code running on the Raspberry Pi interacts with the application:
- On the Measurements page for your real device, you can see the telemetry.
- On the Properties page, you can see the value of the reported Die Number property.
- On the Settings page, you can change various settings on the Raspberry Pi such as voltage and fan speed.
You can see the source code for the client application on the Windows IoT samples page here.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.