Forget about messages, just care about IoTHub chunks

Ok, this blog is all about taking the blue pill or the red pill:

I use the Azure IoTHub for every project I am involved in. It’s my main focus on getting IoT things done and using this tool is how I manage.

And consequently, I always look at the number of daily messages we have to ingest because the price of an Azure IoTHub depends on the number of messages it passes on.

It starts with 400.000 messages a day and from there, you can scale up. The biggest version can scale up to a tenfold of 300 million messages a day:

But this is not the whole truth, you can send more… Continue reading “Forget about messages, just care about IoTHub chunks”

Advertenties

Zip and unzip a string of data in memory

I was looking for a way to zip and unzip a file.

Normally, this is not really an issue. There are lots of libraries and NuGet packages available.

But this file was represented to me as a string, some JSON, actually.

So I was looking for a way to convert a string into some zipped format and back. This was harder than expected.

In the end, I wrote a solution myself. Here it is for you to use it, just to save you a lot of time.

Note: This library is available on GitHub. And Visual Studio users can import the NuGet package.

Continue reading “Zip and unzip a string of data in memory”

Migrating Azure Functions from portal to Visual Studio

Azure Functions are a great addition to the whole family of Azure resources. Azure Functions are my number one workhorses. The fact that I can execute code, triggered by ‘whatever’, gives me so much power for a fraction of the costs.

And the beauty of it is, you can write those nifty pieces of code directly into the Azure portal using nothing more than a browser.

But as always, with great power comes great responsibilities!

The code I write in the portal is not supporting any version control. And I cannot debug this code.

Although I am up-and-running with Azure Functions in a few hours, I want to debug and put my code in version control too!

Luckily, I can create Azure Function in Visual Studio too. And this gives me the power of debugging and version control. But what are the drawbacks?

Let’s explore om how to migrate your Azure Function, written in the portal, into Visual Studio.

Continue reading “Migrating Azure Functions from portal to Visual Studio”

Tweede Azure IoT Community bijeenkomst op 1 februari 2018

Op 1 februari 2018 wordt al weer de tweede Azure IoT Community bijeenkomst georganieerd!

Na de succesvolle eerste bijeenkomst wordt het weer tijd voor een nieuwe mogelijkheid om elkaar te ontmoeten.

Deze avond is voor iedereen die geinteresseerd is de combinatie van Microsoft, Windows, Azure en natuurlijk IoT. Het maakt niet uit of je nu hobbyist, student of professional bent. Kom lang, neem je vrienden mee en deel jouw ervaringen of doe juist ervaring op.

Het programma voor deze avond is:

17.30 – Inloop en eten

18.30 – Korte introductie en laatste updates van Microsoft IoT producten

18.40 – Industrial IoT with Azure IoT Hub – door Eldert Grootenboer / Motion10

19.30 – Alles over de Azure Stream Analytics

20.15 – Borrel

De avond is dit maal verzorgd door Atos, de locatie is Burgemeester Rijnderslaan 30 in Amstelveen (routebeschrijving)

Dus meld je aan op via deze link (en neem legitimatie mee).

Meer informatie is te vinden op onze website. Tot ziens op de volgende bijeenkomst!

 

Introduction to the IoT Edge SDK V1, part 6: Modbus for Wise modules

Update: Recently, Microsoft introduced the new V2 version of their IoT Edge. This blog is referencing the former but still supported V1.

I do a lot of IoT research using the Advantech Wise 4012E IO module. It’s biggest advantages are that it runs on 5 Volts, using a MicroUSB connection (instead of a bulky 12V or 24V adapter) and it comes with knobs, switches and LEDs to simulate real sensors. So it’s a very compact but yet complete IoT device.

Until a few days ago I made use of the Rest protocol to contact that module but this has some disadvantages.

First, Rest is a great protocol in the IT world but it is not used that much in the OT world. Luckily, the IO module also supports the Modbus protocol. So I tried to switch to that protocol.

Second, Rest is very slow compared to other protocols like Modbus. Using Rest, I’m lucky when I can pull 2 or 3 requests a second out of the module.

In the previous blogs, we have seen multiple modules, both provided by Microsoft or created on the fly. And Microsoft provides a genuine Modbus module for the IoT Edge SDK. There is only one drawback, it’s on Github but it’s not available as NuGet package. You have to make/build it yourself!

And for some unknown reason, I did not get it working the way I liked it. I encountered too many exceptions.

Update: There is also a Version 2 of this module. In this blog, I refer to V1.

So, in the end, I just ignored the module and build my own Modbus module.

Continue reading “Introduction to the IoT Edge SDK V1, part 6: Modbus for Wise modules”

User Defined Function in Stream Analytics

Azure Stream Analytics provides a great solution for temporal queries of streams of data. The query language is pretty simple, especially if you have a background in SQL queries.

The list of built-in functions is a long list, ranging from aggregation, analytics, geospatial, records, scalars to the recently introduced anomaly detection.

But what if you want to write your own functions?

Stream Analytics supports three types of custom functions:

  1. user-defined functions (UDF) written in Javascript
  2. user-defined aggregates (UDA) written in Javascript
  3. Machine learning endpoint disguised as functions

In this blog, I will show how easy it is to write and use your own custom logic in a Stream Analytics job. We will look at the user-defined functions.

Continue reading “User Defined Function in Stream Analytics”

Using an External Table output in Azure Functions

As seen in my previous blog, I am experimenting with passing data to a SqlAzure table using Azure Functions.

I first used the new and apparently experimental External Table output available in Azure Functions. Experimental just means in preview.

Due to throttling issues, I had to abandon it where I wanted to insert multiple (+200) records.

But this Azure Functions output is a very promising way to insert records in all kinds of data sources. I can recommend using it when you want to insert, alter or lookup data.

Let’s take a closer look.

Continue reading “Using an External Table output in Azure Functions”