Connect Kepware KEPServerEX through Azure IoT Edge to IoT Hub

TLDR: I’ve put together step-by-step instruction on how to leverage Kepware’s IoT Gateway as an MQTT-based “leaf IoT device” for IoT Edge.

I’ve gotten the request a few times from customers who leverage, or want to leverage Kepware for connectivity to their manufacturing equipment and then send that data to IoT Hub through Azure IoT Edge. 

Microsoft’s recommended solution is to leverage OPC-UA and our IoT Edge OPC-UA publisher.  OPC-UA is both a nice industrial protocol, but more importantly, offers a robust data format that plugs in nicely into other Azure services. 

However, in cases where customers either can’t, or don’t want to leverage OPC-UA, Kepware already published a nice technical note showing how to connect Kepware via MQTT directly to Azure IoT Hub via Kepware’s IoT Gateway and MQTT.  However, customers are interested in how to have the data flow through Azure IoT Edge to take advantage of the many nice edge-processing capabilities available.

So, based on the same principals as my “Connect MQTT client to Azure IoT Edge” post, I’ve put together step-by-step instruction on how to leverage Kepware’s IoT Gateway as an MQTT-based “leaf IoT device” for IoT Edge.

You can check out the instructions here.

Enjoy

S

Azure IoT Edge Hands-on Labs Updated

The Azure IoT Global Blackbelts (my team) maintain a set of hands-on labs for IoT Edge. They were originally written for some in-person workshops for customers that we did in February/March, but have proven to be valuable for people to do on their own as well. We have one version for Windows (with actual hardware) and one version with Linux (virtual machine in Azure).

After some delay due primarily to busy schedules and lots of customer work (IoT Edge is on fire!), I finally got a chance to update the “Linux” lab to a) be compatible with the Generally Available bits of IoT Edge and b) to leverage the Azure Cloud CLI for provisioning of the IoT Hub, Edge Device, monitoring IoT Hub, etc to cut down on all the clicking around!

The Linux lab is based on leveraging an Ubuntu VM in Azure with the specific purpose of you not having to install anything on your local machine except maybe an SSH client. This allows students who may be in a locked down situation on their work machines to still get to experiment with Edge.

The labs can be found here -> IoT Edge Linux HOLs

Over the next few weeks, I’ll be revising the Windows version, and also working on a version for the Raspberry Pi.

Enjoy!

PIP install for Python SDK now works on Raspberry Pi!

The Azure IoT product group has been busy making improvements to our Python SDK for Azure IoTHub.  The biggest improvement is that they’ve put a fix in for the infamous “libboost” issue that prevented the PIP package from working on the Raspberry Pi.   Previously, if you wanted to use the Python SDK on a Raspberry Pi, you had to manually build from the source, a time and resource intensive process.

If you aren’t familiar with it, Boost allows you to invoke C code from Python (the Python SDK is built on the C SDK).

Base SDK install/usage

For now, they’ve updated the SDK to link against the current version of libboost that works on the latest version or Raspbian stretch (1.62.0).  Future improvements may remove this requirement, but for now, you need to make sure that libboost is installed on the Pi (it’s not, by default).  So use the following two statements to get the SDK installed and setup:

sudo apt-get install libboost-python1.62.0

pip install azure-iothub-device-client
After that, in your code, you can ‘import iothub_client’ and go to town!

IoT Edge/Docker

As a bonus (for writing IoT Edge modules for the RPI), i did a quick test to confirm that all of this works in a docker container too.  There will be official guidance and tooling from the IoT product group in the future, but for now, a simple Dockerfile like this works for creating a docker image that contains a Python app that uses our Python SDK…

FROM python:2.7.15-stretch

WORKDIR /usr/src/app

RUN apt-get update && apt-get install libboost-python1.62.0

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "-u", "./app.py" ]

the requirements.txt file, just contains one line:   “azure-iothub-device-client”

next up, I’ll be testing with a full blown IoT Edge module on the raspberry pi, and I’ll post the results soon

 

Azure IoTHub Auto-scaling

For my inaugural post, I figured, just to have it in one place, I’d revisit something I posted a few months ago on the Azure.com IoT blog.  In fact, doing this is one of the things that prompted me to start this one…   Anyway, a frequent requested feature for Azure IoT Hub is the ability to auto-scale the IoT Hub when you approach your message limit for the day.   It’s a feature that is definitely on our roadmap, but IoT Hub doesn’t natively support it today.   This blog post on azure.com and accompanying sample show you an example solution of how you can do it today.