How I can view Raw Data (Binary sensor data) which i have published to Azure IoT Hub? - iot

I am implementing custom device based on ESP32 Wi-Fi Microcontroller. I was able to successfully connect this device to Azure IoT Hub.When I transfer telemetry data in json format and I can view the data using azure cli (az iot hub monitor-events --hub-name {hub}).
But when I published telemetry raw data (ex: uint8_t data[]={0x12,0x3F,0x01,0xF1,0x01,0x02,0xD3,0x00};) I am not able to view through azure cli (az iot hub monitor-events) although mqtt publish is success from ESP32 side. Some time "az iot hub monitor-events" crash.(see the image)
Is there an alternative way to do this? or does Azure IoT hub not support Raw telemetry data? Any help or advice would be highly appreciated! Thank you.
initial part - success in displaying json data, Crash when send raw data

Related

How can I connect a real device only accepting MQTT / TCP connection to azure IoT hub?

Context:
I have a real device that only uses MQTT and only accepts a TCP connection (The only things I can modify in the real device are the cloud address, cloud ID (username), cloud password, machine cloud ID and cloud port).
Question:
How can I connect this device to the azure IoT hub?
Can I use azure IoT edge runtime w/ transparent gateway?
In case if you want to try connectivity with IoT hub and if there is no feasibility for usage of device SDK in your device, you can try the option of using MQTT protocol directly (as a device), using which the device can still connect to the public device endpoints using the MQTT protocol on port 8883.
However, for using the MQTT protocol directly, the device must connect over TLS/SSL. Since your device has constraints in using TLS/SSL or installing certificate, the best option is usage of gateway.
In a typical IoT system, gateways are used to overcome the limitations of device capabilities. You may need to decide the suitable deployment type based on these three patterns of using IoT Edge device as a gateway as per your device capabilities and requirement in hand.
There is a scenario where you don't have to use the device SDK and connect your MQTT device directly to the IoT Hub. It is documented here. Azure IoT Hub is not a full-featured MQTT broker though, so results may vary. As per your suggestion, yes you can use a transparent gateway for this if you don't want your device to connect directly to the IoT Hub. But it's not a prerequisite.
In the case that your device needs more MQTT features than IoT Hub (or Edge for that matter) can offer, you can also consider creating an Edge module with an MQTT broker inside.

How to send simulated data from a device to an Azure IoT Edge device

I have worked with sending data using a c# code to send simulated data from a device to an IoT Hub, but I am not able to find documentation on how to do the same i.e send data to an on premise IoT Edge device.
Any guidancewould be greatly appreciated.
Once you set up IoT Edge as a transparent gateway(https://learn.microsoft.com/en-us/azure/iot-edge/how-to-create-transparent-gateway); and update your connection string used in your C# code to append "GatewayHostName="; your c# code should work and messages will route to Edge Hub and then IoT Hub.

How to implement IoT in serial communication devices

I want to enable IoT in the devices (inverters) which currently supports only serial communication. Through serial port I'm able to view statistics of the device, configure device and do firmware updates. I want to do all these remotely by enabling IoT. I have just gone through Azure IoT hub, iBOT etc.
How will I enable communication between my serial port with IoT hub?
Is there any supporting device for that?
You can use another device as a gateway, this device is networkable and has serial port. Azure IoT Edge lets you build IoT solutions tailored to your exact scenario. You can refer to the document and get start.
In addition, here is a tutorial to implement a device firmware update process. This tutorial shows how you can start and monitor the firmware update process remotely through a back-end application connected to your hub.

How can I push the data collected from IoT devices to Microsoft Azure IoT hub?

I need to connect my cell phone to the IoT sensors (Say BLEs) and collect the data which needs to be sent or stored into Azure.How can I do that? Is there any App (preferably mobile App) through which I can handle my IoT devices and push the data to MS Azure using any gateways? If yes, how can I do that? Links of any articles or materials and videos related to this will be helpful. Thanks.
Currently there is no such out of box mobile app to use.
If you like to develop an app by yourself you need connect to sensors and collect data and connect mobile device to Azure IoT Hub and send Device-To-Cloud message.
Also here is a Azure IoT and Mobile sample application: MyDriving. It is a typical Internet of Things (IoT) solution that gathers telemetry from devices, processes that data in the cloud. You can customize for your deployment.

Can I send a message to a group of Azure IoT Hub Devices connected via MQTT WebSocket?

Goal: Send messages to a group of Azure IoT Hub Devices that are connected via MQTT WebSocket.
Initial Idea: Have a group of IoT Hub Devices (group X) subscribe to messages with topic X.
Problem:
On the Communicate with your IoT hub using the MQTT protocol docs, I don't see a way to subscribe a device to additional topics. I only see examples of a subscription to a device specific endpoint devices/{device_id}/messages/devicebound/#.
The page goes on to say "IoT Hub is not a general purpose pub-sub messaging broker, it only supports the documented topic names and topic filters." I think those topics are
devices/{device_id}/messages/devicebound/
devices/{device_id}/messages/devicebound/#
My Conclusion: I can't have a group of IoT Hub Devices (group X) subscribe to messages with topic X.
Questions:
Is my conclusion correct?
If my conclusion is correct, is there another way I can send messages to a group of Azure IoT Hub Devices that are connected via MQTT WebSocket?
Your conclusion is correct. Azure IoT Hub is not an MQTT broker per se.
If you want to send messages to a group of devices connected to Azure IoT Hub (independently of the protocol they are connected with), you need to look into one of the Cloud 2 Device features of IoT Hub.
Depending on your scenario you can use one of the following: Cloud 2 Device messages, Twins or Methods. IoT Hub exposes APIs on the back-end side (easily used with the Service Client SDKs) allowing to use any of those.
C2D messages are used to send raw data to devices, meaning you implement your own "protocol" between cloud and device. C2D messages are also persistent in the Cloud as IoT Hub will retain them (for a certain time defined in settings) if the device is not connected.
Device Twins allows to synchronize a configuration of a device with the Cloud and allows for batch operations on devices (certainly one you want to look closer into).
Device Direct Methods allows to call a function running on a device from the cloud and like Twins supports batch operations.

Resources