This is Part 1 of the multi -part blog series Using Win10 Core and Azure IoT Services with Raspberry Pi2. For an introduction of the scenario, please refer here.
Setting up Things
In this blog post, we will set up our device to work with Win 10 RTM build.
The first thing is to make sure you have all the modules and devices required for the sample. The following specifies the pre-requisites required for the sample to work:
- Raspberry Pi 2 Model B
A Monitor with HDMI support: I used this for the demo.
Note that not all screens are compatible with Win10 Core. For hardware specification for Win 10 Core please refer here.
- A USB connected Mouse
NOTE: No other WiFi dongle will work as of today, I specify a workaround below in case you don’t have the dongle.
- A Power Supply: I used the Gomadic AA battery operated power stick and it worked well with RPi2 and Win10 Core. You don’t need this if you have a power outlet available or if you just want to boot out of your laptop USB ports. The Pi typically requires around 1.2 A to run most applications.
- A Bluetooth Adapter (Optional)– Only if you want to connect a Bluetooth device such as a mouse (NOTE: As of today only this adapter works with Win10 Core)
- A USB keyboard: In case you want to enter the network credentials when connecting to Wi-Fi.
- Windows 10 RTM image (10240). Check out the release notes for known issues here.
- A Windows 10 PC with Visual Studio 2015 RTM: For development purposes only. The code samples for this blog is in C# but you can also use other languages.
Alright! So now we have all the devices, let’s get started with our Win 10 setup. In the section, we will install the Win10 Core image on to our Pi, connect it to a network and ensure that we are able to run a Universal app remotely connecting to our Pi:
Installing Windows 10 Core on RPi2
The Windows team has a great page here on getting started with the installation of Windows 10 Core on a Pi. Use this to get your device and PC ready for development.
Boot up your Pi
Hook the RPi2 to the power supply. If all works OK, you should see a similar screen. Note that if you do not have the Pi connected to a network the Network and IP Address slots will be empty. We discuss connectivity in the next section.
Connecting Pi to a Network
To enable connectivity with Azure IoT Services, the Pi must be connected to the internet. There are multiple ways you can achieve this:
- Option 1: Using the Ethernet port: The simplest ways to connect your Pi to a network is to hook it to your router directly using an Ethernet cable. Note that if your Pi was already running you may have to restart to get the IP address for the device.
Option 2: Original Raspberry Pi WiFi dongle: The current Win 10 Core image has been tested on the Original Raspberry Pi dongle and ONLY works with this Wi-Fi adapter.
If you have any other adapter that you got using a development kit like the Canakit it will not work as of today.
Connecting to the dongle is fairly straightforward:
- Click the settings icon on the top right hand of the home screen.
- On the Device Settings screen, Select Network & Wi-Fi and select the network you want to connect. Enter credentials and you are done!
- Option 3: Using a Wi-Fi to Ethernet adapter: I hope the team will provide support for other WiFi dongle’s soon since the Pi dongle is only available from a couple of locations within the US. However, if you still want to use WiFi as an option for your device, you can use a WiFi to Ethernet adapter such as the NetGear Universal N300. I used this for my demo and it worked very well with very few disconnects or reconnections.
NOTE: Make sure both your Win 10 development PC and the Pi are connected to the same network or have network sharing enabled. We will do a remote deployment from Visual Studio so both device should be available to communicate with each other.
Testing remote connectivity
You can test the connectivity of the device using PowerShell or using the Windows IoT Core Watcher desktop app that is installed along with the Win 10 IoT Core setup.
However, I prefer using the Win 10 Core device web page that provides a clean web interface and allows you to remotely view and update* the device configuration. The device web page is courtesy a hosted web server that comes along with the Win10 Core installation.
The URL for the web page is http://<YourDeviceIPAddress>:8080/default.htm
Clicking on this page should take you to a screen such as below. As you can see, here you can select Apps to run, Manage Device, view performance metrics, setup network connectivity etc.
We are now ready to develop of Windows Universal App and deploy it to the Pi. In Part 2 of this series, we will develop a Windows Universal App that connect to Event Hub over an AMQP connection for sending user selections.