This article explains how to get Crimson® 3.1/3.2 to talk to Ubidots using the dedicated Ubidots MQTT Connector. For more details on the Crimson cloud connectors, please consult the Crimson User Manual.

NOTE: Only numeric data can be transferred, so flag tags should be converted to integers (1/0) and string tags cannot be transmitted at this time.

Compatible Red Lion products: DA Series FlexEdge Controllers

Requirements

  1. Ubidots trial account or Licensed account

  2. Crimson 3.2 or Crimson 3.1

Table of Contents

  1. Configure the device

  2. Create a test Database

  3. Getting Connected

  4. Configuring the Ubidots Connector

  5. Viewing the Data

1. Configure the device

In Crimson 3.2, navigate to File | New and select your device and its configuration. In this case, we will be using a DA70A with no sleds fitted. Note that you must have a Group 2 or greater license to enable the Cloud Connectors. As we will be using the Web Server in this example we need a Group 3 license.

Next configure an Ethernet port on the same subnet as your PC. In this case we will be using the Ethernet 1 which has been assigned 192.168.1.211, subnet mask 255.255.255.0 by the network DHCP Server but you can use your own settings.

NOTE: If you are manually specifying an IP address, you must also define a default gateway and manually provide DNS servers. The gateway is necessary for your device to push data to the Internet and the DNS servers are used to convert the cloud server name into an IP address.

Finally set the download IP address under Link | Options which will be used to download your Crimson database to the FlexEdge.

Also ensure that the Time Sync Time Zone and NTP settings are correct for your system. As you are connecting to the Internet the default settings of Automatic for both should be OK.

These settings enable time synchronization, allowing your device to set its real-time clock from the Internet. Having an accurate real-time clock is important not only for time-stamping data but also for ensuring the correct operation of certain security algorithms.

Once you have downloaded your database for the first time, select the Send Time option from the Link menu within Crimson to set the device’s time zone to that of your PC. If you need to set it to a different time zone, refer to the Crimson manuals for information on the time zone system variables.

2. Create a Test Database

Start by navigating to the Data Tags in the Navigation Pane and create 4 new numeric tags by clicking on the “New Tag” button four times. Rename Tag4 to ‘Status’.

Navigate to the Display Pages category and perform the following actions…

Step 1: Select the Hello World text and press Delete to remove it from the screen.

Step 2: In the Resource Pane, select the Data Tags

Step 3: In the Resource Pane, click on Tag1 and, while holding down Shift + Ctrl, click on Status.

Step 4: All four data tags should be selected.

Step 5: Drag the resulting selection on to your display page.

Step 6: Grab the bottom-right resizing handle and expand the data fields to a suitable size.

Step 7: Click away from the data fields to deselect them.

Step 8: Click on Tag3 and check the Data Entry box in the floating toolbar. Alternatively, right-click and select Data followed by Data Entry.

Your display page should now look like this:

Next right-click on the page and select Properties… Perform the following actions…

Step 1: Select the Actions tab

Step 2: Enter Tag1++ in the On Tick box.

Step 3: Enter Tag2++ in the On Update box.

Step 4: Press OK to save the changes.

Next navigate to the Web Server category and ensure that the defaults, TLS, are enabled and that Remote Control is enabled under the Features tab.

You have now created the test database. Press F9 to download this to your device, and if this is the first time you are doing so, select the Send Time option from the Link menu to set the device’s time and time zone.

Open your web browser. In the address bar, enter https:// followed by the IP address that you have allocated to your device to access the Crimson web server. If you receive a message that the site is unsafe, click advanced options and proceed to view it (the error occurs because a Security Certificate has not been installed at this time).

Within the Crimson web server, select Remote View to view the device’s virtual display and again note the behavior of the tags. You will be able to edit Tag3 by pointing and clicking on it. Tag1 and Tag2 will be incrementing steadily as the display updates. The Status tag will have a value of 0.

3. Getting Connected

Log in to your Ubidots account. Click on your user and select API Credentials. Copy the Default Token to your clipboard. Save it to a file if you wish for future use.

4. Configuring the Ubidots Connector

We are now in a position to configure and test the Ubidots connector. We shall be configuring it to talk a device that will soon be automatically created in the Ubidots Cloud and to push three of the data tags that we have created to it.

The fourth tag will be used to display the connection status. Start by returning to the Communications category and select the Ubidots MQTT settings in the Connectors section.

Perform the following actions:

Step 1: In the Control section, set the Enable Agent property to Yes.

Step 2: In the Operation section, choose the Update Mode (Send Changes is recommended if tag writes will be used), Reconnection and Data Buffering options as required for the application.

Step 3: In the MQTT Server section, check that the Host Name 1 property is set to industrial.api.ubidots.com

NOTE: Only numeric data can be transferred, so flag tags should be converted to integers (1/0) and string tags cannot be transmitted at this time.

Step 4: In the Data Topics section, enter the Device Name you want to assign to the Device to be created in Ubidots. Note it should be all lowercase, use alphanumeric characters, dashes ("-") or underscores ("_").

Step 5: In the Authentication section, paste the Ubidots Access Token that you copied previously.

Step 6: In the Diagnostics section, Drag & Drop the Status tag.

On the Network tab set the Transport Protocol to TLS. Leave other settings at their defaults.

Next, select the Tag Set 1 tab and drag & drop Tag1, Tag2, and Tag3 into the Contents pane.

You have now configured Crimson to push Tag1 through Tag3 to the cloud once per second. Press F9 to download the database to your device.

5. Viewing the Data

Open the webserver page and you should see the following. The Status tag should show a value of 4 indicating a good connection to the Ubidots Cloud.

Clicking on Tag3 will allow you to enter a value on the popup keypad which will be written to the Ubidots Cloud.

Now log into your Ubidots account and click on Devices. You should see that a new device called flexedge has been automatically created (if not refresh your browser screen). Note that Ubidots converts the name to all lowercase but this can be change, just make sure to update the name and not the Device label.

Click on the Device flexedge in Ubidots to view the data values being written to the cloud.

Congratulations you have successfully connected The FlexEdge to Ubidots!

DISCLAIMER: It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system.

Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk.

Red Lion standard product warranty applies.

Red Lion Technical Support: If you have any questions or trouble contact Red Lion Technical Support by clicking here or calling 1-877-432-9908.

For more information: http://www.redlion.net/support/policiesstatements/warrantystatement

Other users also found helpful:

Did this answer your question?