Windows IoT with Intel Galileo
Intel Galileo board runs on Linux operating System by default but we can also make it run on more powerful version of Linux or Windows through a micro SD card. Windows is free for screen size less than 9” so licensing will not be a problem. You can use it for free as Linux on your Galileo board. Also the question arises here that “Why to use Windows OS for IoT?” the reasons can be -
- Familiar Operating System.
- Easy to use tools and Powerful developing environment through Visual Studio which will allow you to debug your code.
- Access to many libraries that runs on Windows.
- Mostly all Arduino shields are compatible including Grove base shield.
- You are a Windows Fan.
For this article I am using Intel Galileo gen2 board. If you are having Gen1 board all the steps are same. There are many supported boards, the other Windows OS supported boards are:
- Raspberry Pi 2
- MinnowBoard MAX
- Intel Galileo
Let’s see how to get start with Windows on our little board.
Prerequisites
Hardware
- Intel Galileo board.
- Power Supply for Galileo.
- Ethernet Cable Ethernet to USB adapter
- Micro SD Card (16 GB or more)
- Micro SD card reader
- A LED
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/WP_20150823_006.jpg
Software
Visual Studio 2013 Currently the supported IDE with Intel Galileo is Visual Studio 2013 Express, Professional, Premium or Ultimate. VS 15 is not currently supported. If you don’t have Visual Studio 2013 you can download it from https://www.visualstudio.com/downloads/download-visual-studio-vs .
Setting Up your PC
1. Install telnet on your Computer.
Telnet provided access to a command-line interface on a remote host. Through telnet we will access our board remotely. On your PC go to Control Panel -> Program and Features, Select “Turn Windows Features On or off” Windows Features Windows will open. Check “Telnet Client”. Click Ok and Restart the Computer.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/6.png http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/7.png
2. Connect Windows Developer Program for IoT
Install WindowsDeveloperProgramforIoT.msiii . You need to register on the Connect Windows Developer Program for IoT with a Microsoft account.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/1.png
3) After running this file you will notice two main changes in your Computer.
It will install a utility called Galileo Watcher which will help you to access your board and
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/31.png
- In Visual Studio there will be a template for IoT called “Galileo Wiring App” in New Projects
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/5.png
Setting Up the Galileo Board
Update the firmware on the board as described here http://poojabaraskar.com/getting-started-with-intel-galileo/ .
Creating Bootable Windows Image for Intel Galileo
Software Package: Download Microsoft Windows for Galileo from http://connect.microsoft.com/windowsembeddedIoT/Downloads/DownloadDetails.aspx?DownloadID=56801 Download apply-BootMedia.cmd from http://connect.microsoft.com/windowsembeddedIoT/Downloads/DownloadDetails.aspx?DownloadID=56801 Create a new folder in the root of the directory and name it “galileo” and place these two downloaded files in that. I place them in C:\ drive as it is easier to access this way. My SD card came in D:\ drive.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/10.png
Connect your micro SD card to your PC and Format it with Fat32 file system. If there will be any data Windows image creation will going to be fail. Let us create a Bootable Windows Image for Galileo-
- Go to Command Prompt, right click it and select ”run as Administrator” http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/11.png
- Navigate to your “galileo” folder(where you saved the downloaded files)
- Type:
{Files containing directory}apply-bootmedia.cmd -destination {YourSDCardDrive} -image {.wimFile downloaded above} -hostname mygalileo -password admin
For example in our case
C:\galileo>apply-bootmedia.cmd -destination d:\ -image 9600.16384.x86fre.winblue_rtm_iotbuild.150309-0310_galileo_v2.wim -hostname mygalileo -password adminn
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/12.png
Here we are using apply-bootmedia.cmd to create the image on the destination drive on which our SD card is mounted. You need not to write the whole image name just write “–image” and press TAB key, the Command Prompt will complete that for you. You have to pass to more parameters “hostname” and “password” for your Administrator account of Windows. It is highly recommended to use “mygalileo” as hostname and “admin” as password. Unless you do not have a valid reason stick to this. Visual Studio template for IoT uses “mygalileo” as default hostname, if you change here make sure to change in Visual Studio debug configurations. The mounting process will start, it will take some time. Before applying the image it pauses for a minute, give it some time. This whole process will take around 10 minutes. After that it will display the hostname, timezone, username and password.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/13.png
Connecting and booting Windows
Once your bootable image is ready you can mount it to your Intel Galileo board in the SD card slot. Connect your board to power supply, Galieo gen1 and gen2 board uses different power supplies. If you are using Gen2 board use the 12 volt power supply and with Gen1 use a 5 volt power supply. 1) Connect one end of your network cable to Intel Galileo. 2) Connect the other end of network cable to the Ethernet port of your Computer or you can use Ethernet-USB adapter if you do not have a free Ethernet port. 3) Power your board. 4) Galileo will start booting from the SD card image of Windows OS. The SD card light will start flickering during this process. When the light settles down it will finish booting, this process can take around 2 minutes.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/WP_20150824_006.jpg
Galileo Watcher
Now you can run Galileo Watcher utility. The “Galileo Watcher” will automatically detect your board. If it doesn’t make sure that it has network access through firewall. This utility will display some information about your board such as its Mac address and Ip address also has a check box to show whether your Galileo is connected or not. When you right click on board it will open a Handy Context Menu, with this you can copy the Mac and Ip address or remotely connect to your Galileo.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/14.png
Telnet heree – It will start a telnet session with the board. You will be able to get a remote command prompt against your Galileo. It will ask for Username and password. Which are:
Username: Administrator
Password: admin
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/15.png
Web Browser here – There is a webserver running on MinWin, you can see a task list, process running on your board, file list and memory statistic. It is like a Task Manager for Galileo. You can just open a web browser and type http://<your galileo host name or ip address>
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/tasklist.pnghttp://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/memory.png
Open Network Share- The Windows on Galileo has a c$ share. You will get a remote file system. The connection parameters are:
Username: mygalileo\Administrator
Password: admin
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/16.png
You can type \mygalileo\c$ in file explorer to open a network share. If it won’t recognize the username you can use IP address.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/17.png
Developing your first Application for Galileo on Windows
When we set up an electronic board we first test it by running a program for blinking the LED. It is same like running your Hello world program. So let’s write our Hello World application for Windows on Galileo.
1) Attach an LED to pin 13. They have polarity which means we need to connect them in the right order. There are many ways to differentiate between cathode and anode of the LED, we can tell that by looking at the LED carefully in many ways.
-The longer leg will be the cathode and the shorter will be the anode
-When we examine the LED from the top we see the two metal posts, the smaller of the two is the anode and the bigger is the cathode
2) Open Visual Studio 2013, go to File->New->Project, under templates Visual C++ -> Windows for IoT -> Galileo Wiring app.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/newproject.png
3) It is basically a C++ console app that has references to the Galileo –SDK to allow it to talk to the Arduino side of things. Underneath the Project in Main.cpp you will find all you code.
4) It is a default Blink Sketch. The sketch looks almost similar to one like in Arduino, the only difference is the Log method which writes the output to both stdOut and debugger.
http://poojabaraskar.azurewebsites.net/wp-content/uploads/2015/08/program.png
5) Run your program by clicking on Remote Windows Debugger or by pressing F5. At first connection attempt it will prompt for credentials. Username: mygalileo\Administrator Password: admin Now you will see you LED blinking, hence you have successfully deployed your first application on Windows on Galileo.