pythonazureazure-iot-hubazure-eventhubazure-eventgrid

How can I do Device to Device communication using Azure


I'm trying to communicate two devices let us assume Device A and Device B. According to the documentations online and references online we can do the following methods as per my understanding.

  1. Use IoT Hub to connect with devices -> Device A send telemetry to IoT Hub -> use function apps to route the data -> Again by using Client to device in IoT Hub send back to device 2. Reference Link

  2. User Event Grid. Event grid is an MQTT and HTTP Supported Azure service that acts as a MQTT Broker and can perform Pub/Sub Mechanism. Link

Question - 1: Now let us say I have implemented the device telemetry sending through IoT Hub and I dont want to change it. Now how can I implement scalable Device to Device Communication. The ultimate solution is to change to event grid itself? or is there any other way of executing this?

Question - 2: If not IoT Hub, what is the best possible way to implement the architecture.

As I am very new to Azure please do apologize If my question is not understandable. Please feel free to comment will clarify any doubts regarding the question.

I tried to send data from ESP8266 taking an example from Azure SDK for C and it went well. I am trying to find subscribe mechanism where I need to get data back to other ESP8266 or Python Module.


Solution

  • For this device-to-device communication, the Azure Event Grid MQTT broker is the simplest cloud-based solution. Device A can publish to an MQTT topic, and Device B can subscribe to the topic.

    If you want to use IoT Hub, you'll need to configure IoT Hub routing to send messages from Device A another service such as Azure Functions that can generate cloud-to-device messages to send to Device B.

    Have you considered running an MQTT broker on the edge rather than in the cloud? For example: https://learn.microsoft.com/en-us/azure/iot-operations/manage-mqtt-connectivity/overview-iot-mq