The great combination of Node-RED and Codesys tools provides an effective and straightforward way to connect your PFC200 to Ubidots, guided by a simple step-by-step process.
Requirements
An active Ubidots account.
1. WAGO PFC200 Controller
WAGO's PFC200 Controller is an industrial grade PLC that facilitates the control and visualization of your projects thanks to the real-time-capable Linux operating system and Codesys. Its unrivalled flexibility unlocks a lot of configuration options for digital and analog I/O modules, alongside specialty modules boasting distinct potentials, powers, and signals—all within a single, consolidated device.
2. Codesys setup
Codesys is the leading manufacturer-independent IEC 61131-3 automation software for engineering control systems that helps you for creation of professional visualization screens directly in your PLC programming environment CODESYS Development System.
Please refer to the third section of the article "Connect a WAGO PFC200 to Ubidots using Codesys" to learn how to download Codesys and complete its initial configuration. Once you have downloaded the software and created your device following that guide, you can continue with this step by step.
In your current application, right-click on it, then select "Add Object" and finally click on "Network Variable List (Sender)".
Right-click on the created Network Variable List (NVL) and open the properties.
In the Properties module, open the Network Variables tab and fill the following fields:
Network type: UDP.
Task: MainTask.
Enable Pack variables checkbox.
Enable Cyclictransmission checkbox. In the Interval field, you will set the time of data transmission you need from Codesys to Node-RED.
After saving the recent changes, open again the created NVL. In the code section, you can set all the necessary variables you need to send to Node-RED and, ultimately, to Ubidots. These variables should be pre-configured in your Codesys application based on your PLC readings.
3. Node-RED setup
Node-RED is a programming tool for wiring together hardware devices, API's and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.
Once Node-RED is running on your computer, head to the top-right menu and then click on the "Manage pallets" option.
Go to the 'Install' tab, run a search for "ubidots" and install the node called "ubidots-nodered".
In the same window, you need to install another node called "node-red-contrib-nvl".
In the left-side node panel, please navigate to the Network section and add the udp-in module to your application.
Edit the udp-in module and fill the following information:
In the left-side node panel, please navigate to the Parser section and add the NVL-receive module to your application.
Edit the NVL-receive module and fill the following information:
Next, connect the output of the NVL-receive module to an MQTT connection to Ubidots. In this guide, we will use the Ubidots MQTT module you have installed in Node-RED. However, if you prefer to use the Node-RED native MQTT module, please refer to the third section of the article "Connect Node-RED to Ubidots".
This is the complete information:
Account type: select Ubidots for a license account or Ubidots for education, if you have a STEM account.
Token: your account's token.
Device label: the label of the device you want to create in Ubidots.
All the simple connection will look like this:
4. Ubidots visualization
After completing the entire process, a device labeled "pfc200" will be created in your Ubidots account. Following the example, you will have a variable called "temperature1" in this device.