SPS-Steuerung eines Montagebands mit RFID und HMIPLC control of an assembly conveyor with RFID and HMI
Eine Ablaufsteuerung, die ein Werkstück über drei Stationen bis zur Endmontage führt, Analogwerte und Bedienereingaben auswertet, Produktionsdaten per RFID fortschreibt und bei NOT-AUS sicher einfriert – entworfen, programmiert und in Betrieb genommen in Siemens TIA Portal V17.A sequence control that moves a workpiece across three stations to final assembly, evaluates analog values and operator input, updates production data via RFID and freezes safely on emergency stop – designed, programmed and commissioned in Siemens TIA Portal V17.
Ein Lastenheft in eine robuste Ablaufsteuerung übersetzenTurning a specification into a robust sequence control
Ausgangspunkt war ein Lastenheft mit Must-, Should- und Could-Have-Anforderungen. Die Steuerung sollte nur nach PIN-Freigabe laufen, eine Losgröße per BCD übernehmen, abhängig von einem Analogwert verzweigen, Daten auf einem RFID-Tag fortschreiben und bei NOT-AUS ohne Datenverlust stehen bleiben – nachvollziehbar dokumentiert und bibliotheksfähig programmiert.The starting point was a specification with must-, should- and could-have requirements. The control had to run only after a PIN release, take a lot size via BCD, branch on an analog value, update data on an RFID tag and stop on emergency stop without losing state – clearly documented and programmed as a reusable block.
Hardware am VersuchsplatzHardware at the test station
Eine SIMATIC S7-1500 (CPU 1516-3 PN/DP) mit zentralen Ein-/Ausgabe- und Analogbaugruppen, dezentraler Peripherie ET 200SP über PROFINET, einem CM 4×IO-Link für den RFID-Schreib-/Lesekopf und einem Touch Panel TP700 Comfort. Das Bandmodell hat drei Initiatoren, eine Lichtschranke, vier Leuchtmelder, eine Hupe und einen NOT-AUS-Taster.A SIMATIC S7-1500 (CPU 1516-3 PN/DP) with central I/O and analog modules, ET 200SP distributed I/O over PROFINET, a CM 4×IO-Link for the RFID read/write head and a TP700 Comfort touch panel. The conveyor model has three proximity switches, a light barrier, four indicator lamps, a horn and an emergency-stop button.
Ablauf und permanente Operationen sauber getrenntSequence and permanent operations, cleanly separated
Das zyklische Hauptprogramm OB1 (KOP) normiert den Analogwert, prüft die PIN, ruft nur bei korrekter PIN den Funktionsbaustein auf und bearbeitet unabhängig davon RFID-Bausteine, BCD-Wandlung, Stückzähler und HMI-Daten. Der FB „Montageband“ (FUP) enthält die Schrittkette und arbeitet ausschließlich über seine Schnittstelle – er ist damit wiederverwendbar.The cyclic main program OB1 (LAD) scales the analog value, checks the PIN, calls the function block only when the PIN is correct and independently handles RFID blocks, BCD conversion, piece counter and HMI data. FB “Montageband” (FBD) contains the step sequence and works exclusively through its interface – which makes it reusable.
| BausteinBlock | SpracheLanguage | AufgabePurpose | HerkunftOrigin |
|---|---|---|---|
OB1 Main | KOPLAD | PIN-Freigabe, AI1-Normierung, FB-Aufruf, RFID, BCD, HMI, ZählerPIN release, AI1 scaling, FB call, RFID, BCD, HMI, counter | eigenown |
FB1 Montageband | FUPFBD | Schrittkette S0–S10, NOT-AUS-Logik, Zeiten, FlankenStep sequence S0–S10, E-stop logic, timers, edges | eigenown |
HMI_DB, Zaehler1 | – | HMI-Daten, Stückzähler (CTU)HMI data, piece counter (CTU) | eigenown |
LRfidIOL_Read/_Write + DBs | – | RFID lesen/schreiben über IO-LinkRFID read/write via IO-Link | bereitgestelltprovided |
SIMFB | – | Simulationsmodus der Projektvorlage für Tests ohne HardwareSimulation mode of the starter project for testing without hardware | Vorlagestarter |
| HMI-Bilder (WinCC)HMI screens (WinCC) | WinCC Adv. | Anlagenübersicht, Bedienpult, Montageband; Anbindung über HMI_DBOverview, operator panel, conveyor; connected via HMI_DB | eigenown |
Die Schrittkette zum AusprobierenTry the step sequence yourself
Ein vereinfachtes Browser-Modell der dokumentierten FB-Logik mit den echten Zeiten. Starten Sie mit SF2, stellen Sie AI1 über bzw. unter 8 V und lassen Sie AI1 an Station 3 unter 5 V fallen. Probieren Sie den NOT-AUS mitten im Ablauf – oder eine falsche PIN.A simplified browser model of the documented FB logic, using the real times. Start with SF2, set AI1 above or below 8 V, and let AI1 fall below 5 V at station 3. Try the emergency stop mid-sequence – or a wrong PIN.
Hinweis: Das Modell veranschaulicht die dokumentierte Logik. Der eigentliche SPS-Code liegt im TIA-Portal-V17-Projektarchiv.Note: this model illustrates the documented logic. The actual PLC code lives in the TIA Portal V17 project archive.
Wo die Sorgfalt stecktWhere the care went
Analogwert mit Schwelle und FlankeAnalog value with threshold and edge
AI1 liefert 0–27 648 für 0–10 V; NORM_X/SCALE_X rechnen in Volt um (5 V ≙ 13 824, 8 V ≙ 22 118). Die 8-V-Schwelle entscheidet in S2 über den Weg. In S6 zählt nicht der Pegel, sondern das Unterschreiten von 5 V als negative Flanke – so löst der Übergang genau einmal aus.AI1 delivers 0–27,648 for 0–10 V; NORM_X/SCALE_X convert it to volts (5 V ≙ 13,824, 8 V ≙ 22,118). The 8 V threshold picks the route in S2. In S6 it is not the level but the falling below 5 V, evaluated as a falling edge, so the transition fires exactly once.
Low-aktive SignaleLow-active signals
Lichtschranke BR1 und NOT-AUS SF5 sind low-aktiv – Drahtbruch führt in den sicheren Zustand. Deshalb schaltet S7 mit NOT BR1 (Strahl unterbrochen) und S9 mit BR1 (Strahl wieder frei).Light barrier BR1 and E-stop SF5 are low-active – a broken wire leads to the safe state. Hence S7 transitions on NOT BR1 (beam interrupted) and S9 on BR1 (beam clear again).
NOT-AUS: einfrieren statt verlierenE-stop: freeze, don’t lose
Bei SF5 = FALSE werden beide Antriebe sofort abgeschaltet, der Schritt wird gemerkt, Zeiten und Schrittvariable bleiben stehen, die Leuchtmelder blinken mit 2,5 Hz. Nach dem Entriegeln läuft die Kette an der unterbrochenen Stelle weiter; SF4 setzt dagegen alles zurück.On SF5 = FALSE both drives stop immediately, the step is stored, timers and step variable hold, and the lamps blink at 2.5 Hz. After release the sequence resumes exactly where it stopped; SF4 resets everything instead.
RFID-Aufträge statt RFID im FBRFID jobs, not RFID inside the FB
Die IO-Link-RFID-Bausteine müssen in jedem Zyklus laufen und sitzen daher im OB1. Der FB setzt nur die Aufträge RFID_Lese und RFID_Schreib; S8 schaltet erst weiter, wenn 2 s vergangen sind und der Schreibauftrag fertig ist.The IO-Link RFID blocks must run every cycle, so they live in OB1. The FB only issues the jobs RFID_Lese and RFID_Schreib; S8 advances only when 2 s have passed and the write has completed.
HMI_DB.WinCC overview screen: RFID byte, piece counter, AI1 in volts and a “read RFID” button – connected via HMI_DB.Erst Simulation, dann HardwareSimulation first, then hardware
Ich habe die Software zuerst im Simulationsmodus entwickelt und getestet, dann auf die Laborhardware geladen und dort mit ausgeschalteter Simulation geprüft. Alle zehn definierten Testfälle wurden erfüllt; die Anlage lief vollständig.I first developed and tested the software in simulation mode, then downloaded it to the lab hardware and tested it there with simulation switched off. All ten defined test cases passed; the system ran end to end.
| # | TestfallTest case | ErwartungExpected | ErgebnisResult |
|---|---|---|---|
| 1 | Korrekte PIN, Start mit SF2Correct PIN, start with SF2 | Band fährt bis BG2Belt runs to BG2 | ✓ |
| 2 | AI1 > 8 V | Station 1 übersprungenStation 1 skipped | ✓ |
| 3 | AI1 ≤ 8 V | Fahrt zu BG1, warten auf SF1Run to BG1, wait for SF1 | ✓ |
| 4 | Weiterfahrt ab Station 3Leaving station 3 | erst nach AI1 < 5 Vonly after AI1 < 5 V | ✓ |
| 5 | Endmontage an der LichtschrankeFinal assembly at light barrier | PF4, RFID lesen/schreiben, Restmenge −1PF4, RFID read/write, quantity −1 | ✓ |
| 6 | Restmenge 0Quantity 0 | Hupe 3 s, dann S0Horn 3 s, then S0 | ✓ |
| 7 | NOT-AUS im AblaufE-stop mid-sequence | Antriebe aus, Blinken, eingefrorenDrives off, blinking, frozen | ✓ |
| 8 | EntriegelnRelease | Fortsetzen an gleicher StelleResume at same point | ✓ |
| 9 | Reset SF4 | S0, Zähler 0S0, counter 0 | ✓ |
| 10 | Falsche PINWrong PIN | FB wird nicht ausgeführtFB not executed | ✓ |
Ergebnisse laut meinem Testprotokoll am Versuchsplatz. Die optionalen Could-Have-Erweiterungen (u. a. erweiterter Codeschutz, eigene Datentypen, HMI-Quittierung nach NOT-AUS) wurden bewusst nicht umgesetzt.Results as recorded in my test log at the station. The optional could-have extensions (e.g. extended code protection, custom data types, HMI acknowledgement after E-stop) were deliberately not implemented.
Was ich gebaut habe – und was gestellt warWhat I built – and what was provided
Meine UmsetzungMy work
- Hardwarekonfiguration nach StationsschildHardware configuration per station label
- Programmablaufplan und SchrittkettenentwurfFlowchart and step-sequence design
- OB1, FB „Montageband“, HMI_DB, StückzählerOB1, FB “Montageband”, HMI_DB, piece counter
- Entwurf der WinCC-HMI-BilderDesign of the WinCC HMI screens
- Entwicklung und Simulation zu Hause, Inbetriebnahme im LaborDevelopment and simulation at home, commissioning in the lab
- Testprotokoll und technische DokumentationTest log and technical documentation
BereitgestelltProvided
- Laboranlage (S7-1500, ET 200SP, TP700, Bandmodell)Lab equipment (S7-1500, ET 200SP, TP700, conveyor model)
- Lastenheft und AnlagenbeschreibungSpecification and system description
- RFID-Bibliotheksbausteine (FB2–FB5, DB2–DB7)RFID library blocks (FB2–FB5, DB2–DB7)
- Simulationsbaustein SIMFB der ProjektvorlageSimulation block SIMFB from the starter project