National Control Devices (NCD) offers a large variety of hardware for all different kind of applications related to the IoT industry. In this article, you'll learn how to connect their Smart Industrial IoT Wireless Vibration Temperature Sensor to Ubidots through NCD's IoT Edge computer and the MQTT protocol using Ubidots' native nodes.
Requirements
Table of contents
1. Get the IoT Edge Computer IP address
This guide assumes that your Smart IIoT vibration Sensor is already operating in Process Mode, so make sure to meet this requirement before going further. By default, NCD ships all its industrial vibration sensors set to this mode.
Connect the IoT Edge Computer to the router over Ethernet (it also supports WiFi but for ease of set up Ethernet will be used) and wait until an IP address is assigned to the gateway. The assigned IP address will be shown in the device's OLED screen:
2. Build the Node-RED flow
In order to complete the following step, your NCD IoT Edge Computer needs to have installed Ubidots' MQTT nodes. Visit the following link in order to learn how to install said nodes to your IoT Edge Computer's Node-red.
To launch Node-RED on the IoT Edge Computer, open any web browser of your preference and type the device's IP address, followed by :1880. I.e. if your device's IP address is 192.168.22.112, then you'll have to type 192.168.22.112:1880. After doing so, Node-RED will launch:
Import the required flow for this application by pasting the following JSON in the Import Flow option in Node-RED. Head to this link in order to learn how to import flows in Node-Red.
[
{
"id":"84b43d97.bba868",
"type":"tab",
"label":"Flow 1",
"disabled":false,
"info":""
},
{
"id":"6f13d0a7.bdfc38",
"type":"ncd-gateway-node",
"z":"84b43d97.bba868",
"name":"",
"connection":"837142ce.132b28",
"unknown_devices":0,
"outputs":1,
"x":230,
"y":420,
"wires":[
[
"bc5ec98b.e75df"
]
]
},
{
"id":"8665d7ef.00397",
"type":"delay",
"z":"84b43d97.bba868",
"name":"",
"pauseType":"rate",
"timeout":"5",
"timeoutUnits":"seconds",
"rate":"4",
"nbRateUnits":"1",
"rateUnits":"second",
"randomFirst":"1",
"randomLast":"5",
"randomUnits":"seconds",
"drop":false,
"x":750,
"y":400,
"wires":[
[
"7157b70e.ab3a58",
"29f8f3d6.39c674"
]
]
},
{
"id":"7157b70e.ab3a58",
"type":"debug",
"z":"84b43d97.bba868",
"name":"",
"active":true,
"tosidebar":true,
"console":false,
"tostatus":false,
"complete":"true",
"targetType":"full",
"statusVal":"",
"statusType":"auto",
"x":930,
"y":400,
"wires":[
]
},
{
"id":"bc5ec98b.e75df",
"type":"function",
"z":"84b43d97.bba868",
"name":"Format Data",
"func":"if(msg.topic == \"modem_mac\")\n{\n return;\n}\n\nlet payload = msg.payload.sensor_data;\nlet deviceLabel = msg.payload.addr\npayload.odr = payload.odr.slice(0,-2);\npayload.battery_percentage = msg.payload.battery_percent;\npayload.battery = msg.payload.battery;\ndelete payload.Ext_temperature;\nmsg.payload = payload;\nmsg.payload.ubidotsDeviceLabel = deviceLabel;\n\nreturn msg;",
"outputs":1,
"noerr":0,
"initialize":"",
"finalize":"",
"x":510,
"y":400,
"wires":[
[
"8665d7ef.00397"
]
]
},
{
"id":"29f8f3d6.39c674",
"type":"ubidots_out",
"z":"84b43d97.bba868",
"name":"send data to Ubidots - MQTT",
"token":"",
"label_device":"",
"device_label":"",
"tier":"business",
"tls_checkbox":true,
"x":980,
"y":460,
"wires":[
]
},
{
"id":"837142ce.132b28",
"type":"ncd-gateway-config",
"name":"",
"comm_type":"serial",
"ip_address":"",
"tcp_port":"2101",
"port":"/dev/ttyS1",
"baudRate":"115200",
"pan_id":"7FFF",
"rssi":true
}
]
Once you've done that, the imported flow will look like the following:
In order to send data to your Ubidots account, you need to set your Ubidots Account Token. To do so, double click the ubidots_out node and set your Token on the Token field. Once done, click the Done button to save the current settings.
Lastly, click the Deploy button. The data being sent to Ubidots will be displayed at the right side of the screen by de Debug node:
3. Visualizing the data on Ubidots
Go to your Ubidots account, Devices section and you'll be able to see the nodes sending receiving data on Ubidots.
Ubidots offer their users a large set of Widget and functionalities in order to let them build and customize dashboards according to their requirements. The following is an example of a dashboard displaying some of the variables reported by the Smart IIoT vibration Sensor:
4. Feedback, Suggestions and Related Articles
Feel free to post questions or suggestions in our community portal, or contact us via support@ubidots.com.
Other users also found helpful...