Introduction and Setup Overview
This technical guide details the communication setup between PLCnext and Allen Bradley Compactlogix controllers using Node-RED. The initial step involves installing Node-RED on the PLCnext platform, for which a dedicated guide is available, outlining all necessary installation procedures.
Diagram Description: A visual representation shows a PLCnext controller and an Allen Bradley Compactlogix controller connected. A central icon labeled "Node-RED" facilitates the communication between them.
Key Components:
- [PLCnext Control]
- [PLCnext Engineer]
- [PLCnext Store]
- [PLCnext Community]
Configuring Rockwell Logix5000 Controllers
The Rockwell CPU model used for testing in this guide is the L24ER, which features onboard 16 Digital Inputs (DI) and 16 Digital Outputs (DO). Consequently, native local variables are already available, as detailed in the table below. Additional variables of various types will be created to enhance the testing process.
Name | Value | Force Mask | Style | Data Type |
---|---|---|---|---|
+Local:1:C | {...} | {...} | AB:Embedded_Discretel01:C:0 | |
Local:1:1 | {...} | {...} | AB:Embedded_Discretel01:1:0 | |
+Local:1:1.Fault | 2#0000_0000_0000_0000... | Binary | DINT | |
+Local:1:1.Data (Native Digital Inputs) | 2#0000_0000_0000_0000 | Binary | INT | |
+Local:1:1.Readback | 2#0000_0000_0000_0000 | Binary | INT | |
Local:1:0 | {...} | {...} | AB:Embedded_Discretel01:0:0 | |
+Local:1:0.Data (Native Digital Outputs) | 2#0000_0000_0000_0000 | Binary | INT | |
Tag_0_IN (Variable of type BOOL) | 0 | Decimal | BOOL | |
Tag_0_OUT (Variable of type BOOL) | 0 | Decimal | BOOL | |
+Data_IN (Variable of type DINT) | 0 | Decimal | DINT | |
+Data_OUT (Variable of type DINT) | 0 | Decimal | DINT | |
+ arr_IN (Array of 10 positions INT) | {...} | {...} | Decimal | INT[10] |
+ arr_OUT (Array of 10 positions INT) | {...} | {...} | Decimal | INT[10] |
Installing Node-RED Nodes for Communication
Dedicated nodes are available within Node-RED to facilitate communication with Rockwell controllers. The subsequent step involves installing these nodes.
Screenshot Description: The Node-RED interface is shown, with the palette displaying search results for "ethernet-ip". The node node-red-contrib-cip-ethernet-ip
is listed and marked as "installed". The command line instruction npm install node-red-contrib-cip-ethernet-ip
is visible. Two relevant nodes, eth-ip in
and eth-ip out
, are presented in the palette.
Configuring the `eth-ip in` Node for Variable Reading
The eth-ip in
node is configured to read variables from the PLC. This involves specifying the PLC's IP address, the slot number, and the tags to be read.
Configuration Window: The configuration panel for the eth-ip in
node is displayed. Key settings include:
- PLC: An endpoint for the PLC connection, typically configured with the IP address.
- IP Address: Set to
192.168.1.150
. - Mode: Options include "Single tag", "All tags, one per message", and "All tags".
- Scope: Determines how tags are read.
- Tag: Allows selection of specific tags.
- Slot: For Compactlogix controllers, this is typically
0
. For Contrologix, it depends on the physical rack configuration.
Tag Selection: The node allows reading native PLC tags (e.g., digital inputs/outputs, DINT, INT arrays) and custom-defined variables. Examples shown include Data_IN
, Data_OUT
, and array elements like arr_IN[0]
.
Reading Options Explained:
- Single Tag: Reads one specific variable. The variable must be explicitly indicated.
- All tags, one per message: Reads all selected tags, sending each in a separate message.
- All tags: Reads all selected tags, consolidating their values into a single message.
Debug Output: When the eth-ip in
node is configured to read "All tags", the debug pane displays the payload object containing the current values of the read variables. For example: Local:1:I.Data.0: false
, Local:1:0.Data.0: true
, Data_IN: 111
, Data_OUT: 444
, arr_IN[0]: 123
, arr_OUT[0]: 0
.
Configuring Boolean Inject for Writing to PLC Output
This section details the configuration for writing boolean values to a digital output of the PLC using Node-RED. This is achieved using "Inject" nodes.
Node-RED Flow: A Node-RED flow is depicted where two "Inject" nodes are used. One is configured to send a true
value, and the other a false
value. Both are connected to the PLC's digital output, specifically Local:1:0.Data.0
.
Operation: By deploying these inject nodes, a boolean true
or false
can be sent to the PLC's digital output. The debug pane shows the results of these operations, including updated variable values such as Data_OUT: 444
and arr_OUT[0]: 987
after a write operation.
Conclusion
Thank you for following this guide.