Abstract:
This document explains how to get Crimson 3.1 to talk to Mosquitto using the Generic MQTT Connector. For more details on the Crimson Cloud Connectors, please consult the Crimson User Manual.
Products:
CR3000 HMIs / Data Acquisition (DA10 & DA30) / FlexEdge™ (DA50D & DA70D) / Graphite® HMI / Graphite® Controllers
Use Case: Mosquitto MQTT
Transferring tag data to Mosquitto.
Required Software:
Crimson 3.1
Required Firmware:
Build 3106.000 or higher
Optional:
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.
Configuring the Generic Connector in Crimson
Referring to Figure 1, perform the following:
1. Navigate to the Communications section and click on Generic MQTT under Connectors.
2. Click on the Service tab.
3. Set Enable Agent to Yes.
4. Set the Host Name 1 to the IP address of the PC running Mosquitto, 172.16.4.166 in this example.
5. Set the Subscription Topic to "device", this will be used later in the section.
6. Set Force into Root to Enabled.
7. Delete the User Name and Password.
8. Leave all other settings at default.
Figure 1.
Referring to Figure 2, perform the following:
9. Click on the Network tab.
10. Leave all other settings at default.
Figure 2.
Configure the Device Data and Tag Set tabs as required for the application. Figure 3 shows Tag Set 1 configured to send the values of Tag1-Tag4 to Mosquitto, as well as allowing writes.
Figure 3.
Using Mosquitto
Install Mosquitto
Download and install Mosquitto from http://mosquitto.org/download/
Running Mosquitto
1. Start the broker, referring to Figure 4, open a command prompt and make sure you run as administrator.
Note: You absolutely need to make sure you run CMD as administrator and make sure you don’t have more than one instance of CMD open.
Figure 4.
2. Navigate to the Mosquitto root folder, such as C:\Program Files (x86)\mosquito by doing CD C:\Program Files (x86)\mosquitto
3. Start the Mosquitto service by running the command: net start mosquitto, refer to Figure 5.
Figure 5.
You should get the message The Mosquitto Broker service was started successfully.
Monitoring Values
1. Once Mosquitto is started, type mosquitto_sub.exe -t #.
2. Press the Enter key.
3. Referring to Figure 6, the data will start streaming into the command prompt window.
Figure 6.
* pressing Ctrl + c will stop the service.
Writing Values
1. Referring to Figure 7, type: mosquitto_pub -t device -m "{\"Tag1\":12345,\"Tag2\":54321}"
* "device" needs to match the subscription topic configured in Crimson.
* inside of the "{...}" is the message that will be published by mosquitto, in this example, it will set Tag1 to 12345 and Tag2 to 54321.
2. Press the Enter key.
Figure 7.
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/policies-statements/warranty-statement