Building an IoT and Azure demo - Part 1: the plan


At MSDEVMTL, we’ll have an IoT presentation on Monday October 5th 2015 and I thought that this could be a good opportunity to present some of the Azure IoT services right after that at the Azure user group meeting on Monday October 26th 2015.  OK so now, where to start?  Well, let’s first make a plan and see what would be interesting to show in a demo.

Demo goals
Show how to connect IoT devices to Azure, send some kind of telemetry, process the data in real time and display some kind of results.  Out of the 60 minutes that I’ll have, I should spent about half that time in demo mode and the code should be simple enough to everyone in the audience to understand.

Microsoft has published a great sample project called especially to demonstrate IoT integration to Azure.  From their Website: is an open source project created by Microsoft Open Technologies to help you get tiny devices connected to Microsoft Azure, and to implement great IoT solutions taking advantage of Microsoft Azure advanced analytic services such as Azure 

Stream Analytics and Azure Machine Learning.

Sounds good!  Should I use that?  Well, like every good programmer, I like to reinvent the wheel so no, I won’t be using it but I’ll surely borrow a few things from it.  OK, the part where I like to reinvent the wheel is of course not true but in this case I think I can simplify the demo a little bit and at the same time, spend more time experimenting on my own.

IoT devices
So what about the plan?  Well, if I’ll be talking about IoT, I better get one.  Done!  Raspberry Pi 2 kit from Canakit ordered from

What about collecting telemetry?  Oh!  Look at this add-on board that Channel 9 just wrote about.  You simply plug it in the Pi’s 40 pin GPIO header and it comes with a temperature and light sensor, an accelerometer and two buttons.  It even comes with a C# library!  Fez Hat board ordered from GHI Electronics!

Now, one device is OK for a demo but what if I could get more telemetry from more devices?  How about phones?  They sure do have sensors: accelerometer, light sensor, GPS, etc.  Buttons can be simulated in software and even if they don’t have temperature sensors, I guess I can fetch the local temperature using the lat/long I can get from the device’s GPS.  In fact, I can get about the same telemetry both from phones and the Fez Hat board.  Sweet!

So what Azure service should I use?  The IoT section on the Azure main site lists these services: Event Hubs, Stream Analytics, Machine Learning and Notification Hubs.  The first two are mandatory, I need to use them, period.  Stream Analytics is interesting since it can send data to a variety of outputs.  I should at least store output to some database or data store and try to use Power BI.  IMHO, Machine Learning is a way too big chunk to be included in this demo and we haven’t had an ML intro session at the Azure user group so I’ll pass.  I don’t really need to send notifications in my demo so I won’t be using Notification Hubs either.

The plan
I think we have a plan!  I’ll build my demo from scratch.  I’ll code a Xamarin app that will gather and send telemetry to Event Hubs.  Ideally, I would use Xamarin.Fomrs instead of the classic Xamarin.  I’ll code a Windows universal app that I’ll deploy to Windows Core IoT running on the Raspberry Pi.  That app will also gather and send telemetry to Event Hubs.  I’ll need a console app that will read the events as they are received to prove that things are working.  I’ll need to configure Stream Analytics and write a query that will do some kind of sum for a period of time, let’s say the number of time each button were pressed during a one or two minutes period. 

For the demo, I’ll use a couple of phones, a tablet and the Pi all connected to the same wireless network at Microsoft's Montréal offices.  Hey!  What can go wrong?

So here’s the plan:

I’ll start with the Xamarin app and as the demo evolve, I’ll post updates to my blog and see what will happen of the plan so stay tuned!

(Jump to Part 2)

blog comments powered by Disqus

Page List

Month List