relay-usb
The relay-usb driver switches the channels of a CH340-based USB relay board,
the kind that shows up on the bench as a USB serial port. Use it to press a
DUT's buttons, cut its power, or drive a test point.
| Property | Value |
|---|---|
kind | relay-usb |
| Interfaces | relay |
location | The board's /dev/serial/by-id/ path |
Example
button_relay:
kind: relay-usb
name: "USB Relay for Buttons"
description: "Drives the DUT's front-panel buttons"
location: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
interfaces:
- type: relay
channel: 0
config:
channels:
- { number: 1, name: "Power button" }
- { number: 2, name: "User button" }
- { number: 3, name: "Trigger 1" }
- { number: 4, name: "Trigger 2" }
Location
Use the board's /dev/serial/by-id/ path, which mimick peripheral list shows
for every USB serial device the bench detects. CH340 boards report the USB ID
1a86:7523, so their path usually starts with usb-1a86_.
Relay
The relay interface takes a channels list with at least one entry. Each
entry maps a relay on the board to the name you address it by:
| Key | Required | Allowed values |
|---|---|---|
number | Yes | 1 to 4, each used once |
name | Yes | Any label |
A relay you leave out of the list isn't available.
After every write, the bench reads the board's status back and checks that the relay changed state. A stuck relay returns an error instead of reporting success.
Use it
mimick relay list -p button_relay
mimick relay write -p button_relay 1 on
mimick relay write -p button_relay 1,2 off,off
Channels are numbers or names. In the web UI, select Open relay controls on the peripheral's row in the bench's Inventory tab.
mimick relay name renames a channel only until the peripheral reopens, for
example after the bench restarts. To keep a name, set it in the file.