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:


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.



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).



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.


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.


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.


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.


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.


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.



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).


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.



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).


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!



Disabling Windows Update in Windows 10 IoT Core

If you’re working with Windows 10 IoT Core on your devices and have wondered how you can disable Windows Update, well wonder no more! This article will detail out the steps needed to disable this service.

First off, I’d like to state that I don’t recommend that you disable Windows Update on your devices running Windows 10 IoT Core, as this will prevent any future updates from being installed on your devices. Doing so may expose your devices to security vulnerabilities that would be potentially resolved in an update of IoT Core.

However, there may be some situations where you need to disable Windows Update on your devices, such as controlling the amount of data downloaded to your device (if connected to the Internet through a metered connection), or you need a completely stable environment that doesn’t ever change (giving an administrator the ability and control to update only when absolutely necessary).

Having said the above, here are the steps needed to disable Windows Update on devices running Windows 10 IoT Core:


  1. Install and Run IoT Core Dashboard

Download and install IoT Core Dashboard (link) to a Windows 10 PC that is on the same network that your target device is connected to. Once you have installed IoT Core Dashboard you can run it by typing ‘IoT Core Dashboard’ in the Windows 10 Start menu search box:


  1. Launch Remote PowerShell session on Device

Once IoT Core Dashboard is running, you should see a device entry listing (under ‘My Devices’) for the target gateway device. Right mouse click this entry to display a context menu and click on ‘Launch PowerShell’. This will launch a remote PowerShell window to the target device – you will be prompted for a username and password to access the device.


  1. Verify PowerShell session windows is displayed

Once you enter a username and password for the target device, you will see a PowerShell window for the target device, similar to this:


  1. Enter PowerShell commands to disable Windows Update

The following PowerShell commands will disable Windows Update on the target device:

sc.exe config wuauserv start=disabled

sc.exe stop wuauserv


Here is a screenshot of the results of running these commands. This is what you should see if the commands have executed successfully:



  1. Verify Windows Update is disabled

The following PowerShell commands will verify that Windows Update has been disabled on the target device:

sc.exe query wuauserv

reg.exe query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv /v Start


Here are some screenshots of the results of running these commands. The first command should show a STATE of 1 (STOPPED), while the reg.exe query should show a REG_DWORD value of 0x4:




You are finished! Windows Update should now be disabled on the target device.

There is another option for disabling Windows Update on your devices running Windows 10 IoT Core, and that involved disabling this when creating the OS image for your device (the .FFU file). Disabling Windows Update with this option would mean that after flashing IoT Core on the device you would have it permanently disabled right from the get-go, meaning you would not have to run the PowerShell command described above.

If you are using Windows Configuration Designer (link) when creating your IoT Core image, there are options that allow you to disable Windows Update and other types of updates on the device. These settings are under Runtime Settings/Policies/Update and there are 4 different settings to control updates (see highlighted areas in the screenshot below):


I hope this article helps in understanding the options and steps in disabling Windows Update on your devices running Windows 10 IoT Core.


Thanks for reading!