Connect to Siemens S7-1200

The Siemens S7-1200 PLC is programmed via Siemens’ TIA Portal (Totally Integrated Automation Portal) software. Once you’ve installed the TIA Portal, you can design, test, troubleshoot, and maintain your automation project in a single software suite, with a standardized and intuitive navigation system to configure and program your S7-1200 PLC, as well as other Siemens automation devices.

This section introduces how to leverage Nuron OPC UA plugin to connect S7-1200.

Username/Password Login

  1. Select the target PLC in the TIA V16 programming software, right-click and open the Properties -> General -> OPC UA.

  2. Open the Activate OPC UA Server option. s71200-1_en

  3. Check the required security policy in the Security policies available on the server list. If the security requirement is not particularly high, you can just check No security, so that the speed of reading and writing requests will be faster.

  4. Check Automatically accept client certificates during runtime in the Trusted client section.

  5. Turn off Enable guest authentication in the Guest authentication section.

  6. Check the Enable username and password authentication box in the Username and password authentication section.

  7. Adding a user name and password to the User Management list.

  8. Downloading programs to the PLC.

Add Program Blocks

  1. Select the target PLC in the TIA V16 programming software, open Program blocks -> Add New block, add a Global DB block named OPC UA Block, add a data point for each type in the OPC UA Block, set the Name to the same type as the Data Type.

  2. Check the Accessible from HMI/OPC UA/Web API and Writable from HMI/OPC UA/Web API options for all data points. s71200-2

  3. Download programe to PLC.

Add Server Interfaces

  1. Select the target PLC in the TIA V16 programming software, open OPC UA communication -> Server interfaces -> Add new server Interface, add the interface named ServerInterfaces_1, drag the OPC UA Block in the OPC UA elements -> Project data -> Program block on the right to the OPC UA server interface -> Browse name -> under ServerInterfaces_1. s71200-3

  2. Download programe to PLC.

Configure Neuron

  1. Get the PLC measurement point information via the UaExpert software, refer to UaExpert. s71200-4

  2. Neuron adds a new southbound OPC UA device, open Device Configuration, fill in the Endpoint URL of the target PLC, user name/password, no need to add certificate/key.

  3. Add Groups and Tags based on the measurement point information.

    TIP

    The NODEID of the Siemens S7-1200 is in digital form and the address of the Neuron needs to be set according to the actual value.

    The data type mapping relation is as follows:

    PLC Data TypeOPC UA Data TypeNeuron Data Type
    AOM_IDENTUInt32UINT32
    BoolBooleanBOOL
    ByteByteUINT8
    CONN_ANYUInt16UINT16
    CONN_OUCUInt16UINT16
    CONN_PRGUInt16UINT16
    CharByteUINT8
    DB_ANYUInt16UINT16
    DB_DYNUInt16UINT16
    DB_WWWUInt16UINT16
    DWordUInt32UINT32
    DateUInt16UINT16
    DIntInt32INT32
    EVENT_ANYUInt32UINT32
    EVENT_ATTUInt32UINT32
    EVENT_HWINTUInt32UINT32
    HW_ANYUInt16UINT16
    HW_DEVICEUInt16UINT16
    HW_DPSLAVEUInt16UINT16
    HW_HSCUInt16UINT16
    HW_IEPORTUInt16UINT16
    HW_INTERFACEUInt16UINT16
    HW_IOUInt16UINT16
    HW_IOSYSTEMUInt16UINT16
    HW_PWMUInt16UINT16
    HW_SUBMODULEUInt16UINT16
    IntInt16INT16
    LRealDoubleDOUBLE
    OB_ANYInt16INT16
    OB_ATTInt16INT16
    OB_CYCLICInt16INT16
    OB_DELAYInt16INT16
    OB_DIAGInt16INT16
    OB_HWINTInt16INT16
    OB_PCYCLEInt16INT16
    OB_STARTUPInt16INT16
    OB_TIMEERRORInt16INT16
    OB_TODInt16INT16
    PIPUInt16UINT16
    PORTUInt16UINT16
    RTMUInt16UINT16
    RealFloatFLOAT
    SIntSByteINT8
    StringStringSTRING
    TimeInt32INT32
    TimeOfDayUInt32UINT32
    UDIntUInt32UINT32
    UIntUInt16UINT16
    USIntByteUINT8
    WCharUInt16UINT16
    WStringStringSTRING
    WordUInt16UINT16

Test Data List 1

NameAddressAttributeDate type
DeviceManual3!DeviceManualReadSTRING
DeviceRevision3!DeviceRevisionReadSTRING
EngineeringRevision3!EngineeringRevisionReadSTRING
HardwareRevision3!HardwareRevisionReadSTRING
OperatingMode3!OperatingModeReadINT32
OrderNumber3!OrderNumberReadSTRING
RevisionCounter3!RevisionCounterReadINT32
SerialNumber3!SerialNumberReadSTRING
SoftwareRevision3!SoftwareRevisionReadSTRING

Test Data List 2

NameAddressAttributeData type
SInt4!12Read WriteINT8
Int4!9Read WriteINT16
DInt4!6Read WriteINT32
Byte4!4Read WriteUINT8
UInt4!17Read WriteUINT16
UDInt4!16Read WriteUINT32
Real4!11Read WriteFLOAT
LReal4!10Read WriteDOUBLE
Bool4!3Read WriteBOOL
String4!13Read WriteSTRING