# 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/) on 19 October 2026. 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 | EtherCrab (Rust, MIT or Apache-2.0); IgH EtherCAT Master as the fallback | EtherCrab fits the Rust factory application; 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 ==> EK1100 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 EK1100, 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 Lowest listed price on 19 October 2026, in EUR including 19% German VAT; THB at 38.115 per EUR. | 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 EK1100 | 150.75 | 5,746 | [geizhals](https://geizhals.de/144468496) | | 16 digital inputs | 1 | Beckhoff EL1809 | 93.97 | 3,582 | [geizhals](https://geizhals.de/1371087148) | | 16 digital outputs | 1 | Beckhoff EL2809 | 102.97 | 3,925 | [geizhals](https://geizhals.de/1371087504) | | 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 | 4.33 | 165 | [geizhals](https://geizhals.de/455904583) | | 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,891.60 to 2,104.39 + USD 246.58** | **80,235 to 88,346** | | 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). - **EK1100:** geizhals has no current offer; EUR 150.75 is the last price, with EUR 255.43 at the top of the range. - **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.4k to 8.1k (edge PC with GPU and the cabinet lot included) and the station to **USD 16.9k to 33.1k (THB 0.56M to 1.09M)**, up from 16.1k to 32.9k, mostly the EL5101 and the retail price of the mini PC. ## 5. Software on the station controller **Operating system (NixOS module in the plant's clan):** - Kernel 6.12 LTS with PREEMPT_RT, which is in the mainline kernel since 6.12. The same kernel suits the IgH fallback, whose native i226 (igc) driver is listed for 6.12 ([IgH device drivers](https://docs.etherlab.org/ethercat/1.6/doxygen/devicedrivers.html)). - One core isolated for the bus loop (`isolcpus`, `nohz_full`, `rcu_nocbs`), the EtherCAT port's interrupts pinned to it, deep C-states and Energy Efficient Ethernet off on that port. - The station service runs under systemd with real-time priority and restarts on failure; logs go to the plant's log store. **Station service (Rust, one program, written by us):** 1. **Bus loop:** EtherCrab 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 EK1100 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,579.70 on geizhals plus USD 123.29, about **THB 64,000 (USD 1,950)**. 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 | 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 EtherCrab fails tests 1, 2, 3 or 8 and a week of work does not fix it, repeat them with the IgH master on the same 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 | 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. The Beckhoff terminals are not stocked at launch; a failed one is a few days by courier from Europe (estimate). ## 10. Open points 1. **EtherCrab with the A6-EC drive** is untested; its CiA402 support is basic. The bench answers it, with IgH as the fallback. 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. **Local prices:** ask a Thai Beckhoff source for a quote before ordering from Germany. 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.