Control your DUT with GPIO and relays from the CLI
A bench can reach into your DUT's hardware through GPIO pins and relays: it can
hold a boot strap, press a button, or switch power. This guide shows how to
check each pin or relay channel with the mimick CLI, change it, and put it
back.
What each pin or channel does depends on how your bench is wired to your DUT. Your org admin gives them names in the bench's peripheral config, so the names tell you what they're for.
Prefer the browser? See Control your DUT with relays in the web app.
What you need
- Operator access to the bench
- A GPIO peripheral (
ftdi-ft232h,mimick-hwi) or relay board (relay-usb,relay-esphome) on the bench, wired to your DUT
Changes reach your DUT immediately and affect anyone using it.
Step 1 · Pick your bench
Make the bench wired to your DUT the active bench:
mimick bench use <your-bench>
Later commands target this bench until you pick another one. To target a
different bench for a single command, pass --bench <your-bench> instead.
Step 2 · Find the peripheral
List the GPIO and relay peripherals on the bench:
mimick peripheral list | grep -E 'LOCATION|\.(gpio|relay)'
A GPIO peripheral's location ends in .gpio and a channel number, usually
.gpio0 (.gpio1 on a MIMICK HWI v2), and a relay board's ends in .relay0. The NAME column tells you which is which, and STATUS must be
present. You pass the location to every command below with -p, for example
-p buttons.relay0.
Step 3 · Control a relay
-
List the relay's channels and their current state:
mimick relay list -p <location>Note the state of the channel you want, so you can put it back later.
-
Switch the channel on or off. Use the channel's number or its name, and quote a name that has spaces:
mimick relay write -p <location> '<channel>' onThe CLI prints the channel number and its new state, such as
3=on. -
Read the channel back at any time:
mimick relay read -p <location> '<channel>' -
When you're done, put the channel back the way you found it:
mimick relay write -p <location> '<channel>' offWhen a channel has a name, you can leave out
-p: the CLI finds the relay that carries it, for examplemimick relay write 'Power button' on. A number still needs-p, because every relay starts at channel 1.

Step 4 · Control a GPIO pin
-
List the pins and check which ones are outputs:
mimick gpio list -p <location>The DIR column shows
outputfor a pin you can set, andinputfor a pin that only reports what your DUT is doing. -
Read the pin's current level, and note it so you can put it back later:
mimick gpio read -p <location> '<pin>' -
Set the pin. Use the pin's number or its name, and quote a name that has spaces. The level is
highorlow, andonoroffworks too:mimick gpio write -p <location> '<pin>' low -
Read the pin again to confirm the change.
mimick gpio writeprints the level you asked for, andmimick gpio readreports what the pin is at. -
When you're done, put the pin back the way you found it:
mimick gpio write -p <location> '<pin>' highA pin with a name works without
-ptoo, for examplemimick gpio write reset_n low. A bench does not accept a config where two pins, or two relay channels, share a name, so the name finds one interface. On an older bench that still has such a config, the CLI lists the interfaces that share the name and asks you to pass-p.

Only write to pins that mimick gpio list shows as output. Writing to an
input pin turns it into an output, so the bench starts driving a line your
DUT may be driving too.
An output stays where you set it after the command ends, until you or someone else changes it.
The names, the pins, and the channels depend on how your bench is set up, so yours won't match these examples.
If it doesn't work
| What you see | What to do |
|---|---|
not signed in | Run mimick auth login. |
no active bench | Run mimick bench use <your-bench>, or pass --bench. |
the bench "<name>" is offline | Check that the bench has power and a network connection. It shows as connected in mimick bench list once it's back. |
not authorized for that bench | Ask your org admin for the Operator grant on the bench. |
The peripheral shows as missing in mimick peripheral list | The bench can't reach the GPIO or relay board. Check its cable, or its network connection for a networked relay. |
unknown pin or unknown relay | The name doesn't match. The message lists the names you can use. |
| The command works, but your DUT doesn't react | The pin or channel may not be wired to the part of the DUT you expect. Ask your org admin to check the bench's wiring and config. |
Related
- Control your DUT with relays in the web app
- Open a serial console from the CLI, to watch how your DUT reacts
- Peripherals & interfaces
- Identity & access