Telegram chatbot Contact



















Introduction to the MQTT Protocol

The MQTT (Message Queuing Telemetry Transport) Protocol is a lightweight and efficient messaging protocol, widely used in the Internet of Things (IoT). Its design facilitates communication in environments where low latency, minimal bandwidth consumption, and energy efficiency are required, which is essential for connected devices with limited resources.

What is MQTT?

MQTT is a messaging protocol based on the publish-subscribe model. It was designed in 1999 by Andy Stanford-Clark from IBM and Arlen Nipper from Arcom (now Eurotech), aiming to connect oil and gas systems over satellite connections with limited bandwidth and high latency. Today, it is used in a wide range of applications, from home automation to industrial telemetry.

Publish-Subscribe Model

The publish-subscribe model of MQTT is simple yet powerful. In this model, "clients" can subscribe to specific "topics" provided by an MQTT "broker". Other clients can publish messages on these topics, and the broker is responsible for distributing the messages to all clients subscribed to the corresponding topic.

Key Components of MQTT

1. MQTT Client:

A device or application that can publish messages to other clients and/or subscribe to topics to receive messages.

2. MQTT Broker:

A server that receives all messages from the clients and then distributes them to the subscribed clients based on the topics they have subscribed to.

3. Topic:

A message identifier that clients use to filter the messages they need to receive. Topics can have multiple levels of hierarchy.

Operational Scheme

Connection: A client connects to the broker by providing a unique identifier and, optionally, authentication credentials.
Subscription: The client subscribes to one or more topics with the broker.
Publication: Another client publishes a message on a specific topic.
Distribution: The broker receives the message and distributes it to all clients subscribed to the specific topic.
Reception: The subscribed clients receive the message.

Benefits of MQTT

Efficiency: Uses minimal bandwidth and is ideal for networks with limited resources.
Decoupling: The producers and consumers of messages are decoupled, meaning they do not need to know each other.
Scalability: Capable of handling thousands of devices simultaneously.
Reliability: Offers different levels of quality of service to ensure message delivery.

MQTT has established itself as a fundamental pillar in the IoT world due to its simplicity and efficiency. It is particularly useful in applications where devices must communicate reliably and efficiently in resource-limited environments.


Enhancing Connectivity with IONA and MQTT

The IONA, as a panel indicator and automation measurement device, offers a significant enhancement for users needing advanced communication solutions. This device supports MQTT communication when equipped with an Ethernet communication option. This option is a peripheral that can be connected to the IONA motherboard and is typically sold together with the device.

Enabling MQTT on IONA

To enable MQTT communication on the IONA, users need to install the Ethernet communication option. Once installed, data generated by the IONA can be sent to an MQTT broker for storage or further analysis. This setup allows for efficient data handling and integration into broader data management and analysis systems.

Configuration Steps

To activate and configure MQTT communication:

Accessing the Webserver: Navigate to the communications section on the IONA webserver.
Activating MQTT: Select the option to enable MQTT communication.
Configuration Settings: Enter the necessary details to establish the connection. These details include:
MQTT Broker URL: mqtt://ditel2.seoxan.es.
Username and Password: These credentials are required for authentication with the broker.
Transmission Frequency: Set how often the IONA sends data to the broker.

Setting Up a Broker Account

To utilize our MQTT server for the IONA, users must create an account at broker.ditel.es. This account allows users to manage their device connections securely and to handle the data transmitted via MQTT.

By connecting the IONA to an MQTT broker via the Ethernet option, users can greatly enhance the device’s functionality, making it a powerful tool for real-time data integration and analysis in various industrial applications.




Data Transmission with Ditel's MQTT Cloud Service

By activating Ditel’s MQTT Cloud Service, the data from your IONA sensors is transmitted seamlessly to our MQTT broker. This setup enables real-time monitoring of temperature, humidity, and CO₂ data, which is securely received and stored on the cloud.

Not only can you monitor environmental data, but you also gain the capability to send messages to your IONA displays through MQTT commands. Messages can be sent directly from the broker to the displays, allowing for instant updates and customized information displays on your screens.

With MQTT Cloud, you’ll experience a fully integrated and interactive monitoring solution, ensuring efficient data handling and flexible control over your IONA devices.

MQTT Communication Manual for IONA

1. Receiving Information (Subscribe)

The IONA device sends telemetry data in JSON format, which can be received by subscribing to a specific topic on the MQTT broker.

  • Topic Format: {useremail}/{devicetype}/{serialnumber}
  • Example: user@example.com/iona/ITYYY2

Example of Received Message

The JSON sent by IONA contains relevant device information, including the serial number, date, local and public IP, temperature, humidity, signal level (dBm), battery, and MAC address. Here’s an example of a received message:


{
    "serialNumber": "ITYYY2",
    "date": "2024-11-03T19:22:01+01:00",
    "ipLocal": "192.168.1.33/24",
    "ipPublic": "79.156.39.210\n",
    "temperature": 13.4,
    "humidity": 63.6,
    "dbm": -94,
    "battery": 94,
    "MAC": "bc:57:29:12:1f:b7"
}
                    

Each field has the following purpose:

  • serialNumber: Unique identifier of the device.
  • date: Date and time of the message.
  • ipLocal: Local IP address of the device.
  • ipPublic: Public IP address.
  • temperature: Recorded temperature in degrees Celsius.
  • humidity: Humidity percentage.
  • dbm: Signal level in dBm.
  • battery: Battery level in percentage.
  • MAC: MAC address of the device.

2. Sending Information (Publish)

To send messages to IONA, the JSON format must include device details and the configuration for the text lines to display. The message is published to the specific topic for IONA.

  • Topic Format: {useremail}/{devicetype}/{serialnumber}
  • Example: user@example.com/iona/ITYYYY

Example of Message to Send

The following JSON configures the device screen, including text style, colors, effects, and message content. An example of a message to send would be:


{
    "serialNumber": "ITYYYY",
    "date": "2024-10-25T09:23:17+02:00",
    "lines": {
        "line1": {
            "font-family": "Arial",
            "font-size": "40",
            "color": "#ff0000",
            "background-color": "#000000",
            "effect": "scroll",
            "blink": true,
            "message": "9:24",
            "imageb64": ""
        }
    }
}
                    

The parameters within lines control the format and content of the text line displayed on the screen:

  • font-family: Font family (Valid fonts: Arial,Poppins,Courier).
  • font-size: Font size. (Valid: 40,80,120)
  • color: Text color in hexadecimal format.
  • background-color: Background color in hexadecimal format.
  • effect: Effect to apply (Valid: scroll, inmediato, subir, bajar, iherit).
  • blink: Activates blinking (boolean, true/false).
  • message: Text to display on the screen.
  • imageb64: Image in base64 format (beta).

Complete Example of MQTT Workflow

Subscribe to the topic to receive information:

  • Topic: user@example.com/iona/ITYYY2

Publish to the topic to send information:

  • Topic: user@example.com/iona/ITYYYY
  • JSON screen configuration message:

{
    "serialNumber": "ITYYYY",
    "date": "2024-10-25T09:23:17+02:00",
    "lines": {
        "line1": {
            "font-family": "Arial",
            "font-size": "40",
            "color": "#ff0000",
            "background-color": "#000000",
            "effect": "scroll",
            "blink": true,
            "message": "9:24",
            "imageb64": ""
        }
    }
}

This manual allows you to configure and receive data from IONA via MQTT, facilitating the monitoring and adjustment of the information displayed on the device.

MQTT Examples for IONA using Mosquitto

Sending a Message to IONA using Mosquitto

To send a message to IONA, use the mosquitto_pub command. Replace {broker_address} with your MQTT broker address, {username} and {password} with your MQTT credentials, and adjust the topic and message as needed.

# mosquitto_pub -h {broker_address} -t "user@example.com/iona/ITYYYY" -u {username} -P {password} 
                        -m '{
                            "serialNumber": "ITYYYY",
                            "date": "2024-10-25T09:23:17+02:00",
                            "lines": {
                                "line1": {
                                    "font-family": "Arial",
                                    "font-size": "40",
                                    "color": "#ff0000",
                                    "background-color": "#000000",
                                    "effect": "scroll",
                                    "blink": true,
                                    "message": "9:24",
                                    "imageb64": ""
                                }
                            }
                        }'
                    


Receiving Data from IONA using Mosquitto

To receive data from IONA, use the mosquitto_sub command. Replace {broker_address}, {username}, and {password} with your MQTT broker details and credentials. The example below subscribes to the specific topic for receiving data from the device.

mosquitto_sub -h {broker_address} -t "user@example.com/iona/ITYYY2" -u {username} -P {password}

This command subscribes to the IONA topic, allowing you to receive telemetry data in real-time.