GUIDES

AI for CODESYS: what works today

There are three ways to bring AI into CODESYS, and they differ a lot in how much work they take off your hands. This guide explains each one, what an AI agent connected to the IDE can actually do, and what you need to get started.

← All guides · Updated

Three ways to use AI with CODESYS

Most engineers start by pasting a requirement into a chat window and copying the Structured Text back into the IDE. That works for small snippets, but the AI never sees your project: it cannot know your data types, your I/O mapping or the libraries you use, and every compiler error is another round of copy and paste.

  • Chat assistant: you copy code between a chat window and CODESYS. No setup, but no access to your project either.
  • Code completion: suggestions while you type, such as the ST code completion CODESYS is building into CODESYS 4. Fast for single lines, but it does not plan or build a whole program.
  • AI agent through MCP: the AI client is connected to the CODESYS Development System and works in the real project. It creates objects, writes code, compiles, reads the errors and fixes them, and once you grant it full control it can go online with the controller.

How an MCP connection to CODESYS works

MCP (Model Context Protocol) is an open standard that lets an AI client call tools in another application. An MCP server for CODESYS exposes IDE functions as tools: open a project, create a POU, write code, compile, read the message list. The AI decides which tool to call next; the IDE does the actual work, so everything the AI produces is checked by the real CODESYS compiler.

Several bridges exist today: the official CODESYS Development System MCP Server, open-source projects on GitHub, and Rung Coder. They differ in which parts of the engineering workflow they cover. For a detailed side-by-side, see Rung Coder vs. the official CODESYS MCP Server.

What an AI agent can do in CODESYS with Rung Coder

Rung Coder is a Windows desktop app that connects Codex, Claude Code, Claude Desktop, Cursor and other MCP- or CLI-capable clients to CODESYS. With 278 tools it covers the engineering workflow from an empty project to a verified program on the controller:

  • Program code: POUs, function blocks, methods, DUTs and GVLs in Structured Text, following IEC 61131-3. Ladder Diagram (LD) POUs with real contacts, coils and branches, and edits to single rungs of existing LD code. See Structured Text with AI and Ladder Logic with AI.
  • Visualization (CODESYS SP20 or newer): whole HMI pages from one instruction, with 11 element types, variable bindings, automatic layout and an overlap check before anything is written. See visualization with AI.
  • Motion control: SoftMotion axes, axis groups and 24 kinematic models, single-axis moves, interpolation and electronic cams. See SoftMotion with AI.
  • Devices and communication: device descriptions, I/O mapping, the master or controller side of Modbus TCP/RTU, PROFINET, EtherNet/IP and CANopen, and an OPC UA server.
  • Build and fix: compiles in the real IDE, hands compiler errors back to the AI unchanged and repeats until the build is clean.
  • Online: log in, download, online change, write and force variables, watch lists, 1 ms high-speed sampling and trace, so the result is checked on the running controller.
  • Version control: a baseline of the whole project before the first AI change, checkpoints, branches and tags, object- and line-level diffs, rollback to any checkpoint and optional sync to your own Git server, without installing Git.
  • Testing and analysis: online test cases with a pass or fail per case, profiler and code coverage on the controller, an in-PLC oscilloscope with trigger, PID tuning, and co-simulation with MATLAB/Simulink or a plant model for virtual commissioning. Several CODESYS instances can run side by side.

A typical session

  1. Describe what you need in plain language, for example a conveyor with a soft start, an overload fault that has to be reset and an HMI page.
  2. The AI creates the data types, variables and POUs in your open project and writes the code.
  3. Rung Coder compiles; the AI reads the messages and fixes them until there are 0 errors and 0 warnings.
  4. On request, the AI builds the visualization page and binds it to the variables.
  5. Once you grant full control, it downloads to the controller or simulator, starts it and samples live variables to check the behaviour.
  6. Ask the AI to set a checkpoint of the working state, so you can compare or roll back later.

What you need

Install Rung Coder, sign in, start CODESYS from Rung Coder and paste the generated setup prompt into your AI client. The client configures itself and runs a self-check; restart it once and you are ready, in about 10 minutes the first time. The quick tutorial shows each step.

  • Windows 10 or 11, 64-bit.
  • CODESYS V3.5 SP18 or newer with the CODESYS script engine. SP21 and SP22 are fully verified on real hardware; SP18 to SP20 support the core features.
  • An AI client that supports MCP or a command line, such as Codex, Claude Code, Claude Desktop or Cursor, with an account from its provider. AI usage is billed by that provider; Rung Coder does not include a model.
  • Any controller you program in the official CODESYS V3.5 IDE, plus Inovance InoProShop. An internet connection is needed to sign in.

Limits and safety

A clean build means the syntax and references are correct. Whether the program meets your process requirements and has the right timing is still for you to review and approve. Safety functions such as an emergency stop must not be written with Rung Coder; keep them in the hardware safety chain.

Rung Coder has three permission levels: read only, read and write, and full control. Every online action, from reading live values to downloading, writing and forcing variables, needs full control. In Authorized mode the AI has to ask for it on each project, and nothing runs until you approve in a confirmation dialog. Downloading to or writing on a real controller must also be allowed explicitly. Verify in simulation or on spare equipment first, and do not hand commissioning over to the AI entirely.

Your project stays on your PC. Project files, code and variable values are never sent to Rung Coder servers; Rung Coder itself only exchanges account, licence and update information with them. Project content goes only to the AI provider you choose.

Try it on your own CODESYS project

Rung Coder is free for 2 months from your first sign-in, with no payment method needed. Windows 10/11 and CODESYS V3.5 SP18 or newer.