Getting Started with Windows IoT Core on Raspberry Pi 2

Internet of Things (IoT) is the network of devices that embedded with a variety of sensors, network connectivity, and software, which makes physical objects smart, capable of communicating with each other. How to turn things intelligent? We can give physical objects a computer brain, such as Raspberry Pi. Microsoft is aiming to help developers quickly build IoT solutions with Windows IoT Core. To get started, you can choose a board you like, and read the IoT tutorials provided by Microsoft. I picked Raspberry Pi 2 (RPi2) and successfully ran the first Windows Universal app on Windows IoT Core.

How to Setup Windows 10 IoT Core Development Environment on Raspberry Pi 2?

  1. Upgrade operating system to Windows 10. Download and install Visual Studio 2015.
  2. Prepare Raspberry Pi 2, micro SD card (minimum 8G), card reader, HDMI cable, monitor, and Ethernet cable.raspberry pi 2
  3. Download Windows 10 IoT Core image and then install Windows_10_IoT_Core_RPi2.msi.
  4. Connect Micro SD card reader to PC. Run IoTCoreImageHelper.exe to load flash.ffu, which is located at C:\Program Files (x86)\Microsoft IoT\FFU\RaspberryPi2.flash Windows IoT Coreflash flash.ffu
  5. Safely remove SD card reader, and then insert Micro SD card to RPi. Connect the board to HDMI monitor, keyboard, mouse, Ethernet cable and micro USB power supply.
  6. Once Windows IoT Core booted successfully, it will appear on Windows IoT Core Watcher. remote IoT device
  7. Run Powershell as administrator.
  8. Start the WinRM service:
    net start WinRM

    net start winrm

  9. Add the device by machine name or IP. By default, the machine name is minwinpc.
    Set-Item WSMan:\localhost\Client\TrustedHosts -Value minwinpc

    RPi connection

  10. Start a session with the Windows IoT Core device. The default password is p@ssw0rd.
    Enter-PSSession -ComputerName minwinpc -Credential minwinpc\Administrator

    pssession

    login Windows IoT Core device

  11. For remote debugging, check whether there are two instances of msvsmon.exe running on the device.
    tlist | sls msvsmon.exe

    iot core remote debugger

How to Deploy and Run Windows Universal App on Windows IoT Core?

If you don’t have Windows IoT template installed, you can get it from Tools > Extensions and Updates > Search for IoT.

Windows IoT template

Create IoT background apps with the template.

IoT background project

If you just want to test a Universal app quickly, you can download the sample code from GitHub.

Open Project Properties. Navigate to Debugging > Remote Machine > Machine Name. Add the detected device.

IoT remote device detected

Deploy and run your app via Remote Machine.

How to Make Your Universal App as the Default Startup Program on Windows IoT Core?

We can use the startup editor to configure startup apps.

List all installed applications:

Windows IoT startup list

Note: the Microsoft.SDKSamples.OCR.CPP is the Windows Universal sample I installed via Visual Studio 2015.

Check the startup apps with the command:

iotstartup.exe startup

old startup app
The IoTCoreDefaultApp is what you have seen when you boot Windows IoT Core for the first time. We can change it to our custom app with the following command:

iotstartup.exe startup add .*OCR

new startup app
Restart device:

shutdown /r /t 0

You will see the default startup app has been changed to yours.