Skip to Content
All case studies

Case study · Food packaging · ESP32 PLC

An old packaging line. New data at four levels.

A retrofit with the ESP32 PLC: OEE, energy and product data from a line that gave none.

4data levels: production, line, phase or machine, and product
OEEindicators from specific sensors wired to the PLC
BIplatform fed in real time through the central system
Phase 1of the retrofit: the digitalization of the line

The line still packed food. Its old control could not say how well.

The retrofit added industrial controllers, and stops, energy and products now leave a record.

This case study describes the retrofit of a food packaging line that was becoming obsolete. The owner company and the company that carried out the retrofit agreed on the improvements together. The goals, the four data levels and the results come from the case. The case does not publish the companies, the country, the speeds of the line or any figure. The phases, products and values in the panels are examples.

The challenge

A line that worked, but could not grow or talk.

The goal of the project was to improve the efficiency of the machine and to give it more flexibility for production needs that change all the time. The old control system stood in the way.

01

Little power, little memory

The old control system had limited processing capacity and memory. New functions could not be added to it.

02

Not connected

The line had no network link and could not be integrated with other industrial systems. Collecting data and making informed decisions was hard.

03

No line figures

Energy consumption, running, stop and changeover times, yields per shift and the incidents of each product were not available.

04

Each product changes the line

Packing one product or another can alter how the line behaves, with more stops or breakdowns. The size of the product or pack and the marking system (label, ink or laser) play a part.

First phase: digitalization

The two companies set four goals for the first phase: data on production, data at line level, data at phase or machine level within the line, and data at product level.

How it works

Three jobs: time the line, find the weak spot, plan the next batch.

Each panel shows one job of the system. Press the buttons. The panels are illustrative simulations: the data levels and the questions are the ones of the case. The phases, the products, the rates, the times and the kWh are examples.

Job 1 · Production data

Time the line to get its OEE.

To set OEE indicators on the line, the case needed a set of key data. Specific sensors connected to the PLC now collect it. A typical way to turn those signals into OEE: count good and rejected packs, and log each stop and each product changeover with its start and end. Add stops, add a changeover or slow the line, and watch the OEE of the shift.

  • Run, stop and changeover times
  • Good and rejected packs
  • OEE by shift, from the PLC data
Shift, 480 min (example)0480OEE0■ RUN ■ STOP ■ CHANGEOVER
Availability0
Performance0
Quality0
OEE0
Run time0
Good packs0
RUNSTOPCHANGEOVER

Line events (example)

    Illustrative simulation. Example values, not data from the case. Example shift of 480 minutes, ideal rate of 100 packs per minute and 98% good packs. OEE = availability × performance × quality.

    Try a full monitored packaging line in the Machine Monitor simulator

    Job 2 · Line, phase and product

    Which product, in which phase, stops the line?

    One product can make the line stop more often than another. With sensors by phase or machine, the case can now see which combination of product, pack and phase runs best and which one has more incidents. The line level data adds the energy consumption. Pick a product, or compare all of them.

    • Stops by phase or machine
    • Energy of the line by product
    • The weak combination, found in the data
    FormingFillingSealingMarking
    Stops per 1,000 packs0
    kWh per 1,000 packs0
    Line speed (packs/min)0
    Weak spot0

    Analysis (example)

      Illustrative simulation. Example values, not data from the case. The phases, the products and every number are examples. The case says that sensors by phase or machine show which combination of product, pack and phase runs best or has more incidents.

      Job 3 · Real time and planning

      From the PLC to BI, and back to the plan.

      Most of the data is now digital and available in real time. It goes to the central system and into a BI (Business Intelligence) platform. With a view product by product, the team can anticipate much more precisely how long a batch will take. Choose a product and a batch size.

      • Real-time data to the central system
      • BI view of lines, products and incidents
      • Batch times from measured rates
      ESP32 PLCNode-REDCentral systemBI platform

      Product

      Batch size

      Measured rate (packs/min)0
      Changeover0
      Time for the batch0
      End time (start 06:00)0

      Records to the central system (example)

        Illustrative simulation. Example values, not data from the case. Rates and changeover times are examples, as if measured by the PLC on earlier batches. The case says that the product by product view lets the team anticipate the packing time of a batch much more precisely.

        System architecture

        How do you retrofit a packaging line for data?

        Keep the line and add industrial controllers. In this case the ESP32 PLC works with sensors, actuators and control devices of the line. It reads specific sensors for production data and sensors by phase or machine. Node-RED links the data with the customer's systems, and the central system feeds a BI platform in real time. The case does not publish the sensors, the energy meter, the network link or where Node-RED runs.

        Food packaging linePhase 1sensorsPhase 2sensorsPhase 3sensorsPhase 4sensorsPack countgood and rejectedLine staterun, stop, changeoverEnergymeter not publishedActuatorsand control devicesProduction · Line · Phase · ProductESP32 PLCsensors, actuators, datalinknot publishedNode-REDintegrationCentral systemcustomer systemsBI platformreal timeLayout from the case. The sensors, the meter and the links are not published; the signal types are a typical way.Phase 1 · 2 · 3 · 4sensorsPack countgood and rejectedLine staterun, stop, changeoverEnergymeter not publishedActuatorsand control devicesESP32 PLCsensors, actuators, datalink not publishedNode-REDintegrationCentral systemcustomer systemsBI platformreal timeLayout from the case. The sensors, themeter and the links are not published;the signal types are a typical way.
        ESP32 PLC and field signalsData to other systemsEnergyControl of the line
        Signals and data
        SignalBetweenTypePurpose
        Pack countBetweenLine sensors → ESP32 PLCTypeDigital inputs (typical)PurposeGood and rejected packs for OEE
        Line stateBetweenLine and machines → ESP32 PLCTypeDigital inputs (typical)PurposeRunning, stop and changeover times
        Phase or machine sensorsBetweenEach phase → ESP32 PLCTypeSensor signals (not published)PurposeStops and incidents by phase
        Energy consumptionBetweenLine, machine or phase → ESP32 PLCTypeMeter (type not published)PurposeEnergy cost by line, machine or phase
        Product and shiftBetweenProduction order → data recordTypeData (source not published)PurposeYields by shift and incidents by product
        Actuators and control devicesBetweenESP32 PLC ↔ lineTypeOutputs and devices (not detailed)PurposeControl of the line
        Line dataBetweenESP32 PLC → Node-REDTypeNetwork link (not published)PurposeIntegration with other systems
        Real-time dataBetweenCentral system → BI platformTypeData (format not published)PurposeLines, products, speeds, deviations, incidents, breakdowns and stops

        Why it works

        Data at the source, and a controller that can grow with the line.

        Sensors where the losses happen

        The case added specific sensors on the PLC for production data and sensors by phase or machine. That is what shows which product and which phase cause the stops.

        Open tools for integration

        The case says that a PLC based on open source made integration with other systems easy. Node-RED and the Arduino IDE provided that ease of integration.

        Room to grow

        The project chose a modular solution, so the specifications can be expanded later. The ESP32 PLC family goes from 14 to 58 I/O and connects expansion modules over I2C.

        Real time and history

        Production managers see the process in real time and can act at once. The same data feeds the BI platform for OEE targets and improvement actions.

        Support along the project

        Our team was available before, during and after the installation, by phone, email or WhatsApp.

        Hardware

        The controller of the retrofit.

        ESP32 PLC 21 FLEX, industrial controller based on ESP32 for DIN rail

        ESP32 PLC

        Industrial controllers built on the dual core ESP32, for your DIN rail. On this line the ESP32 PLC works with the sensors, actuators and control devices, and shares the data with the customer's systems.

        Role in this case
        Reads the line and its phases, works with actuators and control devices, shares the data
        Processor
        ESP32 dual core, up to 240 MHz
        Network
        Ethernet 10/100, Wi-Fi 2.4 GHz, Bluetooth LE
        Serial and buses
        RS-485, RS-232, I2C, SPI
        Programming
        C++ with the Arduino IDE
        Family
        ESP32 PLC 14, 19R, 21, 38AR, 38R, 42, 57R and 58; up to 127 expansion modules over I2C

        The case does not publish which ESP32 PLC model the line uses, or how many units. The source PDF shows a photo of an ESP32 PLC 21+, and the image here shows the ESP32 PLC 21 FLEX, its current version. Choose the model by the number and type of signals on your line.

        Questions about this case

        What is a machinery retrofit?

        A retrofit upgrades an existing machine or line instead of replacing it. Usually the control and the data side change: new controllers, new sensors and a network link, while the mechanics stay. In this case a food packaging line that was becoming obsolete got industrial controllers, sensors and integration with the customer's systems.

        Which data do you need for OEE on a packaging line?

        OEE is availability × performance × quality. You need the planned time, the running, stop and changeover times, the ideal rate, the packs produced and the rejected packs. In this case specific sensors connected to the PLC collect the data for the OEE indicators. You can see the idea in the Machine Monitor simulator.

        How do you measure energy by machine or by phase?

        A typical way: an energy meter on the supply of each machine or phase, read by the PLC over Modbus RTU on RS-485, or by counting the pulse output of the meter. The case says that the energy consumption of the line, its machines or phases is now known, but it does not publish how it is measured. See an ESP32 PLC reading Modbus RTU registers.

        Why does the product change the performance of a packaging line?

        The same line can behave very differently with one product or another. In this case the size of the product or the pack and the marking system (label, ink or laser) affect the performance. With sensors by phase or machine, you can see which combination of product, pack and phase runs best or has more incidents.

        How does PLC data reach a BI platform?

        In this case the data goes to the central system and into a BI platform in real time, and Node-RED eased the integration with other systems. A typical way to do it: the PLC sends its data over the network, for example over MQTT, Node-RED collects and checks it, and writes it to a database that the BI tool reads. See a Node-RED concentrator for ESP32 PLCs.

        Which PLC fits a machine retrofit?

        It depends on the signals you need to read and drive, the links to other systems, and where the controller goes. This case used the ESP32 PLC. The same retrofit approach works with our Arduino based M-Duino PLCs or with the Raspberry PLC, for example when the controller must also run Node-RED or a database. Count the signals first, then choose the model.

        Download the case study

        4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.

        Upgrading a machine or a line?

        Tell us what the line does today. An engineer will answer.

        Tell us the machine, the control it has now, the signals you can reach and where the data must go: SCADA, ERP or BI. We will propose the PLC, the sensors and the integration.

        • You get an answer from our technical team
        • PLC, sensors and integration with your systems
        • Arduino, ESP32 or Raspberry Pi based PLCs