A Quick Step By Step Tutorial To Connect Your Orion Node-Red Gateway Device To The Orion Cloud Platform
We will assume you have Subscribed to an Orion Plan, including the Free Forever Plan, and you have received your unique Orion Device Serial Number and Claim Code. We will also assume you have chosen a Raspberry Pi device as your hardware platform and you are familiar with Raspbian Linux OS command line.
See Orion Dashboard Live Demo here
Step 1. Install Node-Red on Your Device
Please follow the official Node-Red instructions here
Complete to the AutoStart on Boot Section. You should have the following output on completion.
On reboot you should now be able to navigate to your rpi device ip address in your browser such as 192.168.xxx.3:1880 as follows ..
Step 2. Install Eclipse Mosquitto – Open Source MQTT Broker
At the command line simply type –
pi@raspberry:~ $ sudo apt update pi@raspberry:~ $ sudo apt install -y mosquitto mosquitto-clients
and then to start Mosquitto on Boot up ..
pi@raspberry:~ $ sudo systemctl enable mosquitto.service
and to test Mosquitto is running ..
pi@raspberry:~ $ mosquitto -v
and you should get the following ..
Step 3. Adding your Device to Orion
Login to your Orion account and navigate to Devices and click + Add Device Button as follows ..
where Pin Code is your unique device Claim Code ..
Step 4. Adding a Field Datapoint in Orion
Scroll down to the Add Field Button and enter your unique Field datapoint parameters as follows ..
CPUT2 is reading the temperature of the rpi CPU as follows ..
and then navigate to the API section and take note of your API Token. You will need this for each MQTT datapoint in your Node-RED Flows.
Step 5. Take Note of Orion MQTT Publish Topics and API Security Token
Click the MQTT Configure Button and you will see the two topics to use in Node-Red to ‘Publish’ to Orion for each datapoint. Copy them for further use later in Node-RED.
You will also need to copy your Orion API security token, so navigate to the top left hand corner and click on your workspace details, Edit Profile as follows ..
Then into API and copy your token to a safe place ..
Step 6. Node-RED MQTT to Orion Configuration
The following Node-RED flow will illustrate the MQTT setup to communicate to your Orion field datapoints using CPUT2 as an example ..
You can download and unzip the following Node-Red flow and import to your Node-Red platform to better follow these instructions – Click here
Next, Double click on the cput2 MQTT Out node to edit the node Topic to your Orion device settings as follows ..
Topic = dtck-pub/YOUR DEVICE/YOUR – DEVICE-UNIQUE-SERIAL-NUMBER /CPUT2
Next, click on the Server edit button (pencil icon) and the input the Orion Server Connection details as follows ..
Server = orion.ionware.io.mqtt-server.com and Port = 1883 .. see as follows ..
Next, click on the Security tab and input your Orion API Token into both fields ..
Username = YOUR ORION API TOKEN HERE and Password = YOUR ORION API TOKEN HERE as follows ..
Then Update, Done and Deploy the Flow.
Repeat for the other MQTT Output Nodes in Node-RED and for your Orion Device Fields.
Step 7. Check Datapoint Values are received in Orion
In Devices chose the Dashboard Tab add a Value Widget as follows ..
We would advise rebooting your rpi device and then activating the Inject Timestamp node for each datapoint to send values to Orion.
And that is all there is to it.
You will find the Orion Platform very intuitive and easy to use with excellent reliability and security.
Enjoy and have fun!