How to use the Particle Photon with the Microsoft Azure IoT Hub

How to use the Particle Photon with the Microsoft Azure IoT Hub

I use the Particle Photon devices a lot in prototype project. It’s a small WiFi board (like the ESP 8X series).

photon_vector2_600

I used several libraries on the particle cloud to use the Azure IoT hub. These libraries were build based on the Azure IoT SDK. But since several weeks Particle released an Azure IoT Connector on the Particle cloud. It’s still a beta function. But as a user you can send the data from the Particle Photon to the Particle Cloud. When the data has a specific name, the Particle Cloud will sent this data to the Azure IoT Hub.

Take the following steps to get this working.

1. Login to the Particle Cloud

2. Click on the integration button (the latest button) and select ‘New Integration’

particlecloudazureiothub.png

3. Select the Azure IoT Hub

selectazureiothub

4. Configure the settings of your hub

saveandonctinuazureiothub.png

5. Save and continu and the Particle Cloud is connected to the Microsoft Azure IoT Hub. Now you can create your code on the Particle Photon to sent data to the Azure IoT Hub.

Below the example you can add in your Particle Photon device.

      
void loop() {
  // Get some data
  String data = String(10);
  // Trigger the integration
  Particle.publish("datafield", data, PRIVATE);
  // Wait 60 seconds
  delay(60000);
}

Run the code and the messages will flow from the Particle Cloud:

dataflow

and then to the Microsoft Azure IoT Hub! How simple is this!

Advertisements

Connect a Sigfox IoT device to the Microsoft Azure IoT Hub

Connect a Sigfox IoT device to  the Microsoft Azure IoT Hub

Since this week I have a Arduino Sigfox Snootlab IoT device connected to the ‘real’ Sigfox Backend system.(before I used an other backend system of Snootlab). With a device like this you can monitor anywhere in the Netherlands (IoT network) for example if a trashcan is full or not.

One of the reasons for doing this move to the Sigfox Backend system, is that I want to have an integration between the Sigfox IoT network and the Microsoft Azure IoT Hub. The Azure IoT Hub that we are using a lot in our IoT projects at Winvision. Since a couple of weeks Sigfox has a ‘connector’ to connect your IoT device to the Microsoft Azure IoT hub, and it’s really simple. In this small tutorial I will explain how it works.

First of all, if you are using the Akene board(like below) with Arduino, here you can find the library for the board.

Sigfox Akene Arduino board
Sigfox Akene Arduino board

First of all go to the Sigfox backend:

Here you see all your Sigfox connected devices. Click on the name to get the details of the device.

SigFoxDeviceListScreen1
Devicelist in Sigfox Backend

On the right top you can find a New button, where you can create a new callback to another system.

BackEndSigfoxDeviceDetailsScreen1

Select the Microsoft Azure IoT Hub

BackEndSigfoxDeviceDetailsIoTHub
Select Azure IoT Hub

After selecting the Microsoft Azure IoT hub you get in the screen where you only need to fill two configurations items(and that’s it!)

BackEndSigfoxDeviceDetailsIoTHubDetails
Configuration screen of the Microsoft Azure IoT Hub

You need to fill in the Connection string of your IoT Hub (you can find this in de Microsoft Azure Portal) I choose the iothubowner connection string.

After that you need a JSON body for receiving the right data (and you can use off course use your custom data)

{
“device” : “{device}”,
“data” : “{data}”,
“time” : {time},
“duplicate” : {duplicate},
“snr” : {snr},
“station” : “{station}”,
“avgSignal” : {avgSnr},
“lat” : {lat},
“lng” : {lng},
“rssi” : {rssi},
“seqNumber” : {seqNumber}
}

Click save and that’s it 🙂 !

Turn your Arduino device on and it will send the data to Sigfox and Sigfxo will send it to the Microsoft Azure IoT Hub.

To test if your data is received by the Azure IoT Hubyou can off course use Azure Stream Analytics with Microsoft Power BI. But for this post I just use the Iot-hub Explorer

With this tool you can see the messages that the Microsoft Azure IoT Hub is receiving in realtime.

Below you see the data of my device 77D3C on the Microsoft Azure IoT Hub. I have made the keys red. And it’s working!

iothubexplorer4
IoT Hub Explorer screen

Afer all Sigfox made it really SIMPLE to connect you Sigfox IoT device to the Microsoft Azure IoT Hub!

Diagnostics in Azure Stream Analytics Jobs

Diagnostics in Azure Stream Analytics Jobs

When we work with Azure Stream Analytics, it’s sometimes difficult to do troubleshooting when there is a problem. These week I noticed (maybe it’s there already for a long time) the Diagnostic Diagram in the (new) Azure Portal in an Azure Stream Analytics Job. See below:

How to select Diagnosis diagram
How to select Diagnosis diagram

After selecting the diagram, you get a great overview what is happening in the Streaming Job. When you are troubleshooting it’s sometimes really difficult to see what is happing in the job:

Overview of Stream Analytics Job
Overview of Stream Analytics Job

After selecting a query for example, you see directly the query:

Query of a streaming job
Query of a streaming job

This is a great first step to do better diagnostics on an Azure Streaming Job. I like to see the following also:

  • Wondering if we starting and stopping the job will be much faster then now. It takes now a lot of time, starting, stopping, checking, starting and stopping
  • More debugging in the logs of Stream Analytics
  • Real-time logs in the Azure Portal of running Stream Analytics Jobs

In the next episode I will talk about the debugging to Azure Storage that is currently available.