Introduction to the IoT Edge SDK V1, part 4: IoTHub routing

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

We have already made great progress understanding and using the Azure Gateway SDK.

What do we have right now? We can send telemetry data from multiple ‘offline’ devices and accept commands from the IoT Hub.

The data we send is well-formatted JSON so we are good to go.

But I am a bit worried. While reading all documentation regarding the transformation from Azure Gateway SDK towards the IoT Edge SDK, it is clear that multiple types of messages are sent to the IoT Hub. For example, I can imagine that a Stream Analytics module generates other data.

And let’s look at a more ‘close to earth’ example. The gateway itself is a potential device too! But I do not want to mix data coming from the gateway and from sensor devices.

Of course, we recently got the ability to route messages using the message sent. But what about using the properties? This keeps the message content clean.

Will this be working?

Doorgaan met het lezen van “Introduction to the IoT Edge SDK V1, part 4: IoTHub routing”

Advertentie

Introduction to the IoT Edge SDK V1, part 3: Cloud to Device

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

In the previous blogs of this series, you have been introduced to the Module architecture of the IoT Edge SDK. In my last blog, we have sent data to the IoT Hub.

But the IoTHub has more capabilities for devices. Think of ‘device twins’, ‘direct methods’ and ‘message to device’. Are these supported too?

At this moment, the IoTHub module supports commands, messages to devices, coming from the IoT Hub.

Let’s see what we have to do to get this working.

Doorgaan met het lezen van “Introduction to the IoT Edge SDK V1, part 3: Cloud to Device”

Introduction to the IoT Edge SDK V1, part 2: Connecting to IoTHub

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

Running logic on the Edge is not that hard, as we have seen on my previous blog. You have been introduced to modules, the gateway configuration and the broker/runtime.

But these were just two modules. Now it’s time to put some data into the Azure IoT Hub.

If we look at the modules provided by Microsoft, we can do the job already. What we need are the following, already available modules:

  1. simulated_device.dll, to generate simulated data
  2. identity_map.dll, it holds a list of device names and private key combinations so the data of devices can be sent securely to the IoT Hub
  3. iothub.dll, to make contact with the IoT Hub and pass data in name of devices

Yes, there are some limitations to these modules but for now, it’s good enough. Let get started.

Doorgaan met het lezen van “Introduction to the IoT Edge SDK V1, part 2: Connecting to IoTHub”

Introduction to the IoT Edge SDK V1, part 1: the modules

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

When the Azure IoT Platform is referenced, in most cases the devices connecting to the IoT Hub are capable of communicating directly with the internet using Wifi etc. But there are many cases where devices are not capable of reaching out to an IoT Hub.

For example, these devices lack the ability to communicate using the internet (but use eg. Bluetooth or I2C instead). Or these devices are capable of communicating eg. REST but simply disconnected from the internet. Or they can only reach their own platform (eg. LORA).

In these cases, you need a mediator, a gateway. It sits between the two parties and passes data back and forth.

Microsoft provides for these cases the IoT Edge SDK, formally known as the Azure IoT Gateway SDK.

This SDK makes it possible to run a service which makes it possible to connect devices to the Azure IoT Hub using a series of modules.

But the name change (from ‘gateway to ‘iot edge’) is not without reason. The Edge SDK has extended logic and is currently in preview. The additions to come will make it possible to run logic on-premise (according to the website: Enable real-time decisions, Perform edge analytics, Run artificial intelligence at the edge, etc.). This is promising!

But I have experienced the usage of the Gateway SDK as a challenge. The SDK supports many development platforms and documentation is scattered. So it’s hard to find a good starting point.

We will start with the Gateway SDK. I want to make the usage of this SDK as easy as possible.

Doorgaan met het lezen van “Introduction to the IoT Edge SDK V1, part 1: the modules”

Not for the restless, HTTP access to the Azure IoT Hub

The Azure IoT Hub is accessible using multiple protocols. You can use MQTT, AMQP and HTTP. It’s even possible to run MQTT and AMQP over HTTP using web sockets (in case your firewall is closed).

This week, I had to connect a device to the IoT Hub running its own propriety runtime environment. The only way to communicate was HTTP.

Luckily, still HTTP is supported but communication works a bit different compared to using the IoT Hub SDK’s which Microsoft is offering.

Yes, at first it seems easy to just make a POST or GET to a REST endpoint. But looking at the security, just providing the Device connection string is not enough. You have to extract an SAS (Shared Access Signature) token first.

Let’s see how you can use REST.

Doorgaan met het lezen van “Not for the restless, HTTP access to the Azure IoT Hub”