I am trying to understand how to choose number of Azure IOT Hubs in a scenario where I have variety of devices sending variety of data - azure

I am trying to understand on do I need to choose individual IOT HUB based on device category.
For Example I have devices sending GPS info.
Devices send stock info
Devices sending quality info.
Devices sending security info.
Devices sending fire safety info.
Each of the above category devices send versatile data in versatile format. In this scenario is it a best option to configure multiple IOT hubs or one IOT hub is suffice.
Thanks in Advance....

As the IoT Hub is totally agnostic to the actual data that you are sending, you would not need to have separate IoT Hubs per use case. You can still connect all the devices to one IoT Hub and then route the telemetry data, for example based on on device properties, to different downstream processing steps.
You might still want to use multiple IoT Hubs but mainly then for either scaling reasons or for geographical distribution.

Related

Which is an appropriate NodeJS code to send telemetry from device to IoT hub?

With the help of Azure IoT SDK node, I've been assigned to send telemetry data from device to IoT hub using NodeJS.
How do I write or how do I find an appropriate sample for d2c messages.
I'm quite confused which sample code to be used from this particular SDK for device to IoT hub telemetry.
https://github.com/Azure/azure-iot-sdk-node
"Suppose my device has a waste level sensor and sending waste fill level to IoT hub so how do I get an appropriate sample from this SDK to send data to Hub"
Thank you.
the easiest Node SDK sample I could find was this one". It's in the repository that you linked to.
If you want more information, and a step-by-step tutorial, I can recommend this tutorial in the docs. It uses a different sample in the same repository.
For all of these samples: they send a certain payload. You can change the payload to whatever you need it to be for your waste level sensor!

How to differentiate the data in IoT Central coming from multiple similar sensors(Philips hue bulbs) to a gateway device connected to IoT Central

We have a Gateway device which is registered in IoT central application. This gateway device is connected to multiple similar Sensor devices such as Philips hue bulbs via ZigBee.
We are sending telemetry from sensors to IoT central via simple JSON
{"mac":"<mac address>","illumination":"200","bulb_status":"1"}
In IoT Central, we have registered our Gateway device as the IoT device with a device template which has telemetry properties related to Philips bulb and other sensors as well.
Now the challenge we are facing is, how to differentiate the data that is being sent by Philips bulb in room1 and Philips bulb in room2 in the IoT central as we have only 1 device registered in IoT Central.
The JSON has similar properties for both the bulbs and the telemetry values in IoT Central are being replaced by whichever device sends the last message.
Please provide me with the correct scalable approach for this kind of scenario.
Note: Consider our gateway device can't run IoT Edge runtime as of now. So we can't use it as Edge device.
There are two ways to tackle this. The first would be to program your gateway device to supply an identity to each of your bulbs. This means all your lamps will become a separate device in IoT Central (and you will be charged for them). Your gateway device will need to have the connection details for all of the devices it is sending telemetry for.
A second (not so pretty) way is to add a telemetry point to your interface for each lamp. So instead of brightness you would have lamp1_brightness and lamp2_brightness. I'm only including this in my answer because it is feasible and will result in seeing dashboard per lamp in IoT Central. It does not scale well either.
Eventually Azure IoT Edge will support Identy Translation, which can solve this and other questions
I have put up an E2E example of Nano BLE devices with data captured via a Central Gateway based on a Raspberry Pi using the Azure IoT Python SDK. This example is "in-progress", but I think you might find two files useful...
Main Project
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway
BLE Project
https://github.com/Larouex/IoTCNanoBLESense33
File you might want to check out...
scandevices.py
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway/blob/master/scandevices.py
This script uses BLEScan to find the BLE devices matching a naming pattern and writes them to a configuration file.
provisiondevices.py
https://github.com/Larouex/IoTCRaspberryPiProtocolTranslationGateway/blob/master/provisiondevices.py
This script and associated class use the Azure IoT SDK for Devices to read the devices in the configuration file and provision them in Azure IoT Central. The current code does a transparent approach and uses the identity of the BLE Device to provision and looks like a real device in Iot Central.
Over the next couple weeks I will continue to add the other scenarios like Opaque and Protocol Translation (which looks like the scenario you are interested in).
You may want to consider your differentiations of the Hues by modeling the locations and separate the telemetry values (versus plotting mac addresses), but you will hit some brittleness in versioning as you add or try to delete bulbs.
I recommend identify translation and associate each bulb with a model. Use the Device Groups for aggregate views. Then device properties because useful for location, etc.

Azure messages pattern

Right now, on IoT Hub there is an information that limit for messages per day 8000. I would like to ask you about any patterns which are being used in Azure.
I am curious if I am able to hit to Azure with some service outside Messages in order to prevent it from being overloaded by big amount of data, or save some confidentiality for this service.
For example, I would like to store some data from given service to Messages that are not being confidential and other data by using some WebSocket or any Rest protocol. I think that there are some patterns that serve that scenarios.
Does anyone has experience with that kind of situation?
Not everything needs to go through IoT Hub. IoT Hub is great for two way communication to/from IoT devices. You could also look at Event Hubs for ingestion from devices that don't need two way comms. We have a write up on the differences here Connecting IoT Devices to Azure: IoT Hub and Event Hubs.

Can Azure IOT hub be used to read(Get) data from some devices?

In my case I have 1000+ of devices that stores activity inside. I need to send a http get request to this device to get those data in csv or json format and save it in a storage hosted on azure.
Cab IOT hub require data using get request and can it be scheduled to read daily/weekly?
What other azure services would you suggest to facilitated this scheduled reads?
You have not mentioned which the Azure IoT Hub scale tier is used. Basically there are two price groups such as Basic and Standard with a significant different cost and capabilities. The Basic tier offers only services for one-way communications between the devices and Azure IoT Hub.
Based on that, the following scenarios can be used for your business case:
1. Basic Tier (non event-driven solution)
The device pushs periodicaly a telementry and non-telemetry messages based on the needs to the Azure IoT Hub, where the non-telemetry messages are routed to the Azure Function via the Service Bus Queue/Topic. Responsibility for this non-telemetry pipe is to persist a real device state in the database. Note, that the 6M messages will cost only $50/month. The back-end application can any time to query this database for devices state.
2. Standard Tier (event-driven solution) In this scenario you can use a Device Twin of the Azure IoT Hub to enable storing a real-device state in the cloud-backend (described by #HelenLo). The device can be triggered by C2D message, changing a desired property, invoking a method or based on the device edge trigger to the action for updating a state (reported properties).
The Azure IoT Hub has a capabilities to run your scheduled jobs for multiple devices.
In this solution, the back-end application can call any time a job for ExportDevicesAsync to the blob storage, see more details here. Note, that the 6M messages will cost $250/month.
As you can see the above each scenario needs to build a different device logic model based on the communications capabilities between the devices and Azure IoT Hub and back. Note, there are some limitations for these communications, see more details here.
You can consider using Device Twin of IoT Hub
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins
Use device twins to:
Store device-specific metadata in the cloud. For example, the deployment location of a vending machine.
Report current state information such as available capabilities and conditions from your device app. For example, a device is connected to your IoT hub over cellular or WiFi.
Synchronize the state of long-running workflows between device app and back-end app. For example, when the solution back end specifies the new firmware version to install, and the device app reports the various stages of the update process.
Query your device metadata, configuration, or state.
IoT Hub provides you with the ability to connect your devices over various protocols. Preferred protocols are messaging protocols, such as MQTT or AMQP, but HTTPS is also supported. Using IoT hub, you do not request data from the device, though. The device will send the data to the IoT Hub. You have to options to implement that with IoT Hub:
The device connects to the IoT Hub whenever it has some data to be sent, and pushes the data up to IoT Hub
The device does not send any data on its own, but stays always or at least regularly connected to IoT Hub. You then can send a cloud to device message over IoT Hub to the device, requesting the data to be sent. The device then sends the data the same way it would in the first option.
When the data then has been sent to IoT Hub, you need to push it somewhere where it is persistently stored - IoT Hub only keeps messages for 1 day by default. Options for this are:
Create a blob storage account and push to that directly from IoT Hub using a custom endpoint This would probably be the easiest and cheapest. Dependening on how you need to access your data, a blob might not be the best option, though
Create a function app, create a function with an EventHubTrigger, connect it to IoT Hub and let the function process incoming data by outputting it into any kind of data sink, such as SQL, CosmosDB, Table Storage...

Minimum requirements Azure IoT Hub

Does someone know the bare minimum required for a device to connect to the Azure IoT Hub and to send and receive messages (in terms of memory usage, processing power etc.). Or is this really case-specific?
I couldn't find a conclusive answer on the web. Does someone have experience with this?
Many thanks!
Does someone know the bare minimum required for a device to connect to
the Azure IoT Hub and to send and receive messages (in terms of memory
usage, processing power etc.).
As #juunas pointed out, it is hard to say precisely.
But you can check from the following two aspects(I assume you mean devices that communicate directly with Azure IoT Hub):
Using Azure IoT SDKs, the device needs to be capable of establishing an IP connection, support TLS, have at least 64KB of RAM ...
Using REST api, the device can connect to the Azure IoT Hub and to send and receive messages directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.
There's nothing like system/set-up requirements for Azure IoT Hub so there's no specific document from Microsoft talking about this topic. Depending on your target application you can pick the device, as all descent embedded devices can act as IoT device for Azure.
You can take a look at Azure Certified IoT device catalogue and find out whether particular device is listed under that.
MS has published 2 Whitepapers on this. You may find this useful
Evaluating Your IOT Security
The right secure hardware for your IoT deployment

Resources