Skip to main content
Skip table of contents

Getting Position Information using MQTT and Node-Red

Prerequisites

Node-Red must be installed on your system as well as an active MQTT broker.

Setup

  1. Ensure your MQTT broker is running and accessible. Read this article for instructions on setting up an MQTT broker on Windows using Mosquitto.

  2. Open Node-Red in your browser and navigate to your Node-Red instance.

    image-20240711-164553.png
  1. Configuring Node-Red Nodes

    • Drag an MQTT IN node from the palette located on the left to the flow.

      image-20240711-164649.png

    • Double-click the MQTT IN node to configure its settings.

    • Click the pencil icon next to the server to add a new MQTT broker configuration.

      image-20240711-164748.png

    • Enter the MQTT broker’s IP address (e.g. 10.22.74.163) and port (1883). This IP address is the same as your previous MQTT broker’s IP address.

      image-20240711-164859.png

    • Click the Add button.

    • Set the topic of your choice.

    • Click Done.

Note: Ensure that the MQTT V5 protocol is selected and that the Keep Alive value is set to 60.

Adding a Debug Node

  • Drag a Debug node from the palette to the flow.

  • Connect to the output of the MQTT IN node to the Debug node.

  • Ensure that the Debug node is set to show the complete message object or the payload.

image-20240711-165044.png

Deploying the Flow

  1. Click the Deploy button in the top right corner to save and deploy all changes made.

  2. Click the button on the Debug node to start receiving the position data.

image-20240711-165145.png


Verifying Data Flow

  1. Navigate to the debug pane on the right side of the Node-Red editor.

  2. You should see the positioning data being received in the debug pane, indicating that the messages are successfully being received via the MQTT broker.

The image below is an example of the data that is received in Node-Red.

image-20240711-165242.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.