Sensors Compatible with HiveMQ

Sensors Compatible with HiveMQ

Introduction

In the ever-evolving landscape of IIoT technology, the ability to seamlessly connect and communicate with wireless sensors is paramount. NCD has emerged as a prominent player in this field, offering a range of innovative wireless sensors designed to monitor and collect data from various sources. In this article, we will delve into the exciting world of NCD wireless sensors and guide you through the process of integrating them with the HiveMQ MQTT broker. By the end of this tutorial, you will have the knowledge and skills needed to harness the power of NCD sensors and HiveMQ to create efficient and scalable IoT solutions that can transform the way you collect and manage data. Whether you’re a seasoned IoT enthusiast or just embarking on your journey into the world of wireless sensors, this article will be your comprehensive guide to achieving seamless connectivity and data exchange.

Hardware used in this article

network node-red

Enterprise IIoT Gateway

Takes wireless sensor data and sends it to any cloud or database
Click to Learn More

Topology of the Network

Enterprise Wireless Sensors

Long range wireless IIoT sensors
Click to Learn More

Sign in to HiveMQ

The first step will be creating a HiveMQ account if you have not already.  Once the account is created log in and you should be taken to the console.  HiveMQ automatically created a Cluster for me as shown in the image.  This is essentially the MQTT Broker which we will publish sensor readings to and monitor them from our software client.

 

Sign in to HiveMQ

Create Access Credentials(Gateway)

Click Manage Cluster, then at the top of the following page click Access Management.  Here we will create credentials for the Enterprise Gateway and our Software client.  This will allow the two to communicate with each other.

For my Enterprise Gateway I set the username to the Gateway’s mDNS address to keep things easy.  I then set a password I can remember and set the Permission to Publish Only.  You could set to Publish and Subscribe but for now my Gateway will only publish sensor readings.

Create Access Credentials(Gateway)

Create Access Credentials(Software)

After clicking Create Credential for the Gateway we’ll create another credential for our software.  I set mine to subscribe only.  This is sort of one way communication with sensor readings coming from the Gateway to the software.  This is totally optional, feel free to set yours to Publish and Subscribe.  I also set the username to Explorer since I will be using these credentials with MQTT Explorer to test functionality.

Create Access Credentials(Software)

Review Credentials

After creating the credentials you can scroll down and see them below.  This is all we need to do for now.  We are already done with all configuration on HiveMQ.  While you’re here however you can click on Overview at the top and copy the Cluster URL.  After that feel free to close the browser window if you wish(once again optional).

There are permissions as well here further down but that is a topic for another day.  Right now we just want to see sensor readings over HiveMQ.

Review Credentials

Hook up the Gateway

We’ll start by getting our Enterprise gateway hooked up.  If you have not yet reviewed the user guide for the Enterprise Gateway I encourage you to do that now.

Open the Enterprise Gateway’s Node-Red flow editor in your web browser.  Let’s start by making sure it sees data from our sensor.  There will be a flow deployed already with a Gateway node connected to a Debug node.  Click the debug button in the upper right corner, then press the RST button on the sensor.  You should see sensor data printed in the Debug panel.

Hook up the Gateway

Import the Node-Red Flow

To make things simpler I created a Node-Red flow you can import and edit.  This will save you some steps.

Download the HiveMQ.json file here.

In Node-Red click the menu button in the upper right button that looks like 3 lines.  Click Import, then click Select a file to import.  Select the file you downloaded and click Import.  If prompted click Import Copy.  A tab for the new flow is created at the top.  Click to view it.

Here you can see the complete flow.  We need to edit it though.

Import the Node-Red Flow

Configure the Flow

Double click the HiveMQ node to open its editor.  Click the edit button to the right of the Server Field.  

Under the Connection tab paste the Cluster URL you copied from HiveMQ in a previous step.

Under the Security Tab enter the username and password you entered when creating credentials for the Enterprise Gateway.  I also recommend setting Client ID to the Username, but you can set it to whatever you like.  Then Click Done until the Settings window is closed.  Finally click the Deploy button in the upper right corner.  After a few seconds the Hive MQ Node should show Connected.  Data from the sensor is now being published to the HiveMQ broker.

Connect Software to HiveMQ

For my testing I will be using MQTT Explorer.  It’s free, at the moment, and is cross platform so it runs on Windows, Mac, and I believe Linux.  You can download it here.  Be sure to support the Creator Thomas in any way you can.

Open MQTT Explorer.  Then create a new Connection.  I named mine HiveMQ.  Uncheck Validate Certificate, make sure Encryption is enabled.  Paste the Cluster URL from HiveMQ in the Host field, set port to 8883, then enter the username and password you set for the Software client in the previous step on HiveMQ.  

Now click Advanced.  Make sure there is a subscription to # Then click Back, then Connect.

Connect Software to HiveMQ

Final Testing

You can press the RST button on your sensor to force a transmission.  After a few seconds you should see an item appear on the list on the left labeled ncd, expand that and you will see a serial number unique to your sensor.  Click it to view the data from the sensor.  At this point you are successfully publishing data to HiveMQ from your sensor and monitoring it on HiveMQ.

Where you go from here is for your imagination to decide.  Have fun.

Final Testing
Share this on:
Facebook
Twitter
LinkedIn
Pinterest
Reddit
WhatsApp
Email
YOU MIGHT ALSO LIKE...​
Machine Up Time Monitoring Product Manual

Table of ContentsApplications & Use-casesApplications​Use-casesDetailed Specifications of NCD’s Uptime MonitorDevice OverviewStatus LEDPower Requirements and Expected Battery LifePower RequirementsExpected Battery LifePrinted Circuit Board SpecificationsMechanical DrawingSensor SpecificationsProbes SpecificationsPin DefinitionGetting startedNode-RED DashboardAdvanced ConfigurationFrame Communication at Power UpRun Mode Power Up FrameConfiguration Mode Power Up FramesFactory Reset Mode Power Up FramesRun ModeConfiguration ModeExample Configuration CommandsRead Sleep DurationSet Sensor Node ID and Sleep DurationRead Sensor Network IDSet Wireless Sensor Network IDRead Sensor Destination Address​Set Sensor

Read More »
IIoT AC Current Monitor Sensor Node-RED Dashboard

Table of Contents Introduction Current and voltage monitoring of Industrial Electrical Equipment such as motors, transformers, generators, batteries, photovoltaic plants, wind turbines, among others, is essential to ensure the proper functioning of these assets and help maintain the most efficient production flow, bringing more reliability to the industrial plant. By using IIoT current and voltage monitoring devices to track the health of machinery, it is possible to identify early failures,

Read More »
Getting started with NCD 4-20mA Current Sensor and TagoIO

Table of Contents Pre-requisites This guide assumes you are somewhat familiar with TagoIO and you have registered with the platform already. If you have not you can do this via the TagoIO page. Another pre-requisite is that you have a 4-20mA Current Sensor and an Edge Gateway and they are connected and working. You can refer to the Sensor Manual if you have issues setting it up. Creating the device

Read More »