Difference between revisions of "MQTT"
Line 2: | Line 2: | ||
== BoSL nano == | == BoSL nano == | ||
+ | |||
+ | The AT commands for MQTT can be found at [https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html this link]. | ||
+ | The key AT commands needed are: | ||
+ | To connect to the mqtt server: | ||
+ | AT#XMQTTCON=1,"client_id","username","password","domain_name",1883 | ||
+ | Where client_id is the name up the client publishing the material, it can be chosen by the uploader. username and password are the mqtt login credentials (if required) otherwise these can be empty (""). The domain_name is the domain name or IP address of the mqtt server, 1883 is the mqtt port, 1833 is a typical value for this. | ||
+ | To publish a message: | ||
+ | AT#XMQTTPUB="topic","the message which i want to send" | ||
+ | Where topic is the topic you want to send the message to. This is limited to 1024 bytes. The connection can then be closed with the command: | ||
+ | AT#XMQTTCON=0 | ||
+ | |||
+ | An example upload script is provided here: | ||
== BoSL Board == | == BoSL Board == | ||
For the BoSL board, an example script which publishes to an MQTT server is provided: [[File:BoSLboard mqtt example.ino]] | For the BoSL board, an example script which publishes to an MQTT server is provided: [[File:BoSLboard mqtt example.ino]] |
Revision as of 05:00, 13 April 2023
MQTT is a lightweight protocol for sending messages over the internet. This page describes how to use MQTT with the BoSL ecosystem.
BoSL nano
The AT commands for MQTT can be found at this link. The key AT commands needed are: To connect to the mqtt server:
AT#XMQTTCON=1,"client_id","username","password","domain_name",1883
Where client_id is the name up the client publishing the material, it can be chosen by the uploader. username and password are the mqtt login credentials (if required) otherwise these can be empty (""). The domain_name is the domain name or IP address of the mqtt server, 1883 is the mqtt port, 1833 is a typical value for this. To publish a message:
AT#XMQTTPUB="topic","the message which i want to send"
Where topic is the topic you want to send the message to. This is limited to 1024 bytes. The connection can then be closed with the command:
AT#XMQTTCON=0
An example upload script is provided here:
BoSL Board
For the BoSL board, an example script which publishes to an MQTT server is provided: File:BoSLboard mqtt example.ino