Sensor data to Azure IoT hub


(Erik) #1

Hi,

I am trying to come up with a proof of concept where I can send my sensor data to Azure. I have purchased a start dev kit which included a SODAQ Mbili, a LoRabee Microchip RN2483 and some sensors (LoRa rapid development kit from AllThingsTalk).
There are currently no available TTN connections in my area so I figured I might need to setup my own gateway, however some questions emerged regarding this.

  • a. Many DIY gateways are dating to 2016 and backwards. I am looking for a solution for a gateway that is up to date with the current released products on the market. I thought about Arduino Uno + Dragino Shield or Andreas Speisses guide (Youtube) with ESP8266 and a RFM95. Do you have any recommendations?

  • b. How does the connection between the sensors and Azure IoT hub work in overall? Can you do something like the following flow:
    Sensors->SODAQ Mbili->gateway->Azure
    or do you have to go through Sensors->SODAQ Mbili->gateway->TTN->Azure?
    I want to setup a private network for the sake of the proof of concept and I have plans for setting up a public one.

Thanks in advance,
Erik


#2

Hi Erik,

This explains a bit. However I must say that I'd expect a somewhat easier approach on this, like publishing from the console and referring to it from IoT hub. So far I couldn't find anything more up to date so I think this is it atm.


(Erik) #3

Hi TijnOnlijn,

Thank you for your reply. It uses docker(?) which I am not familiar with, I barely know what I am looking at tbh :sob:.
I found this Github guide which gives a thoroughly walkthrough and I think johanstokking is the creator because you can see his face in the guide. It might be a part of the repo that you linked but I am unsure.


(Jac Kersing) #4

Recommendation is to stay away from these single channel gateways for any serious PoC. Use a full gateway like the iMST Lite gateway.


(Ian Bennett) #5

TTN to Azure IoT Hub can be set up very easily using a HTTP Integration (under Integrations tab in the TTN application). This will forward all messages to Azure.

Setting are something like:

URL:
https://*your IoT hub name*.azure-devices.net/devices//messages/events?api-version=2016-11-14

Method:
POST

Authorization:
SharedAccessSignature sr=*****************************************************

I use Device Explorer to set up IoT Hub devices (1 IoT hub device = 1 TTN application) and get the Shared Access Signature.


(Erik) #6

Thank you for your reply.
I completely understand why single channel gateways should generally be avoided but why for the purpose of a PoC? I want to try out the technology before making a decision about developing a product.


(Erik) #7

Thank you for you reply.

I will definitely look into this guide as soon as I get a getway up and running. Now I know that there exists support for my idea.


(Jac Kersing) #8

Because of the different behavior of the gateways. Most packets sent by a node will not be received by a single channel gateway because the node sends at a different (random) channel. Also most single channel gateways for not allow for downlink (application to node) traffic which limits possible solutions.


(Frederickjensen) #9

Hi Ian, I just tried to setup a TTN to Azure IoT Hub integration following your description. The messages are not forwarded. Is there a log somewhere? do you think the suggestion is still working now it is over a year old?


#10

As soon as my gateway is back online and I’m getting data again I plan to work this through and will post results.


(Frederickjensen) #11

Great!
As Url I’ve used https://{iothubname}.azure-devices.net/devices/{devicename}/messages/events?api-version=2016-11-14

And as Authorization I’ve tried using both the device primary key connection string like: HostName={iothubname}.azure-devices.net;DeviceId={devicename};SharedAccessKey=xxxxxxxxxxxxxxxxx

And a SAS token like: SharedAccessSignature sr={iothubname}.azure-devices.net%2Fdevices%2F{devicename}&sig=xxxxxxxxx&se=xxxxxxxxxxx


(Frederickjensen) #12

It is actually working!! :slight_smile:

when I use:
url: https://{iothubname}.azure-devices.net/devices/{devicename}/messages/events?api-version=2016-02-03
and authorization: SharedAccessSignature sr={iothubname}.azure-devices.net%2Fdevices%2F{devicename}&sig=xxxxxxxxx&se=xxxxxxxxxxx

However meta data in the IoT hub in Azure about the device is not updated. These information are empty and that’s why I thought it was not working:
LAST ACTIVITY
LAST STATUS UPDATE
CLOUD TO DEVICE MESSAGE CO.