Running Windows 10 IoT Core and Code on the Raspberry Pi 2

Version 9

    Setting up the Environment

     

    I admit that it is a big hurdle at the moment for using Windows 10 on the Pi 2 that you have to be running Windows 10. Presumably later this year, it will be a lot easier for the majority of those whom are currently running Windows 7 or 8/.1 because Microsoft are offering a free upgrade to 10.

     

    It is not beyond your grasp, if you do not have a spare computer to install Windows 10 Technical Preview upon, to instead use a virtual machine. This means that you essentially create a computer within your computer, and run a full Operating System upon it. There's software available such as VMWare Workstation (though that costs money) and VirtualBox (which is free). I personally prefer VMWare Workstation and use it regularly.

     

    Once you've downloaded Windows 10 Insider Preview you'll then have to run your virtual machine software as though you're setting up a brand new computer. There are guides online for VirtualBox (I advise searching for Windows 8 guides if you can't find Windows 10). You will probably need to setup the virtual network adapter in 'bridged' mode rather than 'NAT' to make sure that it can send broadcast network packets to discover network devices easily. You'll also want to make sure that VirtualBox has permission to access the network in your firewall (or just disable your firewall, which isn't a great recommendation but it helps if you're trouble-shooting connectivity).

     

    After following the steps to install Windows 10 Core IoT on the Raspberry Pi 2 (Windows 10 IoT Core on the Raspberry Pi 2), including the "WindowsDeveloperProgramForIoT" executable from the preview image inside Windows 10 Technical Preview (which needs Visual Studio 2015 installed - see below) I was then able to power up my Pi 2 and have it connected to the network. At this point I haven't even plugged a screen into it.

     

    Accessing the Pi 2

     

    So the question that arises here is "how do you know what IP address the Pi 2 has to be able to connect to it?" well the software installed that was included with Flash.ffu is effectively an 'IoT device finder' that scans the network with effectively broadcast packets and returns the IP and MAC address of the device. From there you can then choose to open the web browser, or connect via telnet.

     

    Yes, it prompts for telnet, that horrible plaintext, insecure connection method. If the Pi 2 is actually running telnet then you'll want to kill it when you're done. The main part is, that you'd have to install telnet in Windows 10 if you didn't have it already. I couldn't actually connect over telnet, which says to me that Microsoft didn't put it on there, thankfully, but I could be wrong.

     

    The Pi 2 hosts a web server where you can see the processes and other details as in the screenshots below:

     

    {gallery} Windows 10 IoT Core on the Raspberry Pi 2

    01-webpage.png

    Default page: Shows when you open the IP address

    appdeploy.png

    Apps: Shows the IoT / Universal Apps you've installed on the Pi 2

    crash.png

    Crash: The debugger reported that TIWorker.exe had crashed. Stay classy Dev' Edition.

    devicemanager-basicdriver.png

    Device Manager: This mainly shows that a lot of drivers are just default at the moment, note no VideoCore driver

    network-wifimanager-bork.png

    Networking: Yep, you need a wired connection before you can setup WiFi

    processes.png

    Processes: This is effectively the 'Task Manager' of the Pi 2

    resources.png

    System Performance: The Pi 2 allocates a low amount of RAM to the GPU 164.3mb is all Windows

     

    Time to Code

     

    Now that I was able to connect and see it on the network, I then made sure I had Visual Studio 2015 Professional Edition RC installed (you may also need the development tools). If you go to download Visual Studio 2015 it'll try to push you towards the Community or Enterprise editions. It's probably the Professional one you want, if you scroll down the page , click 'Visual Studio 2015' on the left and you can find the Professional Edition. Apparently you can use the Community Edition, but the 'IoT watcher' which broadcasts on the network to see what devices you have, may not install.

     

    Visual Studio 2015 is ridiculously easy to just test to upload an application to the Pi 2, and with Visual Studio you get the support and guidance of the programming language, the IDE (integrated development environment) that helps you with the code and the debugging functionality. Debugging, I've found, is something that is tedious and awkward in most programming languages and something that usually isn't covered on guides when learning to program.

     

    The screenshots below show the steps I took when putting code onto the Pi 2 (mouse over the gallery for captions):

     

     

    {gallery} Test IoT App Pi 2

    visual-studio-project-01.png

    New Project: Decided to create a 'Windows IoT Core' background app

    visual-studio-project-02-universal.png

    Choices, Choises: I think you can also deploy a 'Windows Universal' app, but I didn't choose it

    visual-studio-project-03-developer-license.png

    Developer License: For Windows IoT Core apps you need a dev' license for the tech' preview

    visual-studio-project-04-developer-license-renew-30-days.png

    Dev License: It's fine, it's free, but it has to be renewed every 30 days (90 for AppStore development)

    visual-studio-project-05-emptyproject-remotedevice.png

    Deployment: To compile it we want to deploy to a 'remote machine', not a 'device'

    visual-studio-project-06-setup.png

    Setup Remote Machine: Enter the details for the Pi 2 - no authentication has been setup

    visual-studio-project-07-missingframeworks.png

    Compiling!: Turns out some framework's missing, it downloaded them, it's fine.

    visual-studio-project-08-wasitsuccessful.png

    Is it done?: Believe it or not, this is the success dialogue!

    visual-studio-project-09-yayappinstalled.png

    Woohoo: Check to see if it's listed in Apps! Yes it is! (Along with suddenly two others, maybe framework related?)

     

    There's a main caveat to all of this. I was connected to the internet with my main computer and I logged into Windows 10 and Visual Studio 2015 with a Microsoft Account (created at http://www.outlook.com) which I appreciate not everyone can do. It made retrieving a developer license easy and ensured that downloading Visual Studio 2015 was straightforward because I had also used the Microsoft Account to become a 'Windows Insider' and download Windows 10 in the first place.

     

    It also has the added benefit of synchronising your settings with the 'cloud' should you want it to. That means when Windows 10 comes about for real and/or you need to change versions of Visual Studio it remembers nice parts like colour schemes and other settings, you can also sign up for the Azure service to save apps in the cloud and use code repositories.

     

    Talking of code, you may want to run examples on your Pi 2. Microsoft have a number of them available on Hackster.io :

     

    Capture.PNG

     

     

    That's it, the rest is down to what examples you can find in the code, familiarising yourself with how the operating system can run on the ARMv7 Pi 2 and get hacking. The microSD card that you setup for the Pi 2 does have FAT/NTFS mountable partitions where you will find additional config settings, a kernel image and a few other things. In fact, peteroakes has already got to grips with it in his blog post: Raspberry PI 2 and Windows 10... SPI, ADC and GUI Display in which he's using the Pi's ability to output to the screen.

     

     

    What do you think?