Blog

A Brief Tour of Azure IoT Hub

I’m preparing some material for a webinar on Azure IoT in mid-October (you are signed up, aren’t you?) and thought I’d do a quick intro to the basic concepts and moving parts.

Azure IoT Hub is a cloud-scale service for managing and securely communicating with large numbers of field devices (potentially millions at once); communication can occur from device to cloud, and also from cloud to device (for issuing commands or queries to devices). It’s standards-based so it works with many device types, a number of communications protocols and guest operating systems, and supports various network topologies. It also supports custom gateways for edge analytics, traffic optimization, etc. Finally, it integrates with a number of existing Azure services like Stream Analytics, Machine Learning, and Event Hubs to maximize scale and minimize time to insight.

Let’s walk through a sample Azure IoT Hub-based solution and see it in action. I live in Atlanta, GA USA and our public transit system provides geolocation and other metadata about buses and trains; we’ll use the bus data to simulate device activity in the field (each bus == a device) and use IoT Hubs, Stream Analytics, Azure Storage, DocumentDB, and some custom code to collect and present that data in a meaningful way.

Here’s a diagram of the high-level architecture we want to achieve:

To simulate data coming from multiple buses driving around in the city, a worker process will periodically poll the transit data, do some minor scrubbing, and push new values into the IoT Hub endpoint. The IoT hub itself is configured with three consumer groups (in essence, three copies of the incoming data). A permanent log of all raw incoming device activity is often useful for tracing, debugging, and downstream analytics; for this we’ll configure a Stream Analytics job to listen on the ‘history’ consumer group and forward all traffic to Azure blob storage:

 

Then we’ll keep a copy of the most recent message from each device in “hot” storage (you’ll see why in a moment); for this we’ll configure another Stream Analytics job to listen on the ‘info’ consumer group and forward the messages to a DocumentDB collection:

Next, we’ll hook up some custom listener code to the third consumer group (‘location’) and forward a subset of that incoming data to a custom web app, which will continuously display the bus locations using an embedded Google map control and ASP.NET SignalR. This custom code uses the EventProcessorHost API and IoT Hubs built-in support for the Event Hub programming model to listen for incoming messages and POST them to the web app, like so:

https://gist.github.com/jplane/35fbe2a928948a6f75393e17859745f6

Finally, the web app will display the Google map with continuously updating markers for bus locations:

Clicking on a marker will pop up a small window with additional information about that bus; the information is queried on-demand from the DocumentDB store by bus ID and returned to the browser from an HTTP GET call:

https://gist.github.com/jplane/73b964dcaf79e63482bce67016b58b10

This is a very simple example of the power of Azure IoT Hub; check out the code on GitHub if you’d like to play around with it yourself:

https://github.com/jplane/IOTBus

There’s more to explore in Azure IoT… I haven’t touched on device management, cloud-to-device communication, or IoT gateways. Want to hear more? Attend my webinar on Thursday, October 13 at 11 AM EST and learn all about IoT in the Azure cloud!

Until then!

Josh Lane

View Comments

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

5 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

2 weeks ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

4 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago