The only thing standing between IoT Hub and Functions are Consumers groups

Traditionally, when telemetry arrived at an Azure IoT Hub, it was a rule of thumb to pass it to a Stream Analytics job. But when routing was introduced in the IoT Hub, it became possible to push the telemetry directly into an EventHub or a Service Bus too.

I still favor the many possibilities of the Stream Analytics job, working with temporal and geospatial data eg. is so much easier that way.

But I can configure a lot of other, new Azure resources after the Event Hub or the Service Bus.

For example, IoT Hub routing to an Event Hub makes it possible to pass telemetry to Azure Functions (using the EventHubTrigger). This opens a whole new world of Azure opportunities using only an EventHub in this case! But it can be done even simpler…

Continue reading “The only thing standing between IoT Hub and Functions are Consumers groups”

Test the protocol availability of your Azure IoT Hub

Yesterday I discovered this little gem on Github. This NodeJS tool is advertised as:

“This tool is provided to help diagnose issues with a device connecting to Azure IoT Hubs.”

What it basically does, is calling your IoT Hub and trying to make a connection using Ping, AMQP, AMQP-WS, HTTPS and MQTT. It just checks the availability.

This is the outcome of a typical call:

I can think of calling your service once or more times every day, to check the availability.

What do I have to do for this to get it running?

Continue reading “Test the protocol availability of your Azure IoT Hub”

Using Node.js to access Azure IoT Hub

By now the Cloud strategy of Microsoft must be very clear. It’s not about Windows, it’s not about Office, it’s not about Microsoft programming languages even. Microsoft is opening up towards all devices, operating systems, programming platforms, etc. Everybody is welcome in the cloud.

Although this is going on for quite some time, it is still a surprise for quite a few non-Microsoft developers. So today I decided to program against the Azure IoT Hub using another language, just to check out their experience.

Microsoft supports multiple programming languages, there are multiple SDK’s available:

If your favorite language is not listed here, but it talks MQTT, AMQP or HTTP, chances a big you can build your own SDK.

Today I picked up Node.js because I know a bit of javascript 🙂 Let’s check out what Javascript developers have to do to connect to an Azure IoT Hub.

Continue reading “Using Node.js to access Azure IoT Hub”

Flexible message routing in Azure IoT Hub using C#

The Azure IoT Platform is a very versatile solution for all your IoT needs. Azure supports multiple resources for storing large amounts of data, querying immense streams of data coming in, having event buses which can hold millions of messages, serverless functions, reporting and Machine Learning; what more do you need?

But it all starts with the IoT Hub:

“Azure IoT Hub is a fully managed service that enables reliable and secure bidirectional communications between millions of IoT devices and a solution back end”

Normally, whenever I start a new IoT Platform solution in Azure, I start with an IoT Hub and connect it to a Stream Analytics job as an input source. Messages arriving at the IoT Hub are then passed directly into the Stream Analytics job to be examined. And the Stream Analytics job can pass some or all messages (or transformed messages) to multiple output sinks eg. Event Hubs, Service Bus Queue or Topic, Blob Storage, etc.

The arriving messages carry telemetry information from the device. But what if the messages are sent in a certain context? What if a message has a high or low priority? Should we pollute the message with this ‘routing’ information? And Act on it inside the Stream Analytics job?

A few week ago, Microsoft introduced a new feature in IoT Hub, called message routing.

This makes it fairly easy to react on difference messages, arriving at the same IoT Hub, but intended to handled differently. Routing is perfect for this matter. We can declare extra endpoints directly in the IoT Hub. And depending on message properties, messages can be sent directly to these endpoints:

routing-on-iothub

There are two important things to keep in mind. First, the message properties are extra annotations (defined by the IoT Hub device client), we are not peaking inside the message itself. And second, messages can still end up in a Stream Analytics input when it is ignored by the active routes.

Let’s take a closer look.

Update 2017-06-01: Microsoft announced that routing is now supporting values from the actual telemetry, great news and now it’s more intuitive!

Continue reading “Flexible message routing in Azure IoT Hub using C#”

How to send Azure IoT commands back to NodeMcu

Microsoft is has made their IoT platform very open. There are lots of ways to connect to it, using various protocols like HTTP, MQTT and AMQP. And Microsoft provides multiple SDKs to connect to their IoT platform using languages like Python, .Net, Java, Node JS and C. So it’s not that hard to connect to the platform whatever your development platform is.

If you follow my blog, you will notice that I normally connect to the platform using UWP. It’s great for testing purposes and it even runs on a Raspberry Pi using Windows 10 Core. I also connect a lot using ‘special’ Arduino’s. Although these are not connected to the Internet by default, I have a couple of The Things UNO boards which have wireless connectivity using Lora. The Arduino’s connect to the Azure IoT platform using the The Things Network Lora platform.

I also connected using a Photon, using the Particle cloud. This works almost out of the box but for now, it’s only one way; I can only send telemetry to the Particle cloud. I hope to see the ability for receive commands,  arriving at the Photon, in the near future.

Currently I have some NodeMCU laying around and a friend showed me how to connect to the Azure IoT Platform using the Azure IoT for C SDK.

nodemcu-lua-cp2102-1

It’s not that hard to get it to send some telemetry, once you know what to do (thanks, Jan Willem 🙂 ) but retrieving commands is less straight forward. In this blog, we take a closer look.

Continue reading “How to send Azure IoT commands back to NodeMcu”

The Photon as a weather station, connected to Azure IoT Platform

A few weeks ago, Jon Gallant asked for beta tester for the Azure IoT Platform integration with the Partical platform (Beta Testers Needed for Particle to Azure IoT Integration).

This was great news to me. I have a Photon Azure Starter Kit laying around and I tried once to connect it to the Partical platform.

sparkfun_thing_azure

The kit has potential: it comes with a SparkFun Photon Weather Shield:

p05-weather-station

And on the shield are already attached:

  • Humidity/Temperature Sensor – HTU21D
  • Barometric Pressure – MPL3115A2

And it has two RJ-11 connectors for Weather Meters like this one:

p06-weather-station-meters

But that initial (EventHub?) integration was not quite intuitive and I had more projects to work on. So I moved on.

Now, I had a second chance to make the Photon work!

The first steps are to register your unique Photon device and attach it to the internet (it has a Wifi chip onboard).

If you go to the online IDE, you can write code for your Photon and flash (deploy) it ‘over the air’. This is fun, as long as your Photon is online (wherever it is running), you can contact it using a browser.

The integration tutorial, the blog of Jon Gallant, is very straight forward regarding making an Azure IoT Hub integration. You only need an Azure IoT Hub and a specific access policy.  This will help you in sending a string from the Photon to the hub.

Update: Another useful tutorial comes from the Particle site and it shows how to send some integers.

But sending a JSON message is less intuitive.

Continue reading “The Photon as a weather station, connected to Azure IoT Platform”

Iot Hub supports uploading files, perfect for Cognitive Services vision

Usually, when I reference the Azure IoT Hub, you can expect that some telemetry is involved. But the Azure IoT Hub is evolving. A new feature is coming, it is now possible to upload blobs.

Why should we want to upload blobs? Well, I think it’s great to have the possibility to upload files full of telemetry in one upload.

But sometimes the telemetry is not a bunch of values but it’s more like a big bag of bytes 🙂 In the example below, we will upload an image and pass it on to Microsoft Cognitive Services  (previously known as Project Oxford) for visual analysis.

Continue reading “Iot Hub supports uploading files, perfect for Cognitive Services vision”