pkey
.Net

How to Integrate PLC with .NET in a Production Line

Introduction

How to Integrate PLC with .NET in a Production Line

Introduction

Integrating PLC systems with .NET is a common requirement in modern production lines. It allows you to collect real-time data, monitor machines, and connect industrial processes with business systems such as MES or ERP.

In most architectures, .NET acts as an integration layer between PLCs and higher-level applications. This approach enables flexible data processing, scalability, and easier integration with cloud or enterprise systems.


How it works

A typical setup looks like this:

PLC → OPC → Application Data Flow

sequenceDiagram
    participant PLC
    participant OPC
    participant App
    participant DB

    PLC->>OPC: Send telemetry
    OPC->>App: Publish data
    App->>App: Process logic
    App->>DB: Save results

A typical setup uses OPC UA as a communication protocol. The PLC sends telemetry data (e.g., temperature, speed, pressure) to an OPC server. The .NET application connects to this server, reads values, and processes them according to business logic.

The processed data can then be stored in a database, visualized in dashboards, or forwarded to other systems like MES, ERP, or cloud services.


Simple C# Example (OPC UA)

Install package:

BAT (Batchfile)
dotnet add package OPCFoundation.NetStandard.Opc.Ua

Code:

C#
using Opc.Ua;
using Opc.Ua.Client;
using Opc.Ua.Configuration;

public async Task ReadPlcValue()
{
    var config = new ApplicationConfiguration
    {
        ApplicationName = "SimpleClient",
        ApplicationType = ApplicationType.Client,
        SecurityConfiguration = new SecurityConfiguration
        {
            AutoAcceptUntrustedCertificates = true
        },
        ClientConfiguration = new ClientConfiguration()
    };

    await config.Validate(ApplicationType.Client);

    var endpoint = CoreClientUtils.SelectEndpoint("opc.tcp://localhost:4840", false);
    var session = await Session.Create(
        config,
        new ConfiguredEndpoint(null, endpoint, EndpointConfiguration.Create(config)),
        false,
        "session",
        60000,
        null,
        null);

    var value = session.ReadValue("ns=2;s=Temperature");

    Console.WriteLine($"Temperature: {value.Value}");
}

When to use this approach

Use .NET with OPC UA when:

  • you need real-time production data access
  • you integrate PLC systems with MES or ERP
  • you build monitoring dashboards or analytics tools
  • you want a scalable integration layer between OT and IT

Conclusion

How to Integrate PLC with .NET. Using .NET as an integration layer for PLC systems is a simple and scalable way to connect production environments with modern software platforms. It allows you to decouple low-level machine communication from business logic and build robust, maintainable systems.

Even a small setup like the example above can evolve into a full industrial platform with messaging (e.g., RabbitMQ), microservices, and cloud integration.

References

https://en.wikipedia.org/wiki/Open_Platform_Communications

More Info

We implement this in real production systems.
If you need help → contact us

Contact