Soracom IoT connectivity now offers direct integration with Azure IoT Hub via MQTT

Soracom IoT connectivity now offers direct integration with Azure IoT Hub via MQTT

We are very happy to announce today that Soracom connectivity now offers direct integration with Azure IoT Hub via MQTT.

Soracom Beam, Azure IoT Hub,

Even without an installed Azure IoT SDK, devices can now easily connect to Azure IoT Hub using the SORACOM Beam protocol translation service.

This integration also supports Cloud-to-Device (C2D) messaging to take simplify many common IoT use cases with Azure IoT hub.

Background

SORACOM Beam was initially developed to convert lightweight generic protocols like HTTP and MQTT into HTTPS or MQTTS and securely redirect the data to an arbitrary endpoint.

For devices with limited CPU or memory, this addresses the challenge of encrypting and securely transmitting data as required by leading cloud providers. This protocol conversion lets cloud services receive data in the formats they require while minimizing the load on small, resource-constrained devices.

This MQTT support to Azure IoT hub offers SAS token-based authentication that allows devices with very limited resources like microcomputers over SORACOM Air connection.

Demo

Here is a sample implementation using the Wio LTE development board from Seeed Studio.

This example sends an RGB color code (in this case, Soracom’s Celeste Green #34cdd7) from the Azure Portal to change the LED color on the Wio LTE.

Azure IoT Hub portal

The message transmits immediately and the LED changes to Celeste Green.

Serial console log

--- START ---------------------------------------------------
### I/O Initialize.
### Power supply ON.
### Turn on or reset.
### Connecting to "soracom.io".
### Connecting to MQTT server "beam.soracom.io"
Publish:{"uptime":21}
Subscribe:#34cdd7
Setting LED as #34cdd7

Program code

mqtt/mqtt-client sketch in WioLTE for Arduino Library

The code diff is below.

10c10
< #define MQTT_SERVER_HOST  "hostname"
---
> #define MQTT_SERVER_HOST  "beam.soracom.io"
14,15c14,15
< #define OUT_TOPIC         "outTopic"
< #define IN_TOPIC          "inTopic"
---
> #define OUT_TOPIC         "devices/WioLTE/messages/events/"
> #define IN_TOPIC          "devices/WioLTE/messages/devicebound/#"
26a27,36
>   if((payload[0] == '#')  && (length==7))
>   {
>     String hexstring=String((char *)payload);
>     int number = (int) strtol( &hexstring[1], NULL, 16);
>     int r = number >> 16;
>     int g = number >> 8 & 0xFF;
>     int b = number & 0xFF;
>     SerialUSB.print("Setting LED as "); SerialUSB.println(hexstring);
>     Wio.LedSetRGB(r,g,b);
>  }

Note

  • Changed the endpoint to beam.soracom.io
  • Modified data outbound topic(OUT_TOPIC)/data inbound topic(IN_TOPIC) based on Azure IoT Hub requirement
  • When the data is received and the data has 7 characters starting with #, the device sets the LED color code.

You can check the full source code here.

Last but not least

We are always looking for new ways to improve our connectivity and capabilities to make life better for IoT developers. If you have an idea or request, please do not hesitate to contact us!