For you to install Windows 10 on a Raspberry Pi 2 or simply deploy an app on a Raspberry Pi 2, prerequisites must be met as follows:
- Windows 10 (developer mode activated)
- Visual Studio 2015 + Windows 10 SDK
I need to install Windows 10 on my computer?!
You don't have to - instead you can also use a Windows 10 VM. But first things first: To install Windows 10 Technical Preview, go here.
The other option is to get a Windows 10 VM started. There are a few resources depending on which hypervisor you are using:
- Using Hyper-V: Step-By-Step: Creating and Running A Windows 10 VM on Windows 8.1
- Using Oracle's VirtualBox: How to install Windows 10 in a virtual machine
- Using VMware Player: How to install the Windows 10 Technical Preview in VMWare Player
Visual Studio 2015 Release Candidate
Download any of the two editions of Visual Studio 2015 (i.e. Community and Enterprise) on here.
When installing VS2015, do not use the typical installation. Instead make sure that use a custom installation and select the Tools and Windows SDK 10.xx. I highly recommend the GitHub Extension for Visual Studio
Activate developer mode in either your Windows 10 PC or Windows 10 VM by going to Settings -> Update & Security -> For developers
Windows 10 on Raspberry Pi 2
Scott Hanselman has written a good step-by-step guide on how to install Windows 10 on a Raspberry Pi 2, that I very much recommend you to follow.
When freshly installing Windows 10 on a Raspberry Pi 2, all Raspberry Pis start off with the same device name, i.e. "minwinpc". I recommend changing the password (the default password is p@ssw0rd) as well as the device name via PowerShell, for instance:
$ipaddress = <ip_address_of_raspberry_pi_2> Set-Item WSMan:\localhost\Client\TrustedHosts -Value $ipaddress Remove-Module psreadline -Force Enter-PSSession -ComputerName $ipaddress -Credential "$ipaddress\Administrator" # default password is p@ssw0rd #now in remote session cd ../../.. net user Administrator <new_password> SCHTASKS /Delete /TN Microsoft\Windows\IoT\Startup /F #check if there are 2 instances of msvsmon.exe - Visual Studio remote debugger tlist #change device name SETCOMPUTERNAME <new_device_name> shutdown /r /t 0
More information can be found here.
Find the IP address of your Raspberry Pi 2
The Windows Developer Program for IoT includes some very resourceful programs, such as the Windows IoT Core Watcher. It is very useful to find out the IP address of the Raspberry Pi 2 when deploying a universal app remotely to it.
Alternatively, one can use the Advanced IP Scanner.
2. GitHub Repository: Blinky!
The GitHub repository of MS IoT contains an abundant collection of Windows IoT Core samples, to be found in http://github.com/ms-iot/samples:
Once you navigate to the Windows IoT Core samples GitHub, you can either click on Open in Visual Studio on the right hand side (if you have installed the GitHub Extension for Visual Studio) or click on the copy button also on the right hand side next to the HTTPS clone URL.
In Visual Studio 2015, you clone the GitHub repository in the Team Explorer to a local folder of your choice (here, I choose
Once cloned, all the Windows IoT Core samples are listed amongst your local Git repositories:
3. Blinky on your Raspberry Pi 2
Double click the local Git repository samples to see all its included solutions, such as
PythonBlinkyHeadless.sln. We are interested in the simplest of the simplest projects: Blinky - the equivalent of Hello World in the world of IoT. Click on Open:
Make sure that one the lower right, you are looking for All Project Files, that not only includes solution files (i.e. *.sln) but also C# project files (i.e. *.cxproj). If you have not activated the developer mode beforehand on your Windows 10 computer or VM, you will be prompted with a dialog box pointing that out. In that case, check out the section on Developer Mode.
In any case, navigate to
../samples/Blinky/CS and open
Once, the solution Blinky is opened, navigate to
MainPage.xaml.cs (open the
MainPage.xaml folder) in the Solution Explorer and click on it. This is the file you are going to make a change in:
Scroll down a little to change the
LED_PIN from 5 to 47. Why? GPIO 47 is the onboard ACT status LED on the Raspberry Pi 2. In such a way, we don't have to bother about building a circuit on a breadboard with a resistor and a LED just yet:
Now we need to configure the solution such that it will be deployed to a remote machine like our Raspberry Pi 2. Blinky will be deployed over the net by specifying the IP address of the Pi. Thus, right click on Blinky (Windows Universal) and then go to Properties:
Under the Debug tab, change the target device to be a remote machine. Find out the IP address of your Raspberry Pi 2 using the Windows IoT Core Watcher or the Advanced IP Scanner (see Find the IP address of your Raspberry Pi 2).
Make sure that the platform Blinky will be deployed on is set to ARM, and that Use authentication is unchecked.
You are good to go to run Blinky on your Raspberry Pi 2 - just click on the green play button!
The output in Visual Studio as Blinky is deployed to the RP2 will be as follows:
4. Build the circuit
Before deploying Blinky again on your RP2 (now with a blinking LED), let's first build a working circuit. For checking the circuit, one only needs to connect the circuit with two GPIO pins of the RP2: power and ground.
You can see the power pins in yellow (3.3V PWR), i.e. pins 1 and 17, and the ground pins coloured in black (GND), i.e. pins 6, 9, 14, 25, 30, 34 and 39).
It is very similarly built as described below in the next section, with the difference that the blue connector wire is connected to pin 39 (ground) as opposed to pin 29 (GPIO 5).
5. Blinky on your Raspberry Pi 2 + Breadboard
Now onto getting the LED to blink. We take the same circuit from the previous section, now using GPIO 5 instead:
And off you go deploying Blinky to RP2:
To connect Blinky to the Cloud, i.e. Azure Event Hubs, and then retrieving the message, check out the Lab Blinky and the Cloud by my colleagues in the UK.