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.

Continue reading “Not for the restless, HTTP access to the Azure IoT Hub”


Turn your Raspberry Pi into a Personal Assistant using Cortana

Microsoft is constantly updating its latest version of Windows, version 10. For me, as a developer, it’s a wonderful operating system to program for. The UWP apps I build, run on both PC’s, laptops, Windows Surface Hub (up to 84 inches), The Xbox One and even on a Raspberry Pi. Yes, Windows 10 is running on a 35 dollar device.

But before you run to the store to replace your PC, I have to tell you it’s running the core of Windows 10, actually. There is no shell (no menu, no start bar etc.).

So this means you can run one visual (headed) UWP application and multiple background applications. And yes, you will love it!

This is a great interface for kiosk-like devices. And with the latest update (build 15063), it’s easy to add Cortana support.

Cortana is the speech service, available in Windows 10. If you know Siri or Alexa, then you know Cortana. Just ask her a question and she will try to answer it. The answer will be provided by speech or supported by browsers or other visual help.

Let’s take a look on how to enable Cortana on a Raspberry Pi.

Continue reading “Turn your Raspberry Pi into a Personal Assistant using Cortana”

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:


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#”

BBC micro:bit Impressive introduction into programming

This weekend, I got a BBC micro:bit from a friend. This is a nice gift indeed, I had and still have lot’s of fun with it.

Before I tell a bit more about the device, did you know each 11- and 12- year-old student in the UK got one for free!? That’s more than one million devices. This is a great opportunity for kids: they can learn about programming, computers and most of all, programming and computers can be fun!

The design of the device is very clever!

It has an ARM processor, two buttons, 25 leds (which acts like a screen), a compass, an accelerometer, Bluetooth LE, GPIO pins, a battery connector and a MicroUSB connector (for programming).


Programming is so easy! Let’s dive into this a bit deeper…

Continue reading “BBC micro:bit Impressive introduction into programming”

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.


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.


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


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:


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”

Building a door switch using Domoticz, X10RF and Arduino

Today, I built a door switch for Domoticz which checks if a certain door in my house is opened or closed.

I already have a combination of a Raspberry Pi running Domoticz and an RFLink Gateway which is listening using a 433Mhz transmitter. So I was suggested to look at the X10 protocol. This protocol is already supported by Domoticz and just sending the state of a switch is simple with this protocol.

I also already had a handful of 433MHz transmitters and receivers, bought in the past. So first I had to check which ones were the transmitters 🙂


And I have these nice micro switches with a roller at the tip of the lever, perfect for the job!

Continue reading “Building a door switch using Domoticz, X10RF and Arduino”