This document explains how to get Crimson® 3.1 to talk to Ubidots using the Generic MQTT Connector. It assumes a basic knowledge of Crimson and its operation, and the ability to read and manipulate JSON. For more details on the Crimson cloud connectors, please consult the Crimson User Manual.
CR3000 HMIs / DA Series Data Stations / Graphite® HMI / Graphite Controllers
Use Case: Ubidots
Transferring tag data to Ubidots.
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.
Build 3106.000 or higher
For testing purposes, an outline database can be created as described in the Crimson Cloud Connectors: Creating an Outline Database Tech Note. The outline database will be referenced when configuring the connector.
Step 1 – Creating an Account
If you do not have an Ubidots account, visit https://ubidots.com/ to create a free trial account. This account should provide more than sufficient capacity for testing.
Step 2 - Creating a Device
Log in to the Ubidots account, click Devices at the top of the page, then click the Add New Device button as shown in Figure 1.
Choose to create a new Blank Device as shown in Figure 2.
Give the device a name, for example, g10ts as shown in Figure 3; then click the green checkmark to create the device.
- What is a Device Name? As the name implies this is the name of the device. You can assign and change the name to a more friendlier one as you see fit.
- What is a Device Label? Also referred to as an API Label, the device label is the single and unique label of your Device that is randomly assigned to your device by Ubidots. Check out our API docs to learn how to send data to Ubidots using the device label.
Click on the user icon in the upper left and select API Credentials as shown in Figure 4, this authentication information for the Ubidots account is required by the Crimson configuration.
Click the copy button next to the Default Token, as shown in Figure 5, this will be required when configuring the Crimson Connector.
Step 3 – Configuring the Generic Connector
We are now in a position to configure and test the generic connector. We shall be configuring it to talk a device that we shall soon create and to push four of the data tags that we have created. The fifth tag will be used to display the connection status. Start by returning to the Communications category and select the Generic MQTT settings in the Connectors section…
Referring to Figure 6, perform the following actions:
- In the Control section, set the Enable Agent property to Yes.
- 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.
- In the MQTT Server section, check that the Host Name 1 property is set to industrial.api.ubidots.com
- In the MQTT Server section, define a Client ID, TSTest in this case.
- In the Data Topics section, set the Publication Topic to /v1.6/devices/g10ts, where g10ts is the name of the device created in Step 2 above.
- In the Data Topics section, set the Subscription Topic to /v1.6/devices/g10ts/+/lv, where g10ts is the name of the device created in Step 2 above. This is used for writes to the Red Lion device.
- In the Presentation section, set Force into Root to Enabled.
- In the Presentation section, set Data Encoding to Numeric Only. 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.
- In the Authentication section, set the User Name to the Default Token copied from the last step of Step 2 above, do not use "Default Token" as shown in Figure 6.
- Leave the Password blank.
- In the Diagnostics section, set the Status property to Status.
Next, select the Tag Set 1 tab.
Referring to Figure 7, perform the following actions:
- In the Control section, set the Tag Writes property to Enabled; assuming writing is required and that a Subscription Topic was configured.
- Select the Data Tags category of the Resource Pane.
- Drag Tag1 through Tag4 into the Contents field in the Editing Pane.
NOTE: If Data Buffering is Enabled, tags that are only being sent to the cloud should be in a SEPARATE tag set that has Tag Writes Disabled. Otherwise, these tags will be overwritten when the reconnect occurs.
NOTE: As of Crimson build 3114, the buffered data timestamps are not formatted properly for Ubidots to use (the generic connector sends a timestamp in seconds, while Ubidots expects milliseconds). The data is transferred, but the timestamps are not honored.
You have now configured Crimson to push Tag1 through Tag4 to the cloud once per second. Press F9 to download the database to your device.
Step 4 - Viewing the Data
Click on the Device in Ubidots to view the data values being written to the cloud, as shown in Figure 8.
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/policies-statements/warranty-statement