PLCnext and S7-1200 Communication via Node-Red
This technical guide from PHOENIX CONTACT details the setup and configuration for establishing communication between PLCnext controllers and Siemens S7-1200 PLCs using Node-Red.
PLCnext Technology Introduction
PLCnext Technology offers flexible automation. This guide focuses on integrating PLCnext with Siemens S7-1200 PLCs using Node-Red for industrial IoT applications.
The document illustrates the connection between a PLCnext controller and a Siemens S7-1200 PLC via Node-Red.
Key PLCnext tools are accessible via a sidebar: [PLC Control], [PLC Engineer], [PLC Store], [PLC Community].
PLCnext Controller Setup
The first step is to install Node-Red on the PLCnext controller. A dedicated guide covers this installation process.
Siemens S7-1200 Configuration in Tia Portal
To enable communication, the PUT/GET option must be activated in the Siemens S7-1200 PLC's configuration within the Tia Portal software.
The 'Protection & Security' settings in Tia Portal require enabling the 'Permit access with PUT/GET communication from remote partner' option.
Logic Implementation in Tia Portal
Simple logic involving timers and counters was created for this guide:
- Network 1: Blink Blink: Utilizes a TON timer to create a blinking output.
- Network 2: Counter: Employs a CTU counter and a TON timer for a counting sequence.
Node-Red Configuration and Setup
Dedicated nodes are available for communication with Siemens S7 controllers. The 'node-red-contrib-s7' package is required and can be installed via npm: npm install node-red-contrib-s7
.
Configuring the 's7 in' Node
The 's7 in' node is configured to read variables from the PLC. Key settings include:
- PLC Selection: Specify the PLC, e.g., S7_1200.
- Read Mode: Options include reading a single variable, all variables per message, all variables in one message, or only when values change.
- Variable Mapping: PLC addresses (e.g., %M1.0, %M1.1, %MW2) are mapped to descriptive names (e.g., LIGA_DESLIGA, LED, CONTADOR).
Configuring the 's7 out' Node
The 's7 out' node is used for writing data to PLC variables. Configuration involves selecting the PLC and the target variable, such as 'LIGA_DESLIGA'.
Configuring 'Inject' Nodes
Boolean 'inject' nodes are set up to send 'true' or 'false' values to the 'LIGA_DESLIGA' variable, controlling PLC outputs.
Application Example Flow
The example demonstrates using the 's7 out' node to write boolean values to the LIGA_DESLIGA variable and the 's7 in' node to read LED and CONTADOR variables from the Siemens PLC.
The Node-Red flow visually represents this interaction, with 'inject' nodes controlling the 's7 out' node and the 's7 in' node reading data. The debug pane logs the variable states, showing the communication in action.