A refrigerator controller in Structured Text (IEC 61131-3), run on a Beckhoff IPC with real EtherCAT I/O. Door light, a timed door alarm that latches until reset, and compressor control around a setpoint, with an LM35 temperature sensor and a TwinCAT VISU HMI. Control Systems course at HAMK, spring 2026, Group 7.


What was tested. The LM35 was put into cold water while TwinCAT Scope logged the analog input. The reading fell from about 24.8 °C to 20.3 °C in roughly 15 s and then levelled off.
During the same session the compressor output switched on and off around the setpoint, the yellow LED followed the door switch, and the red alarm LED came on after 10 s with the door open and stayed on until the reset button was pressed.
The VISU shows the actual temperature and has a knob for the setpoint, so the controller can be run from the lab monitor.



| Signal | Hardware |
|---|---|
| Door | Toggle switch on EL1008 |
| Alarm reset | Momentary button on EL1008 |
| Interior light | Yellow LED on EL2008 |
| Door alarm | Red LED on EL2008 |
| Compressor | Green LED on EL2008 |
| Temperature | LM35 on EL3074, 0–10 V, powered from 24 V |
| HMI | TwinCAT VISU: actual temperature, setpoint knob |
AT %I* / AT %Q*.// Fridge2B: light, door alarm after 10 s, latched until reset bLight := bDoorOpen; fbTimerDoorAlarm(IN := bDoorOpen, PT := T#10S); IF fbTimerDoorAlarm.Q THEN bAlarmLatched := TRUE; END_IF IF bAlarmReset THEN bAlarmLatched := FALSE; END_IF bAlarmOut := bAlarmLatched;
// TemperatureSimulator: compressor with hysteresis IF GVL_Var.fTempActual > (GVL_Var.fTempSet + GVL_Var.fHysteresis) THEN GVL_Var.bCompressure := TRUE; END_IF IF GVL_Var.fTempActual < (GVL_Var.fTempSet - GVL_Var.fHysteresis) THEN GVL_Var.bCompressure := FALSE; END_IF // warming: +0.1 C every 2 s, every 1 s with the door open tImTemp := SEL(GVL_Var.bDoorOpen, T#2S, T#1S); fbT2(IN := TRUE, PT := tImTemp, Q => bRaiseTemp); IF bRaiseTemp THEN GVL_Var.fTempActual := GVL_Var.fTempActual + 0.1; fbT2(IN := FALSE); END_IF

In the next lab the same PLC was wired to a Dobot MG400 with one signal in each direction: EL2008 output 4 to MG400 DI8, and MG400 DO8 to EL1008 input 8. The robot moved a part from a pick point to a cooling station, and the PLC released it to the output position once the temperature was low enough. The PLC program for this lab is not in the repository yet.


Sazzad Ibna Mahfuz, Ahmad Tanveer, Muhammad Taqi, Pramoda Medis. Work covered I/O wiring, EtherCAT device scan, mapping GVL variables to the terminals, the ST programs from light control to latched alarm and compressor control, the VISU, and logging the sensor in TwinCAT Scope.
Known gaps: the cooling branch of the simulator is declared but not written, so in simulation the temperature only rises; bCompressor and bCompressure are two separate variables.