Home About us Support Partners
Text Copied
 Home    Blog    Node Red MQTT Broker Integration

Node Red MQTT Broker Integration

node red integration

Creating and implementing a real-time IoT network with hardware and MQTT application will take time and cost you an arm and leg. We at Bevywise , create a smart and easy way to set up a virtual IoT network with node red MQTT Broker integration. Node-red is an open source visual programming tool for wiring the hardware with MQTT protocol support and Bevywise MQTT Broker is a highly scalable middleware which automate all IoT network with many customized features. Below steps help for node red MQTT Broker integration.

Node red setup

Node-red depends on node.js and npm to install Node software package. So, you should install node.js and npm in your PC. Below steps help you to install node.js and npm

Node.js and npm installation:

In Ubuntu:

Open terminal and install the below packages to install node.js and npm

  • Command to install node.js

sudo apt-get install nodejs-legacy


  • Command to verify node.js installed or not

node -v ##Should report version of node.js


  • Command to install npm [node package manager]

sudo apt-get install npm


  • Command to verify npm installed or not

npm -v ##Should report version of npm

In Windows 64/32 bit

  • Node.js – Download windows installer[.msi] file from the official Node.js home page
  • In that page select the Windows bit correctly and install it.
  • npm – Along with Node.js installation, npm will be installed.
  • In “Custom Setup” installation window, click “Add to path” and select “Will be installed on local hard drive” option to set environment variable for node.js and npm.
  • Once the node.js installation done, open command prompt and give the below command check whether node.js installed or not.
  • node -v #Should report node.js version
  • npm -v #Should report npm version

Note: Without setting the environment variable, you will get “not recognized” error.

Installing Node red :

Once node.js and npm installed successfully, you can start installing the node-red.

In Ubuntu :

  • Open terminal and use below command to install node-red

sudo npm install -g – -unsafe-perm node-red node-red-admin


  • Basically the “npm” will install the package in the current directory, but here we pass -g flag to install the package globally, so the package will be installed in /usr/local/bin directory.
  • After installation, you must enable the Ubuntu Firewall to allow node-red to access 1880 port, because node-red use 1880 port for user-interface.

sudo ufw allow 1880


  • To verify, node-red installed or not, open the terminal and type the below command

node-red

  • In terminal, “Welcome to node-red” message will print and at the end of that message you will get a URL like http://127.0.0.1:1880 to view the user interface. Open your web browser and copy paste this URL to view it.

In Windows :

npm install –global –production windows-build-tools


  • To verify node-red installed or not, open command prompt and use this command

node-red


  • In terminal, “Welcome to node-red” message will print and at the end of that message you will get a URL like http://127.0.0.1:1880 to view the user interface. Open your web browser and copy paste this URL to view it.

Installation of Bevywise MQTTBroker

Refer our Bevywise MQTTBroker help document to install MQTT broker in Ubuntu and Windows.

Node Red MQTT Broker integration

Here we show you a basic Node red MQTT Broker integration. With this basic you can create a virtual IoT network in node-red and integrate to Bevywise MQTTBroker.


Configuring Node red

Start the node-red and open the user interface of node-red in your web browser. In node-red user interface, the left side lists are the node and in the right side tab, quick description about the node will be shown.

  • First, drag and drop the “inject” node from the input list.
  • Next, click the injects node and hit enter to edit the node
  • In the edit panel, you can see below parameters which will help you to give input to the Bevywise MQTTBroker
  • Payload – If you click the drop down, you can see many formats for the payload, based on this format payload will be injected to MQTT.
  • Topic – Give a published topic with UTF-8 string followed by a forward slash. For example : Dairy/Milk/Tank/level
  • Repeat – This helps you to inject the payload, multiple time with an interval
  • Name – Any name
  • After configuring, click Done button to save it.
edit inject node

  • Next, drag and drop “mqtt” node from output list.
  • Click mqtt node and hit enter, to open edit panel.
  • Server – Give the IP address where you’re running Bevywise MQTT Broker
  • Topic – the MQTT topic to publish to.
  • QoS – Select one QoS value
  • Retain – Select true to enable retain, if not select false
  • Name – Any name
  • After configuring, click Done button to save it.

CONNECTION :


connection

SECURITY :


security

MESSAGES :


messages

  • Now connect inject input node and MQTT output node.
connecting nodes

Once the Node-RED configuration is completed, start the Bevywise MQTT Broker. When the Bevywise MQTT Broker is running, Node-RED will establish a connection upon clicking the deploy button, enabling the commencement of publishing.

broker dashboard

devices

Get started your node red MQTT broker integration by downloading Bevywise MQTT Broker. Try our MQTT Broker for FREE and experience seamless connectivity.