This is the first post in a series exploring Windows IoT on Raspberry Pi 3. In this post, I'll cover the what and the why of Windows IoT, then show how to install it on a Raspberry Pi 3 and finally how to deploy a first app to it.
What Is This Thing?
Windows IoT is a version of Windows 10 designed for small form factor, low cost, Internet connected devices.
It has three versions. IoT Core is free, and is the one most people will care about. It currently works on four devices (three boards):
- Raspberry Pi 2 (Broadcom BCM2835 )
- Raspberry Pi 3 (Broadcom BCM2837)
- Arrow DragonBoard 410c (Qualcomm Snapdragon)
- MinnowBoard MAX (Intel Atom)
Windows IoT Core has no shell (e.g. no start menu) and so when running a mouse and keyboard on an LCD feels like a single app version of Windows. Otherwise, this free operating system has no limitations. You can take a product to market on hundreds of thousands of devices and pay absolutely nothing for the OS.
IoT Enterprise and Mobile Enterprise, aren't free. They're more for ATM or Point of Sale scenarios. IoT Mobile Enterprise uses a "modern shell" like a Windows phone. IoT Enterprise additionally works on x64 and larger devices and uses a "desktop shell" like traditional Windows 10. They also allow system administrators to defer system updates.
Windows, Seriously?
There are a lot of options if you're looking to build a device that interacts with the real world. Arduino, for instance, is a fantastic choice if there's a chance you'll ever mass produce your thing, since you can find ATMEL chips that cost less than $2 and the ecosystem and set of libraries is huge. Also your thing will run faster (realtime even) without the overhead of an operating system.
However, if your thing will require:
- Multitasking (e.g. serving up web pages)
- Running USB peripherals
- Displaying on an LCD screen, or
- Connecting to the Internet
Then one of the boards listed above may be a better choice. But why not just run Linux?
Security is one benefit. For one thing, you get automatic updates to help patch future vulnerabilities. There's also Native UEFI , which helps protect against malware at the firmware and driver level. There's Trusted Platform Module (TPM) support, which helps move cryptography operations to the hardware level. Identity protection and access control may be important if you're running a kiosk that multiple people could log on to. And there's even support for BitLocker and Enterprise Data Protection if things like encryption at rest, auditing, or remote device wiping matter to you.
For another thing, Windows IoT makes it easy to connect with other devices and services. You can, for example, easily and securely connect to Azure IoT Hub which can theoretically aggregate data from millions of devices in realtime. It also has built in support AllJoyn, which is a way of connecting to other IoT devices.
But one of the biggest benefits is the Windows ecosystem. You build apps for it with Visual Studio, which is top notch IDE. You can port existing Win32 or .NET applications to Windows IoT far more easily than to Linux. You get remote desktop. You can write in C#, Python, JavaScript, or Arduino C, and even embed Arduino libraries. If you have experience building .NET apps, then the learning curve is extremely low. And finally if you want your app to additionally target large screens, tablets, phones, and even XBox, then Windows IoT is your only option, because Windows IoT is designed to run Universal Windows Platform apps.
Device Setup
If you don't already have a Raspberry Pi 3, pick up one of the many good kits that includes an adequate power supply (outputs at least 1 Amp, 2 is better), a fast Micro SD card, and perhaps a case.
Once you have a device, you'll need to set it up with the Windows IoT operating system. As of this writing, the official release is Build 10586, December 2015. Unfortunately, this version doesn't work with Raspberry Pi 3. Consequently, you'll need the Insider Preview of Windows IoT.
To set a new Raspberry Pi 3 device, follow the Insider Preview Setup Instructions (or if they've RTM'd, download the Core IoT Dashboard). You'll download an image (Build 14295 supports remote desktop) and use the IoT Dashboard app to flash the image to an SD card.
Now you can put the SD Card into your Raspberry Pi, plug an HDMI cable into a monitor, and attach power via micro USB. If all goes well, you should see Windows loading up.
Once it's loaded up, it will start the default app, which provides a place for basic device configuration.
Before you can go much further, you need to set up Internet access. You can do that most easily via Ethernet cable or approved WiFi device (careful, the list isn't big), and power it on.
But wait, doesn't Raspberry Pi 3 have build-in WiFi? Unfortunately, that isn't supported in the current build. Hopefully, it will be in there soon.
Once you have the device on the network, you'll have a much more robust set of options for accessing it. You can, for instance, get in through PowerShell.
Or better, when you go to Devices in the IoT Dashboard app, your device should be listed. If you click the web link, you can access the snazzy web browser interface. This might be a good time to change the device name and password.
Build Environment Setup
Great, now you've got an Internet connected mini PC with no software. To write apps for it, you'll need to set up a "real" PC with Visual Studio.
To set up your PC to build apps for Windows IoT, you need Visual Studio 2015 Update 1 or better (any edition). Be careful, when doing so, you need to select the "Universal Windows App Development Tools" feature or else you'll get the ever helpful...
Error: this template attempted to load component assembly
'Microsoft.VisualStudio.Universal.TemplateWizards, Version=14.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. For more information
on this problem and how to enable this template, please see documentation
on Customizing Project Templates.
Next, install the Windows IoT Core Project Templates. Restart Visual Studio.
Finally, enable developer mode to enable installing store apps via Settings, Updates & Security -> For Developers -> Developer mode
Hello World
To create a hello world app:
- File -> New -> Project
- Blank App (Universal Windows)
- Add a reference to the Windows IoT extension SDK:
- Update MainPage.xaml with some XAML like:
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Hello World</TextBlock>
- Under solution Platform Select: Arm
- For Device Configuration, select Remote Machine
- In the resulting dialog, type the name of your device.
- Hit F5!
Once you've done that, try putting a button on the screen, setting breakpoints, inspecting variables. You'll find it's the exact same experience you've come to love in other Visual Studio projects, just in a small, inexpensive form factor.
Summary
This post has covered the what and why of Windows IoT as well as how to configure a Raspberry Pi 3 for Windows IoT and deploy a very simple application to it. The next post in the series will cover how to control pins, and how to run a simple motor.
Lee Richardson is a senior software developer at
Inferno Red with a passion for .NET development, open source software, continuous integration, building cross platform mobile apps, and hardware hacking. In his spare time, he runs
Siren of Shame. He has been consulting in the Washington DC area for over 17 years. Keep up with him
@lprichar.
CodeProject