Skip to content

Platforms and devices

TriggerGate runs on three kinds of hardware: a Windows PC with Advantech digital-input cards or X-keys keypads, an Advantech UNO controller, and an ESP32 board with wired Ethernet. Every one of them serves the same hub on port 9090 and the same web page, so a client application and an operator work the same way whichever is in the rack. This page describes what each platform offers, how they differ, and how a client or the web page chooses a platform and a device on a server that has more than one.

graph LR
    subgraph win["Windows service"]
        ADV["Advantech DAQ card<br/>polling + interrupts"]
        XK["X-keys keypads<br/>up to 8"]
    end
    subgraph uno["Advantech UNO"]
        UNOIN["8 I/O lines<br/>I²C expander, polled"]
    end
    subgraph esp["ESP32 board"]
        ESPIN["8 inputs<br/>interrupt-stamped"]
    end
    win --> HUB(["Hub on port 9090<br/>and the web page"])
    uno --> HUB
    esp --> HUB
    HUB <--> WEB[Web page in a browser]
    HUB <--> LIB[".NET client library<br/>in a show-control application"]

Choosing a platform

Advantech card on Windows X-keys on Windows Advantech UNO ESP32 board
Inputs As many as the card has, up to 128 The keys of the connected model 8 lines, shared with the status output 8, each mapped to a GPIO pin
Faceoff timing Interrupts or 10 ms polling, chosen per request Each USB report Continuous polling loop Interrupt stamp of every edge
Status output None (Identify lights the card's locate indicator) Red or green key light One of the 8 lines One GPIO pin
Trigger actions (OSC) Yes Yes Yes Yes (lighting unsupported)
Button health check Yes No Yes, polled; Native and SingleTransfer device-tested in K2, TwoTransfer and Combined supported but not device-tested Yes
Input diagnostics Yes No No Yes
Device log The service log, about three days The service log, about three days The service log, about three days Recent entries in memory, lost at restart
Scheduled faceoff on PTP time No No No Yes
Shut down from the web page Refused Refused Powers the UNO off Stops the board until it is reset or powered again

How finely each platform orders presses, and how it handles presses closer than that, is in Accuracy.

Windows service

The Windows service drives two families of hardware, and can run both at once.

Family Hardware Requirements
Advantech Advantech DAQ digital-input cards: PCIE-1730, PCIE-1754, PCIE-1758DIO, PCIE-1758DI, GPI-1754-1, USB-4750, PCIE-1762H and any other DAQNavi device with instant digital inputs The Advantech DAQNavi runtime, which provides the card drivers
X-keys P.I. Engineering X-keys HID devices (XK-3, XK-12, XK-24 and variants) None beyond the standard HID driver

Running both families

Both families run in one service fully independently: separate threads, separate settings and separate groups of clients, so nothing that happens on the X-keys side can reach Advantech clients. TriggerGate:WindowsDevice in the service's appsettings.json controls what runs:

  • Auto (the default): run Advantech whenever the DAQNavi runtime is installed, and X-keys always. DAQNavi's demo device is ignored in this mode, because it free-runs a counter on its inputs.
  • XKeys or Advantech: run only that family. Advantech is the one mode that will use the demo device.

A client that does not name a platform is connected to Advantech when a card was present when the service started, and to X-keys otherwise.

Input counts come from the device itself: the service asks the card which lines are inputs, and uses the connected X-keys model's layout. Clients are told only about inputs that exist, and about none while no device is attached.

Advantech digital-input cards

  • The service opens the first DAQNavi device that has digital inputs and reports up to 128 of them. If it finds no usable card, the GPIO System status says why, for example that another application such as Advantech Navigator has the card open (DAQNavi lets only one application configure a card at a time). It keeps looking, and opens a card as soon as one is available. If the card is removed, the status goes to Disconnected until it is back.
  • Every input is polled every 10 ms. Inputs whose card can raise digital-input interrupts can also be armed for interrupts, for a faceoff or pre-faceoff that asks for them. Nothing is armed when the card opens; a request that asks for interrupt edges arms exactly its participants before it is acknowledged (about 2 ms), and they stay armed until a later request needs a different set. At most 63 inputs can be armed at once. If the driver refuses, so does the request: the error is logged and shown in the status, and polling is never substituted. A card that accepts only rising-edge interrupts is armed for those, and the log says so.
  • When it opens a card the service turns off the card's hardware input filter, which would otherwise delay every edge by its block time, and logs which lines are inputs and which can raise interrupts. The GPIO System status names the card and its input count, and says "interrupts armed per faceoff" with the number of capable inputs, or "polling only" for a card without interrupts.
  • Interrupts are stamped by a small native library, tgstamp.dll, installed next to the service, so that the service's own pauses cannot delay a stamp. If it is missing or does not match the service, the Advantech platform stays Disconnected with a message that names the file and the reason, and the rest of the service runs normally.
  • Identify lights the card's locate indicator for half a second. The card has no status output.

How faceoffs choose between interrupt and polled edges is in Triggers and faceoffs.

X-keys keypads

  • One connection drives one X-keys device. With several connected, each is a separate device a client can choose (see Connecting to a platform and device), with its own faceoffs, status light and settings, so a faceoff never spans two keypads.
  • Devices are numbered from 0 in order of product ID, then of USB device path. The numbering is stable while the same devices stay plugged into the same ports; plugging devices in or out, or into other ports, can change which device holds a number. Two devices of one model are told apart only by their path. Up to 8 devices can be used at once.
  • A number with no device is still a valid choice: it shows Disconnected and connects as soon as a device appears. When devices come and go, every connected client gets the new list without reconnecting.
  • The status output is the keypad's red or green indicator light, chosen in the web page's settings. It lights for a second after any input changes, and Identify flashes it. With no status light chosen, Identify fails and says so.
  • Every faceoff is polled: presses that arrive in the same USB report are tied. How finely a model can order presses depends on how often it sends reports (see Accuracy).

Settings files

Each device keeps its settings (status output, OSC defaults) in its own file under %ProgramData%\GameshowPro\TriggerGate: settings.AdvantechWindows.json, settings.XKeysWindows.json for X-keys device 0, and settings.XKeysWindows.N.json for device N. Edit them through the web page's Settings dialog or a client, not by hand. Installing and configuring the service is in Install on Windows.

Advantech UNO

The UNO build runs TriggerGate as a Linux service on an Advantech UNO-220 running Raspberry Pi OS Lite, 64-bit (device-tested) or 32-bit (container-tested only). The Debian package enables I2C and prepares the device on first install; no Advantech driver package is needed. Raspberry Pi OS 11 (Bullseye) is too old for the package.

  • The UNO has 8 digital lines on an I²C port expander. Any one of them can be chosen as the status output in the web page's settings; the rest are inputs. The status output lights for a second after any input changes, and Identify flashes it. With no status output chosen, Identify fails and says so.
  • The inputs are read continuously. The default Native mode uses a real-time native thread to read the expander with one I2C transfer per sample and stamp changes before the managed service handles them. If the native library is missing, incompatible or cannot start, the service logs why and starts in SingleTransfer mode instead. A refused real-time priority leaves Native running under normal scheduling. SingleTransfer also uses one transfer per read, on a managed thread; it periodically checks and re-points the expander. TwoTransfer writes the register pointer then reads it on each pass. Combined uses one combined transaction per pass. See UNO read modes below.
  • Every UNO faceoff is polled. It has no guard interval: presses found by one read tie; presses found by different reads are ordered. The measured order boundary depends on the bus setup and read mode, and rare stalls can widen a tie. See Accuracy.
  • The button health check captures raw level changes in Native (the default), SingleTransfer, TwoTransfer, and Combined modes. It reports measured read resolution; polling can miss changes between reads. On one device, Native matched 18/18 health-case expectations at the 10 ms generator grid and 18/18 at the measured 1 ms grid, with 18/18 physical faceoff and level-restoration postflights in each run. All eight inputs in all 19 exports per run reported 3.5958 ms and 0.2796 ms resolution, respectively. SingleTransfer matched 17/18 at the 10 ms grid and passed 18/18 postflights; all eight inputs in its 19 exports reported 40.081 ms resolution. A 24.6483 ms acquisition gap made two of eight control_clean inputs Inconclusive. A separate Native browser test completed one guided cycle with two changes and no gap at 0.2343 ms reported resolution, with matching exported analysis and a passing physical postflight. TwoTransfer and Combined support was not device-tested in K2. See the K2 hardware report for per-case findings and limits.
  • The UNO can set its own NTP server from the web page's settings, when its system allows it; the dialog explains when it does not.
  • The UNO keeps time from the network (NTP) only: its real-time clock has no driver in the current Raspberry Pi OS kernel, so there is no battery-backed clock.
  • Shut down on the web page powers the UNO off.
  • The web page is served over HTTPS on port 443, and the hub stays on HTTP port 9090 for existing clients.
  • Settings are kept in /var/lib/GameshowPro/TriggerGate/settings.json.

Installing is in Install on an Advantech UNO.

UNO read modes

The package's first-install setup enables I2C and configures a 400 kHz bus with core_freq_min=500. With that setup, the shipped Native mode is the best measured choice for faceoff ordering. In the new press-rules build, all comparisons at tested gaps of 100 µs and above were ordered correctly (7,272/7,272 comparisons in 1,512 trials); the largest gap tied was 50 µs. All 1,000 eight-input simultaneous trials tied all eight inputs. During ten complete idle minutes, 10,304,121 native reads averaged about 58.2 µs, with no interval over 500 µs. These are observations from one device, not guaranteed limits; see the validation reports for conditions and limits.

On the same 400 kHz bus with the core clock held, the managed SingleTransfer comparison build read about every 67.1 µs across 52,994,759 selected reads. In its 6,256 main trials it recorded one split eight-input simultaneous trial among 2,000 and seven separated zero-gap comparisons among 58,472. It also saw ties at tested gaps as large as 2,000 µs in multi-input bursts. Native recorded no such split in its corresponding 2,000 simultaneous trials and ordered every comparison at tested gaps of 100 µs and above. The managed and native rounds ran separately and used an earlier press-rules build; the later Native confirmation above used the new rules.

To select a mode, put TriggerGate__UnoInputRead=Native, SingleTransfer, TwoTransfer, or Combined in /etc/default/triggergate, then restart triggergate.service. Omit the setting to use Native. TriggerGate__UnoNativePriority=50 requests FIFO priority 50 by default; use 0 for normal scheduling or a value from 1 to 99 to request another FIFO priority. Change modes for diagnosis or when a native start failure needs investigation; the startup log names the active mode. The automatic fallback needs no setting change.

ESP32 board

The ESP32 firmware runs on an ESP32 board with wired Ethernet and needs no PC.

  • It has 8 logical inputs. In the web page's settings each one is mapped to a GPIO pin of the board, and one GPIO pin can be the status output. How to wire the inputs is in ESP32 input wiring.
  • Every edge of every input is stamped in the GPIO interrupt handler, on a microsecond timer. Faceoff entries are therefore timed by interrupt stamps, with a discrimination period D of 50 µs and a 300 µs wait after a group's last entry, both fixed in the firmware. Requests ask for polling, and reports say "polled", because the board lists no interrupt inputs; a request for interrupt edges is refused. The web page's faceoff dialog therefore shows "Faceoffs use polling" on an ESP32.
  • The board does not report ordering resolutions in its configuration.
  • OSC trigger actions, scheduled-faceoff actions and the RunOsc command are available over IPv4 Ethernet. OSC defaults and available source subnets are exposed in settings. Lighting actions remain unsupported and are refused. The bounded action queue can drop faceoff OSC actions under load; those drops are logged and do not invalidate faceoff timing. See Trigger actions.
  • It can follow a PTP clock and start scheduled faceoffs at an agreed PTP time, and it can set its NTP server for wall-clock time. See Clocks and time.
  • Its device log is a limited history held in memory and lost when the board restarts.
  • Shut down on the web page stops the board until it is reset or powered again.
  • It serves the web page over HTTPS on port 443, keeps HTTP on ports 80 and 9090, and advertises itself on the network by mDNS.

Setting up a board is in Set up an ESP32 board.

Connecting to a platform and device

Every server has one hub at /TriggerGate on port 9090. Clients find servers on the local network by mDNS, under the service type _gp-triggergate._tcp, or by host name or address.

A client picks a platform with a query on the hub address:

  • http://host:9090/TriggerGate (no query) connects to the server's default platform: on Windows, Advantech when a card was present at start-up, otherwise X-keys.
  • http://host:9090/TriggerGate?platform=XKeysWindows (or AdvantechWindows or Uno, in any case) connects only to that platform. If the server does not run it, the connection is accepted but shows a Disconnected state that says so, receives no edges, and every command fails with the same message.
  • &device=N picks the N-th device of the platform, from 0. No device means 0. X-keys accepts 0 to 7, numbered as described above; the other platforms drive one device and accept only 0. A number that is not accepted connects to nothing, with a state that says why.

On connecting, a client is told every platform and device the server offers and which one it is connected to. The web page shows them as one list of choices, such as "Advantech" and "X-keys: XK-12 Jog & Shuttle", or "X-keys 1: XK-24" and "X-keys 2: XK-24" when names are equal; a device that is not connected stays listed with "(not connected)". The list is hidden when there is only one choice. See The web page. The .NET client library offers the same list; see .NET client library and Hub API.

v2.0.62