locked
IoT Hub to Device Messaging RRS feed

  • Question

  • Hello.

    As far as I understand, it is called C2D, when I want Raspberry Pi with W10 IoT receive a messages via Azure IoT Hub from another device.

    Just like I would do with EventHubClient and EventHubReceiver in a desktop app, is it possible in Universal Windows? It says in Sending D2C Messages on Azure IoT Hub via Android using Android Studio that:

    Recently the Azure IoT Hub released a great feature such as Routes and Custom Endpoints with capabilities to decide a routing based on the rules where to push the device event either to the custom endpoint or to the default endpoint (such as built-in its Event Hub). Basically, the Azure IoT Hub has built-in a mechanism for filtering, selecting and sorting incoming events before their analyzing which it will save some money and increasing a performance on the pipeline processing. I have used this new feature on the D2D messaging concept.

    So, are there any simple examples on how to do it? Like Device1 > IoT Hub > Device2.

    Thanks.

    Tuesday, March 21, 2017 9:51 PM

Answers

  • Hi Tridy,

    - have a look at this thread for more details how to implement a D2D messaging.

    - the following screen snippet shows an example of the sending device-to-device message (Device2-to-Device1) on my Azure IoT Hub Tester with a Virtual MQTT Devices:

    As you can see in the above picture, the delivery time between the Device2 and Device1 is ~225ms.

    Thanks

    Roman



    • Edited by Roman Kiss Wednesday, March 22, 2017 12:31 AM
    • Proposed as answer by PedroFloresGuillen Wednesday, April 5, 2017 2:01 PM
    • Marked as answer by Тridy Wednesday, April 5, 2017 2:33 PM
    Wednesday, March 22, 2017 12:30 AM

All replies

  • Hi @Tridy

    The Routes and Custom Endpoints feature doesn't allow to route back directly to a device, it is meant to route huge amount of data from devices up to Cloud services based on simple filtering rules.

    If you want to do Device 2 Device in a secure way, you might consider doing the following (which is one of the options):

    Device > IoT Hub > Azure Function > Back to device through IoT Hub

    There is an example on how to achieve this here: http://aka.ms/azureiotping

    This sample uses a Node.js function but you can replace using a C# one that would leverage the Azure IoT Hub Service SDK for .Net that is available on NuGet here.

    Tuesday, March 21, 2017 10:41 PM
  • Interesting. I will take a look. Thanks. It does not look as simple as I hoped, but it might be a good exercise.

    by the way, how long does the whole trip from one device to another take?

    Thanks

    Tuesday, March 21, 2017 11:02 PM
  • Hi Tridy,

    - have a look at this thread for more details how to implement a D2D messaging.

    - the following screen snippet shows an example of the sending device-to-device message (Device2-to-Device1) on my Azure IoT Hub Tester with a Virtual MQTT Devices:

    As you can see in the above picture, the delivery time between the Device2 and Device1 is ~225ms.

    Thanks

    Roman



    • Edited by Roman Kiss Wednesday, March 22, 2017 12:31 AM
    • Proposed as answer by PedroFloresGuillen Wednesday, April 5, 2017 2:01 PM
    • Marked as answer by Тridy Wednesday, April 5, 2017 2:33 PM
    Wednesday, March 22, 2017 12:30 AM
  • My scenario is a Z-Wave motion sensor device doing a web call, and I wanted the Raspberry Pi with 10 IoT to pick it up from somewhere and turn on a small screen for 2 minutes. Since they are in the same network, I tried UDP and TCP broadcasting and listening, but that seemed not to be working with 10 IoT. Then I went here and see that there is still a significant amount of work for a simple trigger to go  with IoT hub. So, I decided to use an extra motion detector, wire it together with the Raspberry and the screen and have it all in one device, communicating without going to the Internet.

    I will eventually use the information from this posting when I will be gathering statistics in other parts of my smart home. So, thanks!

    regards 

    Sunday, March 26, 2017 9:08 PM