# Optical QC station: EtherCAT control plan How the [inline optical QC station](inline-optical-qc.md) is controlled, wired, priced, built and tested. Decided in October 2026: EtherCAT, no PLC, and the 100 W StepperOnline servo kit on both axes. Prices for the EtherCAT parts were checked on [geizhals.de](https://geizhals.de/) and in the [QiTech shop](https://shop.qitech.de/collections/ethercat) on 19 October 2026; the station software builds on QiTech's open-source EtherCAT library (section 5). The station hardware itself (frame, cameras, lights, lasers) is in the station doc and its [bill of materials](inline-qc-station/inline-qc-station-bom.csv). ## 1. What is decided | Part | Choice | Why | |---|---|---| | Fieldbus | EtherCAT, 1 ms cycle, distributed clocks | one cable for drives and I/O; the laser samples and the spindle position come from the same cycle | | Spindle drive | StepperOnline A6-EC100L2A1-M17 (100 W, A6-200EC drive), cyclic synchronous position, 1:6 timing belt | torque need about 0.02 N·m at the motor against 0.32 N·m rated; the belt brings the load inertia to about 28 times the rotor (station doc) | | Conveyor drive | the same kit, cyclic synchronous velocity | one spare covers both axes | | Controller | fanless Intel N100 mini PC with Intel i226-V ports, NixOS with a real-time kernel | open source stack, declared in the plant's clan like every other machine | | Master software | QiTech's EtherCAT library (qitech_lib, LGPL-3.0) on EtherCrab; IgH EtherCAT Master as the fallback | Rust like the factory application, already running QiTech's own production machines, with distributed clocks and a servo driver to copy; IgH is older and proven | | Camera clock | separate RS-422 encoder on the spindle shaft | the A6-EC drive has no divided encoder output | | Safety | hardwired: safety relay, two contactors in the drive supply | the 100 W kit has no STO; the 400 W STO kit's manual names no safety rating (station doc) | ## 2. Bus layout ``` Station controller (N100, NixOS, real-time kernel) | |-- port 1 (i226-V) == EtherCAT ==> EK1101 coupler | |-- EL1809 16 digital inputs | |-- EL2809 16 digital outputs | |-- EL3152 2 analog inputs (warp lasers, 4 to 20 mA) | |-- EL5101 spindle encoder (A, B, index) | |-- EL9011 end cap | | | X2 out ==> A6-200EC spindle (CSP) | ==> A6-200EC conveyor (CSV) | |-- port 2 (i226-V) -- plain Ethernet --> edge PC, plant OT network Spindle encoder (RS-422, 5 V from the EL5101) A, B ---> racer 2 line-scan 1 ---> racer 2 line-scan 2 ---> EL5101 (A, B, index) ``` - **The drives sit at the end of the line.** On the small A6-200EC the control electronics share the main supply; there are no separate control-power terminals ([A6-EC manual](https://www.omc-stepperonline.com/download/A6-EC_series_servo_drive_manual.pdf), specification table). So when the safety contactors open, both drives leave the bus. At the end of the line that cuts nothing else off: the coupler, the I/O and the encoder count stay up, and the master can read the e-stop and door status and bring the drives back after the reset. The distributed-clock reference also sits on the I/O side for the same reason. - **One RS-422 line, three receivers.** The encoder's line driver feeds both cameras and the EL5101 in a chain (RS-422 allows up to ten receivers). The racer 2 inputs take RS-422 with a switchable 120 Ω terminator ([Basler](https://docs.baslerweb.com/io-control-racer-2-l-xl)). Only the last receiver on the line is terminated; check on the bench whether the EL5101 input already is. - **Port 2 is ordinary Ethernet** to the edge PC and the plant's OT network (VLAN as in [digital factory](../digital-factory.md)). The EtherCAT port is a point-to-point cable to the EK1101, never a switch. ## 3. Signals **EL1809, 16 inputs (24 V):** | Ch | Signal | Device | |---|---|---| | 1 | record at the infeed | diffuse photoelectric sensor | | 2 | label trigger (also wired straight to the two colour cameras' trigger inputs) | diffuse photoelectric sensor | | 3 | record at the inspection position (also to the conveyor drive's touch probe 1, CN1 DI5) | through-beam pair | | 4 | outfeed full | diffuse photoelectric sensor | | 5, 6 | lift up, lift down | cylinder switches | | 7, 8 | mandrel open, mandrel clamped | cylinder switches | | 9, 10 | pusher home, pusher out | cylinder switches | | 11 | safety relay status | PNOZ s3 semiconductor output | | 12 | door closed (status contact) | safety door switch | | 13 | contactors closed | contactor auxiliary contact | | 14 | reset pressed | second contact on the reset button | | 15 | air pressure ok | pressure switch on the FRL | | 16 | spare | | **EL2809, 16 outputs (24 V, 0.5 A):** lift up, lift down, mandrel clamp, pusher out, pusher back, stack light green, amber and red, buzzer, light controllers on (lights only during the turn), reset-button lamp; five spare (an ionising bar at the infeed is one candidate). **EL3152, 2 analog inputs:** the two optoNCDT 1420 lasers at 90 and 130 mm radius. Their analog output is 4 to 20 mA; voltage only comes through a load resistor in the cable ([Micro-Epsilon manual](https://micro-epsilon.com/download/manuals/man--optoNCDT-1420--en.pdf)), so the current-input EL3152 replaces the ±10 V EL3102 of the first draft. **EL5101:** spindle encoder A, B and index. It counts the spindle angle directly (not the motor behind the belt) and latches the count at the index once a turn. **Drive inputs:** only the conveyor drive's touch probe 1 is used: the through-beam latches the conveyor position at the record's leading edge, so the stop over the chuck does not depend on the 1 ms cycle or the input filter. **Process data per drive.** The A6-EC has one freely mapped RPDO and TPDO plus fixed sets; the fixed 1702h set carries control word, target position, target velocity and mode together (manual, PDO section), so both drives can share one mapping and differ only in the mode (8 for CSP, 9 for CSV). The drive runs only in DC sync mode; its SYNC0 period range depends on the mode, so the 1 ms cycle is the first bench check. ## 4. Prices from geizhals.de and the QiTech shop Lowest price on 19 October 2026, in EUR including 19% German VAT; THB at 38.115 per EUR. Four terminals come from the QiTech shop (section 5), the rest from the lowest geizhals.de offer. | Part | Qty | Example | EUR | THB | Source | |---|---|---|---|---|---| | Station controller | 1 | ANDAQI RS55 (6 × i226-V) / MNBOXCONET P2-N100 (2 × i226-V, fanless) | 393.99 to 455.99 | 15,017 to 17,380 | [geizhals](https://geizhals.de/mini-pc-barebone-netzwerk-pc-intel-n100-a2926989.html) | | EtherCAT coupler | 1 | Beckhoff EK1101 (EK1100 with an ID switch) | 85.13 | 3,245 | [QiTech shop](https://shop.qitech.de/products/beckhoff-ek1101), 148 in stock | | 16 digital inputs | 1 | Beckhoff EL1809 | 16.53 | 630 | [QiTech shop](https://shop.qitech.de/products/beckhoff-el1809), 157 in stock | | 16 digital outputs | 1 | Beckhoff EL2809 | 41.03 | 1,564 | [QiTech shop](https://shop.qitech.de/products/beckhoff-el2809), 104 in stock | | 2 analog inputs, 4 to 20 mA | 1 | Beckhoff EL3152 | 208.90 | 7,962 | [geizhals](https://geizhals.de/185886294) | | Encoder interface, RS-422 | 1 | Beckhoff EL5101 | 291.04 | 11,093 | [geizhals](https://geizhals.de/2974477757) | | End cap | 1 | Beckhoff EL9011 | 1.76 | 67 | [QiTech shop](https://shop.qitech.de/products/beckhoff-el9011), 131 in stock | | Spindle encoder | 1 | E6B2-CWZ1X 2000 P/R (marketplace) / GHH60 2500 P/R line driver | 45.52 to 187.83 | 1,735 to 7,159 | [geizhals](https://geizhals.de/6925000400) | | Safety relay | 1 | Pilz PNOZ s3 750103 | 148.38 | 5,656 | [geizhals](https://geizhals.de/pilz-pnoz-s3-24vdc-2-n-o-750103-a3204143.html) | | Contactor, 24 V DC coil | 2 | Siemens 3RT2015 | 27.95 each | 2,131 | [geizhals](https://geizhals.de/siemens-leistungsschuetz-3rt2015-1bb41-a3269085.html) | | E-stop button | 1 | Schneider Harmony, 40 mm head | 45.08 | 1,718 | [geizhals](https://geizhals.de/208045150) | | HMI touch monitor 10.1 inch | 1 | iiyama ProLite TF1015MC-B3 | 311.90 | 11,888 | [geizhals](https://geizhals.de/iiyama-prolite-tf1015mc-b3-a3228748.html) | | 24 V supply, 120 W | 1 | Mean Well SDR-120-24 | 38.87 to 47.35 | 1,482 to 1,805 | [geizhals](https://geizhals.de/980542712) | | Servo kit 100 W, EtherCAT | 2 | StepperOnline A6-EC100L2A1-M17 | USD 123.29 each | 8,137 | not on geizhals; [StepperOnline](https://www.omc-stepperonline.com/a6-series-100w-ethercat-ac-servo-motor-kit-3000rpm-0-32nm-17-bit-absolute-encoder-ip67-a6-ec100l2a1-m17), China warehouse | | **Total** | | | **1,684.03 to 1,896.82 + USD 246.58** | **72,324 to 80,434** | | Notes on the prices: - **German VAT comes off, Thai duty and VAT go on.** For an order shipped to Thailand the 19% German VAT is not charged; Thai import VAT (7%) and duty are added. The listed gross price is therefore used as the landed low end; the bill of materials adds 30% for shipping and a Thai distributor as the high end (estimate). - **QiTech shop:** Beckhoff terminals new in the original box, bought out of an insolvency, at a fraction of the usual price: EL1809 EUR 16.53 against EUR 93.97 on geizhals, EL2809 EUR 41.03 against EUR 102.97, EK1101 EUR 85.13 against EUR 150.75 for an EK1100 (no current geizhals offer). Together EUR 207.57 (THB 7,912) less. The shop ships worldwide by DHL from Darmstadt in 7 to 14 working days; the postage to Thailand only shows at checkout (not checked). It has no EL3152 or EL5101, so those two stay with geizhals. - **Mini PCs** on geizhals are marketplace brands (ANDAQI, MNBOXCONET, AIOPCWA). Before ordering, check that the ports are i226-V (not the older i225) and that the BIOS lets C-states be switched off. - **Encoder:** the EUR 45.52 E6B2-CWZ1X listings come from marketplace sellers and may be copies; the bench test decides whether one is good enough. A genuine Omron or a 2,500-pulse line-driver encoder (GHH60, EUR 187.83) is the fallback. - **Contactors:** the price is for 3RT2015-1BB41 (one NO auxiliary contact). The feedback loop needs the NC version, 3RT2015-1BB42 (price not checked; same class). - **Not on geizhals:** the servo kits (StepperOnline direct), the optoNCDT lasers and the Basler cameras (both in the station bill of materials). Bill of materials effect: the control group comes to USD 4.2k to 7.7k (edge PC with GPU and the cabinet lot included) and the station to **USD 16.7k to 32.7k (THB 0.55M to 1.08M)**. ## 5. Software on the station controller **QiTech Control, checked 19 October 2026.** QiTech, a machine builder in Darmstadt (filament extrusion and winding), publishes the control software of its own machines: [QiTech Control](https://github.com/qitechgmbh/control), LGPL-3.0, 359 stars, 2,855 commits since January 2025, last push 16 October 2026, running more than ten of their production machines (their README). It is a Rust server on EtherCrab (their fork `ethercrab-dc`) with axum and Socket.IO, an Electron and React front end, and a NixOS image with a tuned kernel. The EtherCAT layer is a separate library, [qitech_lib](https://github.com/qitechgmbh/qitech_lib), also LGPL-3.0. What fits: - The same choices as this plan: Rust, EtherCrab, NixOS, Beckhoff terminals, no PLC. - Distributed clocks are built in (SYNC0 at 1 ms with a 500 µs shift by default), with SDO access, PDO mapping and the EtherCAT state changes. - Drivers exist for the EK1100 and the EL2809 of our list, and for 4 to 20 mA inputs (EL3021, EL3024). - A CiA402 servo driver for the Panasonic MINAS A6 over CoE (169 lines) is the template for the A6-EC: the same profile and the same PDO and SDO steps. - Their NixOS settings run in production: `isolcpus=2,3` (core 2 for the EtherCAT thread, core 3 for the control loop), `nohz_full`, `rcu_nocbs`, `pcie_aspm=off`, `preempt=full` on kernel 6.18, and a realtime group with rtprio and memlock. What is missing: - Drivers for the EK1101, the EL1809 (the 16-channel twin of the supported EL1008), the EL3152, the EL5101 and the A6-EC drive. A Beckhoff driver is a short file (their EL2809: 138 lines). We write them and send them upstream. - The library's README warns that its API "may change drastically" before a stable release, so we pin one commit. - The full QiTech Control app (Electron front end, a GNOME desktop on the machine PC, their machine catalogue) is built around their machines. **Decision:** qitech_lib, pinned, is the EtherCAT layer; the station service on top of it is ours; the full app is not used. The HMI stays a web page from the station service, which keeps the controller image small and the station inside the factory application's stack. Adding the station as a machine in a fork of their app stays open if their front end proves worth it. LGPL-3.0 leaves our own code under our own licence; changes to the library are shared under the LGPL, which we want anyway for the drivers. The obligations only apply if we hand the software to someone else. **Also in their shop, not taken:** TwinSAFE terminals (EL1918 EUR 140.89, EL2904 EUR 105.85, EL6910 EUR 106.12) need Beckhoff's TwinCAT tools to set up the safety logic and a master that passes the safety frames between terminals, which qitech_lib does not offer; the PNOZ relay is simpler. Beckhoff servo terminals with STO (EL7211-9014 EUR 215.99 with an AM8122 motor at EUR 285.33) cost about EUR 500 an axis and need a 48 V supply; the 100 W kit stays. **Operating system (NixOS module in the plant's clan):** - Start from QiTech's tested kernel settings above. If the bench jitter test fails, move to 6.12 LTS with PREEMPT_RT (in the mainline kernel since 6.12), which the IgH fallback needs anyway: its native i226 (igc) driver is listed for 6.12 ([IgH device drivers](https://docs.etherlab.org/ethercat/1.6/doxygen/devicedrivers.html)). - The EtherCAT port's interrupts pinned to the EtherCAT core, deep C-states and Energy Efficient Ethernet off on that port. - The station service runs under systemd with real-time priority, locked memory and raw-socket rights, and restarts on failure; logs go to the plant's log store. **Station service (Rust, one program, written by us):** 1. **Bus loop:** the qitech_lib EtherCAT thread every 1 ms with distributed clocks; brings all slaves to OP, maps the drive PDOs, runs the CiA402 state machine of both drives, and re-adds a drive that left the bus after an e-stop. 2. **Sequence:** one state machine per record: wait at the infeed, convey, stop on the latched leading edge, lift, clamp, one turn, unclamp, lower, convey out, push if rejected. Every step has a timeout and a fault text (for example "lift up not reached in 0.8 s"). 3. **Measurement:** during the turn, each cycle stores the EL5101 count and both laser values, about 1,000 points a turn at one turn a second. The laser output lags 750 µs at 4 kHz (Micro-Epsilon), a fixed offset of about 0.3° at that speed, corrected in software. Edge run-out and dish are computed at the end of the turn. 4. **Edge PC link** over port 2: record in place, turn started, turn done with the warp values; the edge PC answers with the verdict and the reason. No answer in time means reject and an alarm. 5. **HMI:** a web page served by the same program and shown on the touch monitor in a kiosk browser: state, last results, alarms, counters, and a setup mode (jog, single steps) that works only with the door shut. The cameras keep their clock in hardware: the encoder pulses go straight into the racer 2 encoder input, and the camera's frequency converter scales them to the line count the optics need ([Basler](https://docs.baslerweb.com/frequency-converter)). No software sits between the spindle and the line timing. ## 6. Safety - **Circuit:** e-stop (two channels) and the tunnel door switch (two channels) on a Pilz PNOZ s3 with a monitored manual reset. Its two safety contacts switch two contactors in series in the 230 V supply of both drives; the contactors' NC mirror contacts sit in the relay's feedback loop. A dump valve on the FRL, wired with the contactor coils, vents the cylinders at the same time. - **Stop category 0:** power off at once. Both axes carry a few kg·cm², so they coast to a stop in well under a second (estimate). If the risk assessment asks for a controlled stop first (category 1), a relay with delayed outputs (Pilz PNOZ s5 class) lets the master brake the axes before the power goes. - **Target:** PL d (estimate). A risk assessment to ISO 12100 and ISO 13849-1 by the machine builder decides; it is part of the acceptance test. - **After a stop:** reset, the drives power up and rejoin the bus, the master takes them back to OP, and the spindle angle comes from the EL5101 count, which never lost power. ## 7. Bench test, before the frame is built **Parts:** one servo kit, the mini PC, the EK1101 with the four I/O terminals and the end cap, the spindle encoder, the PNOZ s3, two contactors, the e-stop and the 24 V supply: EUR 1,372.13 (geizhals.de and the QiTech shop) plus USD 123.29, about **THB 56,000 (USD 1,710)**. Every part goes into the station afterwards. One laser and one line-scan camera, ordered early from the station list, make the test complete. A reject record on a test mandrel is the load. | # | Test | Pass (our targets) | |---|---|---| | 1 | qitech_lib (EtherCrab) brings coupler, terminals and drive to OP with distributed clocks at 1 ms | all slaves in OP, no lost frames over 24 h | | 2 | Cycle timing under load: images streaming on port 2, HMI open, CPU stress on the other cores | worst-case jitter under 50 µs over 24 h | | 3 | Spindle in CSP: one turn a second, 0.15 s run-up | stop repeatable within ±0.1° at the spindle | | 4 | EL5101 count against the servo position | exactly 6 motor turns per spindle turn over 1,000 turns, index latched every turn | | 5 | Laser through the EL3152 on the reject record | the warp trace repeats turn to turn within 0.05 mm, a tenth of the smallest edge run-out limit (0.5 mm, Mobineko) | | 6 | Camera clock: racer 2 on the encoder chain | the set number of lines every turn, none missed over 100 turns | | 7 | Conveyor (same drive in CSV): through-beam on touch probe 1 | position latched on every pass | | 8 | E-stop and door | contactors open, drive leaves the bus, I/O stays in OP; drive back in OP within 10 s of the reset | If the EtherCrab stack fails tests 1, 2, 3 or 8 and a week of work does not fix it, repeat them with the IgH master on the 6.12 real-time kernel. The station service keeps the bus loop behind one interface, so only that part changes. ## 8. Build order and timing (estimates) | Weeks | Step | Who | |---|---|---| | 1 to 3 | order the bench parts; servo kits from StepperOnline's China warehouse, Beckhoff and the rest from Germany or a Thai distributor | us | | 3 to 6 | drivers for EK1101, EL1809, EL3152, EL5101 and the A6-EC in qitech_lib, sent upstream; bench test (section 7) | us | | 5 to 9 | cabinet schematic (QElectroTech, open source) and cabinet build; station service and HMI | us, with a panel builder in Chiang Mai if needed | | 7 to 11 | frame, conveyor, spindle head and pneumatics | machine builder | | 10 to 12 | cabinet on the frame, wiring, drive tuning on the real spindle, first records | us and the machine builder | | 12 to 14 | risk assessment, acceptance test, then into production behind the cooling racks | us and the machine builder | So the control work should start about four months before the first records need checking (estimate). ## 9. Spares One servo kit (covers both axes), one spindle encoder and one contactor: about USD 210 at the prices above. At the QiTech shop's prices a spare coupler, EL1809 and EL2809 add only EUR 142.69 (USD 165), so they are stocked too. The EL3152 and EL5101 are not; a failed one is a few days by courier from Europe (estimate). ## 10. Open points 1. **The A6-EC drive on qitech_lib** is untested; the driver is ours to write from their MINAS A6 one. The bench answers it, with IgH as the fallback. Pin the qitech_lib commit; its API is not stable yet. 2. **SYNC0 range of the A6-EC** at 1 ms in CSP and CSV: not in the material read so far; the bench checks it. 3. **EL5101 termination** and the RS-422 chain with three receivers. 4. **Shipping:** the QiTech shop's postage to Thailand (shown at checkout) and a Thai Beckhoff quote for the EL3152 and EL5101. 5. **Risk assessment** by the machine builder: confirms PL d and stop category 0, or asks for the delayed relay. 6. Still open from the station doc: 7"/10" quick change, anti-static at the infeed, belt tension against the motor's 78 N radial load.