How to implement IoT in serial communication devices - iot

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.

Related

how i can subscribe to topics in azure iot hub device to device communication

I set up an architect for my solution think that iot hub does the work of an mqtt broker, but when I started the implementation , I found that you cannot subscribe to a specific subject to retrieve messages published by another mqtt client, the notion of topic does not exist on iot hub.
I have read several articles about this subject but I have not found an appropriate alternative.
Iot hub has only two topics, and event hub endpoints are limited to 10 endpoints
Can you guide me or suggest a solution with a broker?
How can I subscribe to a specific topic?
I want a device to device communication with pub / sub
Example: a device publishes on a topic / home / room
another device subscribes to / home / room
using iot hub
I am open to all proposals
Thank you
Cloud development
IoT Hub has a limited MQTT broker implementation, because of that, you can't subscribe to device topics from other devices. You could use an Azure Function to catch all your messages and decide if it needs to send a Cloud to Device message. You could also leverage Stream Analytics to decide if a message needs to be sent before talking to that Function. This is probably your best bet if you want to play by Azure IoT Stack's rules.
No cloud development
If you really want your devices to listen to each other, there is an old blog post that describes a scenario where a device uses the service SDK to listen to messages sent to IoT Hub by a different device. It lists the pros and cons in the post.
Custom edge module
If your devices are on the same network, you could build an Edge Module that implements an MQTT broker. The devices would then connect to the edge device as they would in a normal gateway scenario, but also to your custom broker. In your routing, you would then send all the messages to your custom broker to be transmitted to any devices listening to that topic, while still sending the data to the cloud. I imagine their are a few security risks you want to look into if you go in this direction.
So in short: it's possible, probably in many other ways, but in the end you are leveraging a cloud platform that doesn't support this natively.

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.

iOS - How to send message from hotspot (iPhone) to connected client (IoT device)

I've searched google and only found the MultipeerConnectivity framework in iOS but I don't know how I could make it work for my specific case.
The flow of what I want to do is like this:
Enable personal hotspot in iOS
Connect to hotspot from a raspberry pie
Once client is connected, send a message string from the iOS app.
Assuming that the raspberry pie connection is already sorted out (We're using a static SSID and Password for the hotspot)
The questions that come up are:
Which framework should I use (assuming there is one already)?
do I need to explicitly advertise the iOS device from the app?
How do I get notified when the raspberry connects to the phone?
How do I send a message to the connected client?
Although I never developed anything for Pi, I developed net service browsing for iOS devices, so can give an answer.
When you connect to iPhone hotspot, it's a usual WiFi connection, so here you can use Bonjour protocol (mDNS) to discover devices one another.
Run Avahi mDNS service on Pi, and discover it on iPhone.
Here is how to run Avahi on Pi.
Here is how to discover mDNS net service on iPhone.
After net service is discovered with NSNetServiceBrowser, you'll have IP address and port of your Pi available on your iPhone, so you can connect to it.
If you are trying to setup a IoT system, it may be useful to look into various cloud offerings to facilitate messaging between devices. Personally I have used AWS IoT core services in the past, and it is relatively easy to setup messaging between devices.
I am not sure what your exact use case is for this setup, but using a cloud based service to setup messaging between devices will remove the requirement to connect directly between devices via hotspot (the pi still needs some internet connection), and could make it easier to enable multiple devices and app clients in the system.

What IoT protocol would I use to for devices on the international space station?

I am creating a few function app samples and one use case is updating software for a device on the international space station. Anyone know what protocol is used?
Azure IoT Hub supports three protocols: AMQP, MQTT, and HTTPs.
Choose AMQP or MQTT except for the device only support HTTPs.
Choose AMQP if that require connecting multiple devices over the same TLS connection.
Choose MQTT if the device has limited resources (for example, less than 1-MB RAM) because it has a smaller footprint than the AMQP libraries.
It depends on your concern.
Reference - choose a communication protocol
I'm assuming your devices are connected through IoT Hub.
You can follow the device management patterns: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-device-management-overview
Specifically: Firmware Update. Which should be similar to updating software.
Device Twin should be used for IoT devices regarding management since devices can't guarantee "always online" connection. In the case of device twin, a state cache is stored in IoT Hub, when the device reconnects it can retrieve the updated state from cloud and update the device accordingly.

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