Beginning IoT – Installing Windows 10 IoT Core on a Raspberry Pi

This is the first part in a 2-part series on how to install Microsoft Windows 10 IoT Core on an Internet-of-Things (IoT) device. This article will focus on the steps required to install Windows 10 IoT Core on a Raspberry Pi 3. Part 2 will focus on installation on an x86/x64 device.

 

What is Windows 10 IoT Core?

Windows 10 IoT Core is a version of Microsoft’s Windows 10 operating system that has been optimized for smaller devices that can run on either ARM or x86/x64 devices. These devices can run with or without a display device.

When we talk about the different IoT devices, the processor type needs some explanation. ARM devices are called Advanced RISC Machines, with RISC standing for Reduced Instruction Set Computer. What this means is that the processor has been slimmed down to only include a reduced set of commands it can process. While this means that the processor can’t do certain things, it requires a low amount of power to execute what it can do, so that translates to increased battery life. The Raspberry Pi is classified as an ARM device.

Devices with the x86/x64 architecture are classified as CISC processors, which stands for Complex Instruction Set Computer. These processors do not have their instruction sets slimmed down, so they can perform more complex operations, at the cost of increased power consumption (and therefore lower battery life). Intel’s Baytrail devices running the Intel Atom processor E3800 is an example of an x64 device.

https://www.intel.com/content/www/us/en/embedded/products/bay-trail/overview.html

 

Prerequisites

Before you can install on the Raspberry Pi, you need to make sure you have a PC that is running Windows 10 1507 (version 10.0.10240) or higher. You can find out what version you are running by clicking on the search box (next to the Start button) and typing ‘winver’. This will display a dialog as shown here:

1

 

You will also need to download and install the Windows 10 IoT Core Dashboard from here.

Of course you will also need a Raspberry Pi device to install onto. There are several different kits available on Amazon – I used the Canakit Starter Kit here.

Finally, you will need an SD card reader so that you can write the installation files to the SD card that will be placed in the Raspberry Pi.

 

Installation Steps

Once you have the prerequisites, you are now ready to begin the installation process.

First off, run the Windows 10 IoT Core Dashboard program, and click on Set up a new device from the menu on the left. This will display a screen that allows you to select the Device Type, OS Build and other information to configure as part of the installation.

2

Select Broadcomm [Raspberry Pi 2 & 3] as the Device Type, and Windows 10 IoT Core (17134) as the OS Build. You can also select Windows Insider Preview or Custom if you want to install a preview build of Windows 10 IoT Core, or a custom image file (flash.ffu file).

Next, insert your SD card into the Windows 10 PC you are using. Be aware that your SD card should be at least 8GB in size and I prefer formatting it prior to this step (this is optional – understand that the installation process will overwrite any pre-existing data on the SD card). The IoT Core Dashboard program should recognize the SD card and display it in the Drive selection.

You can then enter values for the Device Name and Password, and whether you want to use a Wi-Fi Network Connection when the Raspberry Pi starts up with our installation.

3

Check the box to accept the software license term and click on the Download and Install button. This will begin the installation process. During this process, Windows 10 IoT Core will be downloaded and the installation process will flash the files to the SD card.

5

If you see a prompt for UAC (User Access Control), click Yes to continue. The process may then open a command window to clean the SD card (if you had something on it previously) before it flashes the new installation onto it.

6

The installation process will then run the DISM program (Deployment Image Servicing and Management tool) to flash the installation files onto your SD card.

7

Once this is complete, the command window will close, and IoT Core Dashboard will state that your SD card is ready to be placed in the Raspberry Pi and started up.

8

Eject the SD card from your PC and place it in your Raspberry Pi. Connect an HDMI cable to a display source (monitor) and then plug in the power to start the device. If you didn’t choose to use a Wi-Fi network connection on startup you will need to plug in an Ethernet cable if you want Internet access.

IMG_0246

IMG_0243

You will first see the Windows logo with a spinner when the device is first powered on:

IMG_0236

IMG_0237

Let the device power itself on, it usually takes a minute or two (and might reboot itself). Once you get to the following screen, plugin a USB mouse and make your language selection.

IMG_0238

Clicking Next will display a screen asking if you want to configure Cortana – I selected Maybe Later.

IMG_0241

Windows 10 IoT Core will then run the default application, which looks like this:

IMG_0242

Congratulations! You have now completed the installation process and you have a standard Windows 10 IoT Core installation on your Raspberry Pi! You are now ready to begin deploying your applications to this device!

Happy coding!

 

 

Using IoT on a Beer Kegerator

Being born and raised in the great state of Wisconsin, beer has been a part of most of my adult life. Couple that with my love of technology, I always wondered how I could leverage some cool tech with a beer theme. Since the proliferation of inexpensive hardware and the Internet of Things (IoT), it has now become easy (and cheap!) to provide solutions that can be used to monitor (among other things) beer-related activities. This article will describe and detail the steps I took to create a solution for monitoring beer consumption on a beer kegerator.

The first thing I needed to do before building anything is to understand and design what it is I wanted to build. Since I want to monitor beer consumption from a kegerator, I needed to draw out the major parts of my solution. Once I know that I can then begin to build and test the different parts of the system. The drawing below shows the major parts of my solution:

1

As you can see, when someone taps a beer from the kegerator, an inline flow meter sensor sends information to an IoT device, which then processes the information and sends it to the cloud, where it is stored for data analysis.

Now that I have an idea of my overall architecture, I can begin to think about what hardware and software I need to create my solution.

 

Hardware

For hardware, I chose to use a Raspberry Pi as my IoT device. The Pi is a low-power, inexpensive device that met my needs for this project (built-in ethernet network, multiple GPIO pins, easy to install apps). Please note that I also considered using the ESP8266 chip for this project – this little chip is great for simple IoT project as it’s really cheap, has built-in wireless networking (with a full TCP/IP stack!), and multiple GPIO pins for use. The main drawback for this project is that this chip only provides 3.3v for power and I needed 5v for the flow sensor, so it was easier to use the Pi. The other drawback is that I can’t install Windows 10 IoT Core on the ESP8266, so using a Pi simplified my design.

The other piece of hardware I need is a flow sensor to measure the flow of beer through the line when it’s being tapped. Initially I chose a really cheap sensor designed for coffee-makers but found out that these won’t work for measuring beer flow (see Testing section), so I went with a more expensive sensor. I chose the Swissflow SF-800 (link), which is about $60 USD. This flow sensor sends digital pulses when a liquid is flowing through it, so that allows me to measure how much beer is being dispensed. This sensor requires +5Vdc to power it properly, so that required me to use a Raspberry Pi (which also provides +5Vdc).

 

Software

The software selections I made were driven (in part) by my hardware choices, but also by what apps I wanted to provide. I wanted to have an app that runs on the Raspberry Pi and processes the incoming pulse data from the SF-800 sensor and then send that data to Azure. I also wanted this app to have a user interface that displayed how much beer is left in the current keg, along with the ability for an administrator to “reset” the app (when the keg is empty and is changed out for a full one).

Windows 10 IoT Core provides the operating system for the Raspberry Pi, and this also allows me to easily deploy and manage any apps I want running on the device. Please review this link on how to install Windows 10 IoT Core on the Raspberry Pi.

2

The app that I am creating for this solution is a Universal Windows Platform (UWP) app and is designed for running on IoT devices that have Windows 10 IoT Core on them. This app will process the incoming digital pulses from the SF-800 and send them to Azure IoT Hub.

3

The following code snippet shows how I receive the incoming digital pulses from the SF-800 flow sensor. I have this sensor connected to GPIO pin 5 from the Raspberry Pi so that when the value on that pin changes it triggers an event in my app to signal that a pulse was sent by the SF-800.

4

I also have a timer on another thread that ticks every 0.5 second and looks to see if any incoming pulses have been received by the SF-800 flow sensor. If there have, it sends them off to Azure IoT Hub for storage.

5

The software in the Azure cloud that I will be leveraging is Azure IoT Hub, Stream Analytics and Azure SQL. Azure IoT Hub provides the mechanism to receive incoming telemetry data from my IoT device and route it for processing and storage. I am having Azure IoT Hub route my data to Stream Analytics, which then will process it and save it in an Azure SQL database. Once in the database, I am free to consume it in a number of ways, such as PowerBI or any custom app that can consume data from SQL.

6

As incoming telemetry data is received from the Raspberry Pi, Azure IoT Hub receives that data and Stream Analytics is used to process that incoming data and save it in an Azure SQL database. This is done through the Stream Analytics interface by setting up and input (Azure IoT Hub) and an output (Azure SQL database) and configuring a query to do any processing needed at that time.

7

Testing

Once I created the software components and connected the hardware that I have, it is time to test the functionality of my solution. I first tested the solution by connecting my Raspberry Pi (with my UWP app installed) to a breadboard where I have the SF-800 flow sensor connected. I also have a couple of LEDs to indicate a heartbeat pulse (green) and to indicate flow sensor pulses (red).

8

I configured Azure IoT Hub and started my Stream Analytics job so that incoming data from my IoT device will be received and processed properly. Testing this way involved blowing air through the SF-800 device (I used my breath – GENTLY!), making sure the air flow was in the proper direction (going the wrong way can damage the sensor).

Once I knew this was working I wanted to validate the accuracy of the digital pulses of the SF-800. To do this, I got some plastic tubing of the same size being used in the kegerator along with a funnel. I then measured out 1 cup of water and then proceeded to pour it through the flow sensor while everything was running.

9

Deployment

Now that I have tested my solution, it is ready for deployment! This included placing the flow sensor inline with the actual kegerator tubing on the line I wanted to monitor. I still kept the breadboard as this was not a fully productized solution (meaning I didn’t create the wiring on a PCB).

10

I encountered a testing issue I failed to realize until after I deployed my solution for the first time. I was originally using a cheap flow sensor designed for coffee makers, and when I deployed this to the beer line I noticed that it made the beer foam as it was passing through the sensor. This was something I didn’t test for prior to deployment so it forced me to rethink my design (and what sensor to use). I eventually found the SF-800 sensor and this worked much better when I deployed it with my solution.

In conclusion, now that this solution is connected to the kegerator, I can monitor how much beer is left in the current keg! I can also enhance my solution by leveraging an Azure Webjob to send an email notification when the keg is getting low. How great is that? No more tapping a beer just to find out that there isn’t any left!

Cheers!

11