tour of windows 10 iot core on raspberry

16
Guided Tour of Windows 10 IoT Core At //Build 2015, Microsoft demonstrated a version of Windows running on a Raspberry Pi 2 board. They released a preview version of the OS and supported two boards from the start, including the MinnowBoard Max. A second build arrived in June that included an easier flashing tool, SSH and numerous bug fixes. It’s worth noting that the Intel Galileo board does not support Windows 10 IoT Core. It only supports the previous version of Windows on Devices. But what does this mean to developers and why should you even care? A good summary of where things stand can be found in Jen Looper’s post, “8 Key Findings About IoT Development .” Some interesting things to point out are : Only half of developers have the actual skills to develop for it. This is where you can get a head start and start learning it now, where your skills will be in demand for the future. We’ve seen home automation and wearables join the fun, but there are big businesses that will require IoT in the future. Android and Java are popular, but Microsoft is allowing you to use a language you are comfortable with (C#) and as well as a UI (XAML). The full report titled, “State of IoT” by Progress can be downloaded here. In this post, I’ll take you through my journey of setting up a device and finally building an app that run on Windows 10 IoT Core. Since we will be using the Release Candidate of Visual Studio 2015, it’s important to point out that anything is subject to c hange. The Raspberry Pi 2 Board The Raspberry Pi 2 Board is now available for just $25 USD. I’d recommend picking it up from one of the official distributors listed on the official site. After opening the box, you will see your board in a static resistant bag and a manual. You will need a few things to get started :

Upload: benji6999

Post on 08-Sep-2015

67 views

Category:

Documents


2 download

DESCRIPTION

Guided Tour about Installing the Windows 10 IoT operating system on Raspberry Pi2

TRANSCRIPT

  • Guided Tour of Windows 10 IoT Core

    At //Build 2015, Microsoft demonstrated a version of Windows running on a Raspberry Pi 2 board. They released a preview version of

    the OS and supported two boards from the start, including the MinnowBoard Max. A second build arrived in June that included an

    easier flashing tool, SSH and numerous bug fixes.

    Its worth noting that the Intel Galileo board does not support Windows 10 IoT Core. It only supports the previous version of Windows on Devices.

    But what does this mean to developers and why should you even care? A good summary of where things stand can be found in Jen

    Loopers post, 8 Key Findings About IoT Development. Some interesting things to point out are :

    Only half of developers have the actual skills to develop for it. This is where you can get a head start and start learning it now,

    where your skills will be in demand for the future.

    Weve seen home automation and wearables join the fun, but there are big businesses that will require IoT in the future. Android and Java are popular, but Microsoft is allowing you to use a language you are comfortable with (C#) and as well as a

    UI (XAML).

    The full report titled, State of IoT by Progress can be downloaded here.

    In this post, Ill take you through my journey of setting up a device and finally building an app that run on Windows 10 IoT Core. Since we will be using the Release Candidate of Visual Studio 2015, its important to point out that anything is subject to change.

    The Raspberry Pi 2 Board

    The Raspberry Pi 2 Board is now available for just $25 USD. Id recommend picking it up from one of the official distributors listed on the official site. After opening the box, you will see your board in a static resistant bag and a manual.

    You will need a few things to get started :

  • An 8 or 16 GB microSD card to load the OS;

    A Micro-USB cable for power;

    An HDMI cable to hook up to an external monitor;

    An Ethernet cable for internet access (which will also let you deploy your app to the device).

    The board itself looks like the following:

    1. microSD Slot (specs recommend at least 16GB) 2. Micro-USB Port for power 3. HDMI Cable 4. Ethernet Port 5. 4 USB Ports

    Now that you know the basics of your hardware, lets go more in-depth and take a look at setting it up to boot Windows 10 IoT Core.

    Setting up your Raspberry Pi 2

    Getting started with Windows 10 IoT Core only consists of a couple of clicks with the new flashing tool.

    Youll need a PC running Windows 10 Preview. (There are other ways that I wont link to as they infringe on MS copyright). Insert a microSD card into your PC.

    Download the following ISO image. (You will need to log in to download these files).

    Double click on the ISO image to mount it and run the installer. Remove the checkbox that says, Launch Windows IoT Watcher Application as shown below.

  • Search for IoTCoreImageHelper.exe and select your SD Card and the flash.ffu found in the directory shown in the screenshot

    below.

  • Once the process has completed, you are ready to run Windows 10 IoT Core on your Raspberry Pi 2.

    Boot into Windows 10 IoT Core

  • Take the SD Card out of your computer and put it into your Raspberry Pi 2 and connect the mini-USB to a power port and the HDMI

    cable to an external monitor. You will also need to connect the Ethernet cable to your router or you can simply use an USB to Ethernet

    adapter.

    Upon first boot, you will see the following screen:

  • On the latest build (10.0.10152.0), in the upper right hand corner, we now have Device Info and Tutorials. There is also a Setting Button and Power button on the left hand side. Most of these options are self-explanatory, but are a welcome edition. You will need a mouse connected to access these.

    On the main screen, you will see the network information, PC name, OS version as well as a list of all the currently connected devices.

    It was interesting to me that it detected several devices that I had plugged into the USB ports such as my gaming keyboard and a very

    old MS Mouse and hub. It did not detect my USB WiFi dongle support for that will be added in a future release.

    Great, weve got it installed and booting! Now what?

    We need to run Powershell on our Windows 10 Box to setup a few things. Once you are at the Powershell prompt, then follow the

    instructions below.

    Use this command to enable remote connections.

    net start WinRM

    Next, set the Raspberry Pi 2 to a trusted host. You can use the PC name or the IP Address.

    Set-Item WSMan:\localhost\Client\TrustedHosts -Value MINWINPC

    Run this command to work around a known issue in the current release.

    remove-module psreadline -force

    Finally, start a remote session. Again, you can use the PC name or the IP Address.

    Enter-PsSession -ComputerName MINWINPC -Credential MINWINPC\Administrator

    Youll now see an IP address in front of the PowerShell prompt. It can take about 30 seconds or so to appear. At this point, you may want to change your password, set the computer name or a vast variety of other options. All of these are documented on Microsofts Command Line Utility page.

  • If you havent done so, now is a great time to go ahead and run the Windows IoT Watcher Application.

    Note that the right click commands to open a network drive or system stats dont work. More on that later.

    Exploring the Web Server built into Windows 10 IoT Core

    Included with the OS is a web server that you can access by going to http://minwinpc:8080, where minwinpc is the name of your

    device. This provides a great deal of information, as shown in the screenshots below.

  • Apps Provides install/uninstall functionality for AppX packages and bundles on your device. Processes Allows you to see which processes are currently running as well as the memory usage associated with each one. Performance Real-time diagnostics of CPU and I/O usage, and memory stats. Debugging Helps identify problems with your app. ETW Is Event Tracing for Windows. Performance Tracing Allows you to record a trace log of various system settings.

  • Device List all devices currently connected. Networking Shows the IP address and description of the connection.

    Writing our First App to install on Windows 10 IoT Core

    Since you already have Windows 10 installed, you will need Visual Studio and the Windows 10 Developer Tools.

    After the tools are installed, open Visual Studio 2015 and select Visual C# -> Windows -> Windows Universal -> Blank App to create

    a new project. In MainPage.xaml, it provides some simple markup as shown below.

    This is a good time to go back to your PowerShell prompt and double check that the remote debugger is active. You can do this while

    logged in with one line.

    schtasks /run /th StartMsVsmon

    Before deploying, you need to set the project platform to ARM and make sure the target device is Remote Machine and provide the machine name as shown below.

  • Once this is in place, you can now run your project and it should appear on your device:

    Great! We have a simple app running, lets see what else we can do.

    Using Teleriks UI for Windows Universal Suite

  • Most IoT developers are hooking their boards up to sensors that monitor things like CPU temps, outside temperature and more. This

    requires a chart to get a nice look and feel. Since I dont have any accessories at this time, were going to simulate some data that makes up a bar chart that displays the info on our IoT device.

    Download and install UI for Windows Universal. Were going to be working with RadChart, so using the same project from the previous example, we need to add a reference to Telerik UI For Windows 8.1 found in our Windows Universal -> Extensions. Once that is complete, create a class called Data and add the following code:

    public class Data

    {

    public string Category { get; set; }

    public double Value { get; set; }

    }

    The code for our MainPage.xaml is as follows:

    The code for our MainPage.xaml.cs is:

  • public MainPage()

    {

    this.InitializeComponent();

    Loaded += MainPage_Loaded;

    }

    private void MainPage_Loaded(object sender, RoutedEventArgs e)

    {

    List data = new List();

    data.Add(new Data() { Category = "CPU Temp", Value = 64 });

    data.Add(new Data() { Category = "Outside Temp", Value = 86 });

    data.Add(new Data() { Category = "Inside Temp", Value = 71 });

    this.barSeries.DataContext = data;

    }

  • Run It!

    You may have to zoom into this image to see the Category and Value information as I left it as default. You can learn how to style it here.

    Background Application Template

    Microsoft has released a Visual Studio template in case you want to run an application as a background task. Simply navigate to the

    Visual Studio Gallery and search for windows iot and you should see the template provided below.

  • Install it and you will have a new template added to Visual Studio 2015. This template only contains a class and no markup, as

    expected, since the app will have no UI.

  • So much more!

    Im very excited about the possibilities of Windows 10 IoT Core, but Ive barely scratched the surface. With the second preview, you can already do things such as:

    Create Custom Windows 10 IoT Core Images

  • Use a Preview Porting Tool to see which APIs are available on Windows 10 IoT Core Use WINDBG to debug

    Along with all of that, there is already a plethora of sample apps to help you get started. So what are you waiting for? Get a device and

    join the fun!