树莓派 2 win 10 IOT

Setting up Windows 10 for IoT on your Raspberry Pi

This week at the BUILD conference in San Francisco Microsoft released the first preview of Windows 10 IoT (Internet of Things) for Raspberry Pi 2 (as well as other lovely devices like the Intel Galileo and MinnowBoard Max).

First, as I mentioned in February the Raspberry Pi 2 runs the Windows 10 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 you choose to build with it. The core of it is Windows. You‘ve got PowerShell, you can run Windows Universal Apps that you write in C#, and you can talk to peripherals.

Over here at http://microsoft.hackster.io there is a great list of projects you can build with Windows IoT, including a cool robot you can control with an Xbox Controller.

Installing Windows 10 on your Raspberry Pi 2

This is an early build so things will change and get easier I‘m sure. To be 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 10 IoT Core Insider Preview Image for Raspberry Pi 2.
  • You‘ll need to install this older "File Transfer Manager" if you don‘t have it. If you have Chrome, you‘ll need to click the ".dlm" file and open it with the File Transfer Manager. You‘ll also need to accept two EULAs.
  • Then you‘ll get a large ZIP file with the image you want inside. Unzip somewhere.
  • Here‘s a kicker, you‘ll need a Windows 10 Preview machine to run these commands and install.
    • I built one with a laptop I had around. I‘m not sure why Windows 10 is 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 2015 RC.
    • After you install 2015, go try to make a Universal App and it will download the Universal Apps SDK.
  • Follow the instructions here.  Below is my summary along with the gotchas that slowed me down.

Now, plug your micro SD card into your Windows 10 PC (I use a micro to USB adapter) and open an Administrator PowerShell and run:

  • wmic diskdrive list brief and make note of the physical disk number of your SD Card.

next run this and change PhysicalDriveto 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 50" on one of my micro SD cards. Changing cards worked. Not sure what‘s up.

Now, just put your micro SD card into your Pi 2 and boot up your Pi 2 while connected to a display and Ethernet. It will initially startup very slow. It could be 2 to 4 minutes before you get to the main screen. Just hang in there until you see this screen. This is the Default app and just shows the IP Address of your Raspberry Pi 2.

Now, from your local admin PowerShell run these commands to remote into your Pi 2. The default name is MINWINPC but you can also use the IP Address.

net start WinRM

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

remove-module psreadline -force

Enter-PsSession -ComputerName MINWINPC -Credential MINWINPC\Administrator

When the credentials dialog opens, make sure you use yourrpi2machinename\Administrator or yourrpi2ipaddress\Administrator for the user name. I was just using Administrator. The default password is [email protected] and you should change it.

See here how the PowerShell prompt changes to include the remote machine‘s name after I‘ve remoted in?

On your Windows machine install the MSI that was included in the download. It will start a small watcher utility that will scan your network and look for Microsoft IoT devices. It‘s easy to lose them if their IP address changes. It also has a nice right click menu for getting to its embedded web server.

Included and running on the image is a web server that will let you explore attached devices and running processes.

You can also deploy applications from here although you‘ll usually do it from Visual Studio.

As of the time of this blog post they didn‘t have WiFi and Bluetooth ready yet but they are updating it often so I am sure we‘ll see updates soon. Here is a list of devices that work today via USB.

There‘s lots of samples. You can make Background (headless) IoT apps or do ones with a UI since the Raspberry Pi has HDMI built in.

Finally, here‘s turning on an LED from C# (with comments and defensive code).

using Windows.Devices.Gpio;

private void InitGPIO()

{

    var gpio = 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.";

}

Deploying from Visual Studio

Make sure the remote debugger is running with schtasks /run /th StartMsVsmon and connect with no authentication while it‘s running.

Now you 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 are Windows Remote Arduino and Virtual Arduino Shields. Remote Arduino lets you talk to your Arduino from your Windows  machine using the Firmata protocol. Then you can reach out to an Arduino device and give it commands from a Windows Universal app. The Virtual Arduino Shields lets you use a Windows Phone as a well, just that, virtual shields. Shields for Arduino can add up and when you‘re prototyping you may not want to shell out for a Gyro or GPS. A cheap phone like a Lumia 530 has like $200 worth of sensors (gps, touch display, gyro, internet, speech, etc) in it that you can exploit.

It‘s early days but I‘m pretty stoked about all the options that Makers have available. The ASP.NET team is in talks with the IoT folks to see if we can get ASP.NET 5 running on Windows IoT on a Raspberry Pi as well, so stay tuned. Get started here.

Related Links



Sponsor: Big thanks to the folks over at Grape City for 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.

时间: 2024-10-06 23:32:39

树莓派 2 win 10 IOT的相关文章

玩转树莓派——安装 Windows 10 IoT Core

在树莓派上运行过Windows 3.1,自然也想运行Windows 10.于是准备在树莓派上安装一个Windows 10 IoT Core的系统. 写下这篇文字的时候,其实已经不是第一次安装运行Windows 10 IoT Core了.在我生日那天拿到树莓派之后,就立即尝试了一把Windows 10 IoT Core.当时正式的Pi 3的支持还没有发布,使用的是Windows Insider的版本.树莓派3和树莓派2最大的不同,是自带WiFi和蓝牙适配器.而当时Windows 10 IoT的版本

树莓派3 Windows 10 IoT Core

下载地址:https://developer.microsoft.com/zh-cn/windows/iot/Downloads 先下载安装 Windows 10 IoT 核心版仪表板: 安装完成后运行,准备好SD卡 选择好版本SD卡,设置好密码 提示SD卡会被格式化 然后是漫长的下载过程 下载完成 开始写入SD卡 SD卡插入树莓派,通电开机 选择语言 安装完成… 下面捣鼓下看看怎么把带了个3.5的LCD屏幕弄亮… 貌似人家豪都是用7寸的…

Windows 10 IoT Serials 4 - 如何在树莓派上使用Cortana语音助手

从Windows 10 IoT Core 14986版本开始,微软已经加入Cortana语音助手功能.之前,我们只能使用本地语音识别,需要编写应用程序,下载到设备中才能实现.从现在开始,微软已经从系统层面融入了Cortana语音助手,用户可以通过系统设置,开启Cortana,实时地与Cortana进行交互了.下面我们以树莓派为Windows 10 IoT Core设备,尝试一下使用Cortana的过程. 1. 硬件准备 树莓派2/树莓派3.5V/2A电源.TF卡(8GB以上) 麦克风:Micro

Windows 10 IoT Serials 2 - Windows 10 IoT RTM 升级教程

7月29日,微软推出了Windows 10 for PC的正式版,其版本号是Build 10240.近两天官方说已经有4700万的下载安装量,同时这个数字还在不断攀升.另外,除了Windows 10 for PC版本以外,还有针对手机的Windows 10 for Mobile版本,据说RTM也会很快到来,而网上也曝光了小米4刷Win10的一些机友的帖子.与PC和Mobile版本不同,IoT版本针对物联网领域的应用.几乎与PC RTM同时,Windows 10 IoT Core也RTM了,并且微

玩转树莓派——升级NOOBS离线安装介质到Raspbian 4.9和Windows 10 IoT C

为树莓派做系统升级是我一直想做的事.时间总是觉得不够,于是也好久没有碰. 直到前几天MVP群里有兄弟问大家的github来互相关注,我才突然想起之前写过的制作离线安装介质的文章:http://haohu.blog.51cto.com/2474833/1858600 因为之前把制作Windows 10 IoT Core需要的文件放到了github上.前不久刚把电脑的Windows 10更新到了1703,也是时候更新树莓派上的Windows 10 IoT Core了.(据说有不少新东西,比如Cort

【Window 10 IoT - 1】Window 10系统安装(树莓派 Pi2)

一.硬件准备 (1).树莓派Pi2 (2).8G 10速Micro SD卡 (3).LCD显示器(如果是VGA接口,需要加一个HDMI转VGA模块) (4).鼠标 (5).安装Windows 10的PC(需要物理直接安装,不能虚机机方式,本篇文章不是必须) 二.软件准备 (1).Windows 10 IoT 树莓派固件(Windows_IoT_Core_RPI2_BUILD.zip) 固件下载链接: https://connect.microsoft.com/windowsembeddedIoT

Windows 10 IoT Serials 5 - 如何为树莓派应用程序添加语音识别与交互功能

都说语音是人机交互的重要手段,虽然个人觉得在大庭广众之下,对着手机发号施令会显得有些尴尬.但是在资源受限的物联网应用场景下(无法外接鼠标键盘显示器),如果能够通过语音来控制设备,与设备进行交互,那还是很实用的.继上一篇<Windows 10 IoT Serials 4 - 如何在树莓派上使用Cortana语音助手>之后,本文将详细讲述如何为运行Windows 10 IoT Core系统的树莓派添加语音识别和语音交互功能. 1. 硬件准备 树莓派2/树莓派3.5V/2A电源.TF卡(8GB以上)

玩转树莓派&mdash;&mdash;制作包含Windows 10 IoT Core和Raspbian的离线安装介质

How to make Windows 10 IoT Core offline install media for Raspberry Pi 前几天在树莓派上更新Receiver for Linux 13.4,又尝试在Pi上安装Visual Studio Code,结果觉得系统有点不正常了,于是打算重新刷一遍. 之前的系统使用了一张16 GB的TF卡,直接使用NOOBS lite进行在线安装.之前说了这样安装有个好处,就是安装文件本身不占太多的空间,更多的空间可以给系统使用. 可是--下载好慢啊

【Windows 10 IoT】为Win10 IoT镜像添加默认应用(树莓派)

[Windows 10 IoT]为Win10 IoT镜像添加默认应用(树莓派) 在Windows 10 IoT应用程序开发好之后,一般通过IoT WebManagement或者直接用vs将应用部署上去.并且执行命令iotstartup.exe add headed/headless AppxID,将应用设置为开机启动.但是,如果想基于一个开发板,量产某种硬件设备,这种方式肯定是不可行的. 我们会想到,是否可以将我们的应用直接打包到镜像中,并设置成为开机自启的默认应用呢?当然可以. 基本原理是这样