A beginner's guide to installing and pushing a simple app to Windows 10 IoT Core running on a Raspberry Pi.
Microsoft's ambition is for Windows 10 to run on every type of computing device, even the credit card-sized $35 Raspberry Pi board.
The Pi doesn't run the same version of Windows 10 as a laptop does, but a far simpler, stripped-back release called Windows 10 IoT Core.
This OS won't boot you into the traditional Windows desktop, but instead loads a bare bones menu from which you can set up the system, which can only run a single Universal Windows Platform (UWP) app with a GUI at a time.
The real purpose of Windows 10 IoT Core on the Pi is to run small applications, which are deployed to the board from a PC. These apps could do anything from taking readings from a temperature sensor, to acting as a simple web server.
But how do you get started? Here's a step-by-step guide to setting up Windows 10 IoT Core on the Raspberry Pi 2 or 3, and then deploying a simple app, using a Windows 10 PC as the base machine.
Step 1. First you need to download NOOBS from the Raspberry Pi Foundation website. The NOOBs installer will make it easier to get Windows 10 IoT Core onto your Pi. Next get an SD card, which is 4GB or larger, and format it as FAT.
Step 2. Extract the files from the downloaded NOOBs zip file. Copy the extracted files into the root directory of the card, making sure you are copying the files themselves, rather than a directory containing the files.
Step 3. Insert the SD card into the Raspberry Pi and boot the machine, ensuring the Pi is hooked up to a network.
You will see a drop-down list of operating systems, from which you should select Windows 10 IoT Core, as shown below. Confirm you want to overwrite the contents of the SD card - unless the card contains data you want to keep.
Choose from either the RTM, the latest official release of Windows 10 IoT Core, or the latest Windows 10 IoT Core Insider version (which requires you to have a Microsoft account set up for Insider access). Press OK and the machine will reboot into Windows 10 IoT Core once it has installed.
Step 4. Next you'll need to return to your main Windows machine and download and install Visual Studio, the IDE used to write code and deploy it to the Raspberry Pi.
The free edition of Visual Studio is known as Visual Studio Community 2015 and can be downloaded from here. Run the setup program and select the Custom option under Choose the type of installation. This will open the dialog box below, where you should tick the box marked Universal Windows App Development Tools, as shown. Click Next and then click Install.
The setup program will now download and install Visual Studio, be prepared to leave it for some time due to the large file size.
Step 5. Once the setup program has finished installing and updating you should have the correct version of Visual Studio. To check, open Visual Studio and select Help-> About Microsoft Visual Studio and check that the version is Visual Studio 14.0.25123.00 Update 3 or later. Also, in the list of Installed products in the window, check that Visual Studio Tools for Universal Windows Apps is version 14.0.25527.01 or later.
Step 6. Now you need to enable developer mode on Windows 10. Go to Settings->Update & security. Select For developers in the lefthand list. As shown below, under Use developer features select Developer mode, and accept the disclaimer by clicking 'Yes'.
Step 7. For this tutorial, you'll need to install the latest Node.js Tools for UWP Apps. Before you do you need to make sure you have Git and Python installed on your machine. You can download current versions of Git from here and Python from here.
Next you need to make sure that the location of Python and Git are stored in Windows' PATH environment variable. To do this, type System into the search box on the Taskbar. Left click on System Control Panel, then select Advanced system settings->Environment Variables. This should open the Environment Variables window, seen below. In the System variables box, double left click on Path. In the window Edit environment variable, click the button New to add the file location of Git and then do the same for Python, if they're not already included.
You can find the file location of both by typing either Git or Python into the search box on the Taskbar, and right clicking on the app and selecting Open file location. If this takes you to a Shortcut, then right click on the Shortcut to the app and inspect Properties and you'll find the location in the Start in field. Now you can install Node.js Tools for UWP Apps from here (if you're reading this some time after publication check here for the latest release).
Step 9. The package manager npm will then install all of the software dependencies of the sample Node.js application that will be deployed to the Raspberry Pi. Wait until the dependencies have been downloaded, after which you should see the following directory structure in Visual Studio's Solution Explorer window.
Step 10. Now you need the IP address of your Raspberry Pi. There are several ways of finding this, one way is to boot up Windows 10 IoT Core on the Pi. The menu screen displays the IP address, as shown below.
Step 11. Return to the sample app you created in Visual Studio and go to the Project-> Properties in the top menu. This should open a tab called Express4UWPApp1. In the field labelled Remote Machine, enter the IP address for the Raspberry Pi. At the top of the window is a dropdown menu labelled Platform, select ARM, as shown below.
Step 12. Press F5 to deploy the code to the Raspberry Pi. Be aware the deployment can take some time. When the app has been deployed to the Pi you should see the Ready message, as shown below, at the bottom of Visual Studio. The app should now be running and, if you're so inclined, ready to debug.
Step 13. Now to check the sample app is working. The code in this demo effectively sets up the Pi as a local web server, which can be accessed from your PC by opening a web browser, and typing http://[IP address of the Pi]:3000. You should see a message saying 'Welcome to Express', as shown below.
This is a very simple guide to installing Windows 10 IoT Core on the Pi and deploying a test app.
You could set up the Express server above to do more than just return a simple message or, if you're interested, there are tutorials for more advanced projects that involve hooking up the Pi to hardware, allowing you to flash an LED or take readings from a temperature sensor.
Read more about the Raspberry Pi
- Raspberry Pi: The smart person's guide
- Raspberry Pi 3: The inside story from the new $35 computer's creator
- Raspberry Pi 3: How much better is it than the Raspberry Pi 2?
- Pi-Top review: A Raspberry Pi laptop for tinkering on the go
- Hands-on with the New Raspberry Pi camera module
- Raspberry Pi and Docker: Tiny $35 computer gets major new release of HypriotOS (ZDNet)
- Turn any hard drive into networked storage with Raspberry Pi (CNET)