Visit our Content Hub!
Access free downloadable content curated by our editors.

Generative AI in Packaging and Processing Equipment: Can PLC Programmers Learn Python?

As part of our semi-occasional series on incorporating AI into your packaging and processing equipment, this column focuses on how realistic it is for your engineers to learn Python, a key skill in your generative AI journey.

4 Warehouse Ii

I’ve written several columns about the unique opportunity packaging and processing OEMs have to incorporate artificial intelligence into their machines by focusing on small language models (SLMs). The potential benefits are enormous and far-reaching: operators and technicians at CPGs would be able to communicate with your machine in plain language — and potentially multiple languages. Generative AI built into your equipment, perhaps more than anything else, can help CPG customers mitigate labor shortages and skill gaps with their current workforce.

Small language models, unlike the large language models powering ChatGPT and Google’s Gemini, run locally on a PC, such as the ones you’re likely already embedding in your machines, such as an HMI. Some are even small enough to run on a local Raspberry Pi single-board PC.

And in case you missed it, these AI models will run on a machine without an Internet connection, bypassing arguments with customers about maintaining connections from their factory floor to the cloud.

While Big Automation is certainly working out where generative AI fits into crowded product roadmaps, playing around with SLMs on your own could be incredibly rewarding to those who are able to clench a first-mover advantage. But it will take some effort. It’s a totally different world than the deterministic, locked-down world of industrial machine control. The goal of this series is to walk you through different aspects of incorporating AI into your machines.

Customizing and fine-tuning language models requires knowledge of the Python programming language. For this column, I’m going to focus on the question of how easy is it for someone who knows how to program PLCs to learn Python. (In the sidebar at the end of this article, I cover how to actually find and download actual language models to start experimenting.)

Dave NewcornDave Newcorn, guest author of this column, owing to the flimsy confluence of having dabbled in arcane-and-useless programming languages 40 years ago and having covered the packaging machinery industry for 30+ years. Day job: PMMI Media Group president.If you're familiar with PLC (Programmable Logic Controller) programming, particularly the IEC 61131-3 standardized programming languages (such as Ladder Diagram (LD), Structured Text (ST), Function Block Diagram (FBD), Sequential Function Chart (SFC), and Instruction List (IL)), learning Python can be relatively straightforward. Here’s why:

1. Logic and Control Structures 

PLC programming languages, especially Structured Text (ST), have similarities to traditional c programming languages like Python. ST, for example, has constructs like `IF`, `FOR`, `WHILE`, and `CASE`, which are directly comparable to Python’s control structures (`if`, `for`, `while`, etc.).

Familiarity with logical thinking, control flow, and the concept of variables, loops, and conditionals from PLC programming will translate well to Python.

2. Procedural and Object-Oriented Programming Understanding

If you have experience with Function Block Diagram (FBD) or Structured Text (ST), you’re already accustomed to thinking in terms of functions and modular blocks. Python builds on these concepts with both procedural and object-oriented programming (OOP), making it easier for you to grasp Python's structure and design.