PLC and sensor programming: how data gets from the machine to the people who decide

Every report about a plant starts with a signal: a pulse from an encoder, a temperature from a probe, a status bit from a drive. If that signal is read badly, delayed or lost on the way, every system above it, from the MES to the AI model to the monthly report, works with wrong numbers.
At Timeus Lab we write the code for sensors and controllers and connect it to the systems that run the company. This article explains how that layer is built, which standards matter, and what to ask from whoever does this work for you.
What does sensor and controller programming include?
Sensor and controller programming is the code that reads signals from field devices, makes decisions on the machine in real time, drives actuators, and passes clean data to the systems above. It covers PLC programs, configuration of sensors and drives, operator panels (HMI), industrial networks and the gateways that send data to SCADA, MES, ERP or the cloud.
In a typical plant the path looks like this:
- Field level. Sensors, valves, motors, drives, cameras.
- Control level. PLCs and embedded controllers that run the machine logic in milliseconds.
- Supervisory level. HMI and SCADA for operators.
- Operations level. MES, quality and maintenance systems.
- Business level. ERP, CRM and reporting.
We work on every step of that path, so the meaning of a signal does not get lost between teams.
Which PLC languages and platforms are used?
Most industrial controllers are programmed in the languages defined by the IEC 61131-3 standard. The ones in daily use are:
- Ladder diagram (LD), close to relay logic and easy for electricians to read;
- Function block diagram (FBD), good for signal processing and control loops;
- Structured text (ST), a text language for calculations, data handling and complex logic;
- Sequential function chart (SFC), for step-by-step machine sequences.
The platform depends on the equipment: Siemens TIA Portal, Rockwell Studio 5000, CODESYS-based controllers and others. For custom devices and edge gateways we also write embedded code in C and C++ and services in higher-level languages. The right choice is the one your maintenance team can support, not the one the programmer likes best.
Which industrial protocols matter?
Industrial protocols decide how devices talk to each other and to IT systems. The ones we meet most often:
| Protocol | Typical use |
|---|---|
| Modbus RTU and Modbus TCP | Simple, widespread, common on meters, drives and older equipment |
| PROFINET and PROFIBUS | Siemens-centred plants, fast cyclic data between PLC and devices |
| EtherNet/IP | Rockwell-centred plants |
| IO-Link | Smart sensors with parameters and diagnostics over one cable |
| OPC UA | Vendor-neutral data exchange between machines, SCADA and IT systems, with built-in security |
| MQTT | Lightweight publish and subscribe messaging from gateways to servers and the cloud |
A mixed plant usually has several of these at once. Part of the job is translating between them without losing timestamps, units or quality flags.
How do you connect the shop floor to ERP and MES?
The shop floor is connected to business systems through a data layer that collects values from controllers, gives them clear names and units, and delivers them to the systems that need them. Usually this is an OPC UA server or an edge gateway that reads PLCs and publishes data over MQTT or an API.
A few rules make this layer reliable:
- One name for one thing. A tag called
M3_T_OILin the PLC becomes "Press 3, oil temperature, °C" everywhere above. - Buffer when the network drops. Data is stored at the edge and sent later, so reports do not show gaps.
- Send events, not only values. "Batch 2231 started", "Alarm acknowledged" are more useful to an ERP than a stream of numbers.
- Write back carefully. When a business system sends recipes or orders down to machines, every write is checked and logged.
Clean data at this level is also what makes AI in production possible. Models trained on unlabelled raw tags rarely make it past the pilot.
How do you keep industrial systems secure?
Industrial systems are kept secure by separating networks, limiting who can change what, and keeping a record of every change. The IEC 62443 family of standards is the common reference for this. In practice it comes down to:
- separating the control network from the office network, with controlled points of exchange;
- no direct internet access to PLCs, and remote access only through secured, logged channels;
- version control and backups of every PLC and HMI program;
- role-based access, so a change to a recipe is not a change to safety logic;
- protocols with authentication and encryption, such as OPC UA with security enabled, where the equipment supports it.
Safety functions such as emergency stops and guard interlocks stay on certified safety controllers and are never moved into ordinary application code.
How is a controller project run?
A controller project is run so that the line keeps producing while the code changes. Our usual steps:
- Survey of the equipment, wiring, existing programs and documentation, together with your maintenance team.
- Functional description of what the machine or line must do, agreed before coding.
- Development and testing on a simulator or a test bench, not on the running line.
- Commissioning in planned windows, with a way back to the previous program.
- Documentation and handover, so your own people can maintain the code.
Questions
Can you work with old controllers and machines?
Yes. Older controllers can often be read through gateways or protocol converters, and machines without any interface can be fitted with external sensors. Sometimes replacing an obsolete controller is the cheaper option in the long run, and we explain the trade-off before you decide.
Do you supply hardware or only write code?
Both. We can select and supply sensors, controllers, gateways and servers, or work with equipment you already have.
Can our maintenance team change the code later?
They should be able to. We write in standard languages, comment the logic in the project documentation, keep programs under version control and hand over everything at the end.
Where do you work?
Timeus Lab is headquartered in Spain and works on sites in any country, with our own team of about 30 specialists and trusted local contractors where a project needs people on site.