Node Red MQTT Broker Integration By Ranjith kumar DSM January 21, 2019Creating 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 setupNode-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 npmNode.js and npm installation:In Ubuntu:Open terminal and install the below packages to install node.js and npmCommand to install node.jssudo apt-get install nodejs-legacyCommand to verify node.js installed or notnode -v ##Should report version of node.jsCommand to install npm [node package manager]sudo apt-get install npmCommand to verify npm installed or notnpm -v ##Should report version of npmIn Windows 64/32 bitNode.js – Download windows installer[.msi] file from the official Node.js home pageIn 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 versionnpm -v #Should report npm versionNote: Without setting the environment variable, you will get “not recognized” error.Installing Node redOnce node.js and npm installed successfully, you can start installing the node-red.In UbuntuOpen terminal and use below command to install node-redsudo npm install -g –unsafe-perm node-red node-red-adminBasically 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 1880To verify, node-red installed or not, open the terminal and type the below commandnode-redIn 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 WindowsOpen command prompt as an Administator and use the below command to install node-red.npm install –global –production windows-build-toolsTo verify node-red installed or not, open command prompt and use this commandnode-redIn 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 MQTTBrokerRefer our Bevywise MQTTBroker help document to install MQTT broker in Ubuntu and Windows.Node Red MQTT Broker integrationHere 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 redStart 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 MQTTBrokerPayload – 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/levelRepeat – This helps you to inject the payload, multiple time with an intervalName – Any nameAfter configuring, click Done button to save it.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 BrokerTopic – the MQTT topic to publish to.QoS – Select one QoS valueRetain – Select true to enable retain, if not select falseName – Any nameAfter configuring, click Done button to save it.Now connect inject input node and MQTT output node.After node-red configuration, start the Bevywise MQTT Broker. Once the Bevywise MQTT started the node-red will connected and start the publishing.Get started your node red MQTT broker integration by downloading Bevywise MQTT Broker Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *CommentName * Email * Website Save my name, email, and website in this browser for the next time I comment.