Setting up Windows Ten for IoT on your Raspberry Pi
This week on the BUILD conference in San Francisco Microsoft released the first preview of the Windows IoT (Internet of Thi NGS) for Raspberry Pi 2 (AS-well-lovely devices like the Intel Galileo and Minnowboard Max).
First, as I mentioned in February the Raspberry Pi 2 runs the Windows IoT version. That means there is no "shell" or Windows Explorer. It's not a tiny desktop PC, but rather the core brain of whatever embedded maker thing your choose to build with it. The core of it is Windows. You've got PowerShell, you can run Windows Universal Apps that's write in C #, and you can talk to peripherals.
Over here at Http://microsoft.hackster.io there are a great list of projects you can build with Windows IoT, including a CO OL robot you can control with an Xbox Controller.
Installing Windows Ten on your Raspberry Pi 2
This is a early build so things'll change and get easier I ' m sure. To is frank, getting the builds for Raspberry Pi took some confusing on my part to download.
- Go to the Windows Embedded Connect site and sign in.
- Pick the Build you want. I got Windows IoT Core insider Preview Image for Raspberry Pi 2.
- You'll need to install the older "File Transfer Manager" If you don't have it. If you had Chrome, you'll need to click the ". DLM" file and open it with the file Transfer Manager. You'll also need to accept the EULAs.
- Then you'll get a large ZIP file with the image of you want inside. Unzip somewhere.
- Here's a kicker, you'll need a Windows Preview machine to run these commands and install.
- I built one with a laptop I had around. I ' m not sure why Windows needed. However, once it ' s setup you can use Windows 8.1 to talk to the Pi 2 or Remote PowerShell in.
- You should also get Microsoft Visual Studio RC.
- After your install, go try to make a Universal App and it'll download the Universal apps SDK.
- Follow the instructions here. Below is my summary along with the gotchas that slowed me down.
Now, the plug your micro SD card into the Your Windows PC (I use a micro-to-USB adapter) and open an Administrator PowerShell a nd run:
- WMIC diskdrive list brief and make note of the physical disk number of your SD Card.
Next run this and the change physicaldriveN to whatever your SD Card ' s physical number is.
dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDriveN /SkipPlatformCheck
- Note: I had some issues and got "Error" on one of my micro SD cards. changing cards worked. Not sure "s up.
Now, the just put your micro SD card into the Your Pi 2 and boot up your PI 2 while connected to a display and Ethernet. It'll initially startup very slow. It could is 2 to 4 minutes before you get to the main screen. Just hang in there until to see this screen. This is the Default app and just shows the IP Address of your Raspberry Pi 2.
Now, the from your local admin PowerShell run these commands to the remote into your Pi 2. The default name is MINWINPC and can also use the IP address.
net start Winrmset-item wsman:\localhost\client\trustedhosts -value Minwinpcremove-module-forceenter- pssession -computername MINWINPC -credential minwinpc\ Administrator
When the credentials dialog opens, make sure your use Yourrpi2machinename\administrator or yourrpi2ipaddress\administrator For the user name. I was just using Administrator. The default password is [e-mail protected] and you should change it.
See where is the PowerShell prompt changes to include the remote machine's name after I ' ve remoted in?
On your Windows machine install the MSI, that is included in the download. It would start a small watcher utility that would scan your network and look for Microsoft IoT devices. It's easy to lose them if their IP address changes. It also have a nice right click menu for getting to its embedded Web server.
Included and running on the image are a Web server that would let you explore attached devices and running processes.
You can also deploy applications from this although you'll usually do it from Visual Studio.
As of the time of this blog post they didn ' t has WiFi and Bluetooth ready yet but they is updating it often so I am sure We ll see updates soon. Here is a list of devices this work today via USB.
There ' s lots of samples. You can make Background (headless) IoT apps or does ones with a UI since the Raspberry Pi have HDMI built in.
Finally, here's turning on a LED from C # (with comments and defensive code).
Using Windows.Devices.Gpio;Private void Initgpio(){ VarGpio= Gpiocontroller.Getdefault(); Show An error if there is no GPIO controller If (Gpio== Null) {Pin= Null; Gpiostatus.Text = "There is no GPIO controller on this device."; Return; }Pin=Gpio.Openpin(Led_pin); Show an error if the pin wasn ' t initialized properly If (Pin== Null) { Gpiostatus.Text = "There were problems initializing the GPIO pin." return;} Pin. Write (gpiopinvalue. High Pin. Setdrivemode (gpiopindrivemode. Output gpiostatus. Text = "GPIO pin initialized correctly." } /span>
Deploying from Visual Studio
Make sure the remote debugger was running with schtasks/run/th Startmsvsmon and connect with no authentication while it ' s Running.
Now the can deploy a Universal App (with ui!) directly from Visual Studio:
And here is my amazing app. Which is basically just a bunch of controls I threw onto the XAML. But still. fancy!
Windows Remote Arduino and Virtual Arduino Shields
A Few other cool maker things worth pointing out is Windows Remote Arduino and Virtual Arduino Shields. Remote Arduino lets your Arduino from your Windows machine using the Firmata protocol. Then your can reach out to an Arduino device and give it commands from a Windows Universal app. The virtual Arduino Shields lets you with a Windows Phone as a well, just that, Virtual Shields. Shields for the Arduino can add up and when do you ' re prototyping-not want-to-shell out for a Gyro or GPS. A cheap phone like a Lumia 530 have like $ worth of sensors (GPS, touch display, gyro, Internet, speech, etc) in it You can exploit.
It's early days but I'm pretty stoked about all the options that makers has available. The ASP. Talks with the IoT folks-see if we can get the ASP. NET 5 running on Windows IoT on a Raspberry Pi as Well, so stay tuned. Get started here.
Related Links
- Microsoft IoT GitHub Repository
- Windows IoT Home
- Downloads for Windows IoT
Sponsor: Big thanks to the folks-to-Grape-sponsoring the feed this week. Grapecity provides amazing development tools to enhance and extend application functionality. Whether it is. NET, Html5/javascript, Reporting or spreadsheets, they ' ve got you covered. Download your free trial of ComponentOne Studio, ActiveReports, Spread and Wijmo.
Raspberry Pi 2 win ten IOT