All Collections
Connect your Devices
Connect an NCD IoT Edge Computer to Ubidots
Connect an NCD IoT Edge Computer to Ubidots

Learn how to send Sensor data to Ubidots from an NCD IoT Edge Computer

Santiago Pachon Robayo avatar
Written by Santiago Pachon Robayo
Updated over a week ago

NCD’s first IoT edge computer is a Linux-based system that supports LTE, Ethernet, and WiFi connectivity for sending data from the ecosystem of NCD’s Sensors. With the built-in Node-RED this device offers interoperability with a great number of platforms and communication technologies. It also brings a small OLED display and a LED to show the status of the connection among other user-configurable data.

image.png

Today you’ll learn how to setup your IoT Edge computer to send sensor data to Ubidots through MQTT in just a few clicks.

Table of Contents

Requirements

  • NCD IoT Edge Computer

  • NCD Wireless Sensor

  • Any browser to access the NCD Setup UI

  • An active Ubidots account (Commercial or STEM license)


1. Setup

The setup for the IoT Edge computer is quite simple, just follow the steps presented in this guide. In this case, we’ve connected the Edge Computer to an Ethernet port, so the steps go as follows.

NOTE: Please be patient with the system, as it will be quite slow the first time that it is running, especially the user interface.

  1. Power up the IoT Edge computer

  2. On your computer search for a Soft AP with a similar name to “ncdgateway-XXXX” and connect to it.

    NOTE: the AP password is: ncdgateway

    image.png
  3. On any browser type in 192.168.3.1, this will open NCD’s User Interface (UI). You will find 5 tabs in the UI:

    1. System: Tab for setting up general configurations of the IoT Edge Computer
    2. Network: Tab for setting up the connectivity configuration.
    3. Modem: Tab for setting up the LTE configuration
    4. Node-RED: Tab for opening an instance of Node-RED in your browser
    5. Terminal: Tab for opening the IoT Edge Computer’s terminal

  4. Go to the Network tab and enable the connectivity method that you will be using, in this case, we will enable Ethernet.

  5. Connect to the network, in our case we just plugged the Ethernet cable in. For WiFi, just enter the SSID and Password.

    image.png


    TIP: We noticed that the IoT Edge Computer has trouble connecting to WiFi Networks that have white spaces in their SSID.

  6. After that, you should be able to view the IP to the router that you are connected in the small OLED screen inside the IoT Edge Computer. If the status is “DOWN”, then retry the connection.

2. Node-RED Setup

To open Node-RED on your browser, the computer must still be connected to the Soft AP that the gateway created. You can open it by typing 192.168.3.1:1880 into your browser, or by simply clicking the Node-RED tab from NCD’s UI.

In order to make the IoT Edge Computer connect to Ubidots, you must first download Ubidots’ Node-RED library. There are two ways that you can download the library.

  • From the Node-RED instance (Please view this article)

  • From the IoT Edge Computer’s Terminal.

    • Click on the Terminal tab of the UI

    • Login using root as the username and ncdio as the password.

      image.png

    • Type in the command node_install.sh ubidots-nodered

Now that the library has been installed, reload the Node-RED tab and you should be able to view two new nodes: ubidots_in and ubidots_out.

image.png

3. Send data to Ubidots

First lets try out a simple test just to make sure everything is working correctly by sending a fixed value to Ubidots. Copy this flow into your Node-RED and import it into your flow.

[{"id":"56f1517c.bf6b5","type":"inject","z":"40aac4dd.93e69c","name":"Send test data","topic":"","payload":"{\"test-variable\":1}","payloadType":"json","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":300,"y":240,"wires":[["52a10a59.cde254"]]},{"id":"52a10a59.cde254","type":"ubidots_out","z":"40aac4dd.93e69c","name":"","token":"","label_device":"","device_label":"iot-edge-test","tier":"business","tls_checkbox":true,"x":570,"y":240,"wires":[]}]

Remember to assign your Ubidots Token in the ubidots_out node and then hit deploy.

image.png

A device labelled iot-edge-test containing a variable labelled test-variable should have been created, and it should be receiving 1s roughly every 5 seconds.

image.png


Now that we know that the IoT Edge Computer has successfully connected to Ubidots, we can add real sensor data. To find more information on how to connect and setup your sensors to the IoT Edge Computer please visit this guide.

In this example we will use NCD’s Temperature and Vibration Sensor (PR49-24E).

NOTE: If this sensor is to be powered by the barrel jack, leave the jumper (or switch) closer to the PS letters, if it is to be powered by AA batteries, set the jumper (or switch) farther from the PS letters.

image.png

To begin receiving data from the sensor, simply open a Wireless Gateway node from NCD’s preinstalled nodes. Configure it by giving it a name and then have it connected to the Iot Edge Computer via a serial device.

image.png

Once that is done you may add a debug message to view the data incoming from the Device. Usually the sensors are configured to send every 10 minutes, but you can force a Data transmission by pressing the RESET button on your sensor.

image.png

Once you can see the data coming in, you may add the Function node that extracts the Sensor Data from the whole payload, parses it and builds an Ubidots compatible JSON.

image.png

Finally, you add the ubidots_out node to send the sensor data to a device in Ubidots. Remember to assign your Ubidots Token and the Device_label into this node.

image.png

Here’s the clipboard version of the publish example so you can easily import it into your Node-Red flow.

[{"id":"6047423a.7ffffc","type":"ncd-gateway-node","z":"7b775952.730548","name":"Temperature and Vibration Sensor","connection":"837142ce.132b28","x":180,"y":180,"wires":[["80aeb893.900938"]]},{"id":"80aeb893.900938","type":"function","z":"7b775952.730548","name":"Parsing","func":"var data = msg.payload.sensor_data;\nvar timestamp = msg.payload.received;\nvar payload = {};\nfor (const key in data){\n payload[key] = {value : data[key],timestamp : timestamp};\n}\n\nmsg.payload = payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":180,"wires":[["818e21b9.9c4e3"]]},{"id":"818e21b9.9c4e3","type":"ubidots_out","z":"7b775952.730548","name":"","token":"","label_device":"","device_label":"temp-vib-sensor","tier":"business","tls_checkbox":true,"x":720,"y":180,"wires":[]},{"id":"837142ce.132b28","type":"ncd-gateway-config","z":"","name":"","comm_type":"serial","ip_address":"","tcp_port":"2101","port":"/dev/ttyS1","baudRate":"115200","pan_id":"7FFF","rssi":true}]

Now the data can be seen in the newly created Device in Ubidots.

image.png

4. Summary

The IoT Edge Computer brings many perks that allow you to customize the sensor network and data for you application.
Now that you’ve connected the IoT Edge Computer to Ubidots through Node-RED, you can add a great array of NCD sensors to monitor all of your great IoT applications that require long range connectivity.

Other users also found the following helpful...

Did this answer your question?