NCD (National Control Devices) is an electronics manufacturer on the cutting edge of the IoT industry focusing on interfacing the analog world with digital electronics. NCD products unite the digital with the analog enabling you to monitor and control your environment.
Today, you'll learn how to connect the entire ecosystem of NCD IoT sensors to Ubidots in just a few minutes, but first, before proceeding through this article we would highly recommend referencing the WiFi Micro Gateway Setup for MQTT article, which explains the MQTT Gateway in greater detail.
In this setup guide, NCD Long Range wireless sensors will send data to a Gateway located up to 2 miles away from the sensors in your installation. The Gateway will forward the IoT sensor data to Ubidots using the MQTT Protocol. Data about the gateway and all associated sensors will be visible on the Ubidots dashboard.
IMPORTANT NOTE: A WiFi network with internet connectivity for connecting the MQTT Gateway. Please note that only 2.4GHz connections are currently supported. For more detailed information about the MQTT Gateway Setup refer to this guide.
- Get an Ubidots TOKEN
- Open the Gateway Setup page
- Configure the Gateway for Ubidots
- Display Ubidots' devices
1. Get an Ubidots TOKEN
The first step is getting a token for connecting an MQTT client to Ubidots.
Sign into your Ubidots account, then click on your user icon in the top right corner and then copy the token available there. We use this token for the username on the MQTT connection.
NOTE: This guide covers basic authentication on the MQTT connection. While Ubidots and the NCD MQTT Gateway both support TLS connectivity, we will not be using TLS in this example.
2. Open the Gateway Setup page
If your gateway is not already in setup mode (Flashing Blue LED) then open the lid by removing the 4 screws, then press and hold the Red CFG until the LED begins flashing Blue. Once the LED is flashing Blue then it is in setup mode.
On your computer, smart phone or tablet scan for WiFi networks, then once it appears connect to WiFi Micro Gateway. Many devices will automatically pop up a window for configuration of the Gateway as soon as you connect, if this does not happen simply open your web browser and enter 22.214.171.124. Either way you should see the configuration page for the Gateway.
For more detailed setup directions, please refer to the MQTT Gateway Setup Guide.
3. Configure the Gateway for Ubidots
The screen shot to the right is an example of how to configure the MQTT Gateway for connection to a Ubidots account.
- Select the WiFi network to associate the MQTT Gateway to a local router with internet connectivity.
- Enter the password for your WiFi network.
- Ubidots has a couple of possible MQTT broker host end points. This tutorial is using the Industrial end point. Enter industrial.api.ubidots.com into the Domain field.
- Since TLS will not be used in this tutorial, Set the Port value to
1883. Use a port value of
- For Client ID, enter a unique name for the Gateway. Do not use multiple MQTT clients with the same Client ID.
- In the User Name field, paste in the Token you previously copied from Ubidots (Step 1 Above).
- Set the Gateway Message Format to
::Gateway_Data::This is a token that indicates the formatting method for gateway communications. More information on supported gateway message formats may be found in the WiFi Micro Gateway Setup for MQTT article.
- Ubidots documents the topic structure, which requires topics to be prepended with
/1.6/devices/device_idso for Gateway Topic format. Enter
/v1.6/devices/::Gateway_ID::This is the topic the Gateway will use to report information about itself.
- For Sensor Message format, enter
::Sensor_Data::this will simply post the sensor’s transmitted information as a JSON formatted packet.
- For Sensor Topic format, Ubidot’s documentation suggests prepending the topic with
/v1.6/devices/, be sure to enter
- Finally, click the “Save Settings” button. The MQTT Gateway will now store your settings, reboot, connect to WiFi, then try to establish a connection to the Ubidots broker utilizing the indicated settings. The LED on the gateway should begin flashing Green, which indicates the gateway is fully functional and has an established connection to Ubidots.
Compare the changes made with the following image to make sure everything was set up properly:
IMPORTANT NOTE: Make sure to have the DHCP enabled in the advanced settings.
4. Display Ubidots Devices
Reconnect your computer to your regular network with internet connectivity.
From the Ubidots dashboard, go to your Ubidots account. Click on the “Devices” drop-down menu, then click “Devices” to view the list of devices. You should see NCD sensors and your MQTT gateway in this list. The name of the Gateway will never begin with
00: , as this is reserved for the sensors. If you have any sensors powered up, they will automatically appear here as well.
Click on a sensor to view sensor readings and other information.
Now it's time to create Ubidots Dashboards to visualize and understand your data to make the best decisions, simply and coherently.
In just a few minutes you've integrated NCD sensors with Ubidots, sent some data from the sensors and reported your work to Ubidots for data retention, visualization and calculation.
The NCD sensors offer long-range, price, accuracy, battery life and security features, being an affordable choice which exceeds the requirements for most industrial, as well as consumer market applications.
To deploy your Industrial solutions for monitoring or management, check out the full lineup of NCD sensors that can be connected to Ubidots to enrich data to make decisions and improve processes.
Other readers have also found useful...