Repository navigation
Real hardware
Everything the station does goes through PyVISA and pyserial, so moving from the simulator to a real bench changes the configuration, not the code. None of this has run against a real fixture yet (see "Status" at the end) — treat it as a careful starting point, not as a validated station.
| Role | What it must do | Default commands |
|---|---|---|
psu |
set voltage and current limit, switch the output, measure V and I |
VOLT, CURR, OUTP, MEAS:VOLT?, MEAS:CURR?
|
dmm |
DC voltage | MEAS:VOLT:DC? |
mux |
close one channel at a time, report its state |
ROUT:OPEN:ALL, ROUT:CLOS (@101), ROUT:CLOS? (@101)
|
scope (optional) |
single capture on a rising edge, waveform as bytes | Keysight InfiniiVision: :SING, :OPER:COND?, :WAV:PRE?, :WAV:DATA?
|
console |
the board's serial console | any pyserial URL |
All SCPI instruments must also answer *IDN?, *RST and SYST:ERR?.
visa_backend: "" # NI-VISA / Keysight IO Libraries; "@py" for pyvisa-py
resources:
psu: "USB0::0x2A8D::0x1002::MY12345678::INSTR"
dmm: "TCPIP0::192.168.1.20::INSTR"
mux: "TCPIP0::192.168.1.21::5025::SOCKET"
scope: "TCPIP0::192.168.1.22::INSTR"
console: "/dev/ttyUSB0" # COM3 on Windows, socket://host:port for a terminal server
console_baudrate: 115200python -m pyvisa info and pyvisa-shell show which resources your VISA
library finds. Check each one by hand before the first run:
pyvisa-shell
(visa) open TCPIP0::192.168.1.20::INSTR
(TCPIP0::192.168.1.20::INSTR) query *IDN?Many supplies use channel arguments, many switch units use other channel
numbers. Derive a class from the driver in
drivers.py,
override only what differs, and name it in the config:
# my_drivers.py, next to my-station.yaml
from bench.drivers import PowerSupply
class RigolDP800(PowerSupply):
"""Channel 1 of a Rigol DP800."""
def configure(self, voltage, current_limit):
self.write(f":APPL CH1,{voltage:.3f},{current_limit:.3f}")
self.check_errors()
def output(self, on):
self.write(f":OUTP CH1,{'ON' if on else 'OFF'}")
def measure_voltage(self):
return self.query_float(":MEAS:VOLT? CH1")
def measure_current(self):
return self.query_float(":MEAS:CURR? CH1")drivers:
psu: my_drivers.py:RigolDP800The class must derive from the default driver of that role, and a wrong entry
stops bench run before the supply is switched on. If scpi-sim
has a profile of your model, try a new driver against it before you wire it
to a board.
The rails are measured one at a time through the multiplexer; the config says which channel goes to which test point and what the limits are:
rails:
- {name: "5V0", channel: 101, nominal: 5.0, tolerance_pct: 5}
- {name: "3V3", channel: 102, nominal: 3.3, tolerance_pct: 5}The driver opens all channels before it closes the next one, and checks that the channel really closed. On a real fixture, check the wiring once with a known board and a handheld meter before trusting the readings.
For the scope, channel 1 sees the input current through a current probe
(volts_per_amp is the probe's transfer factor), channel 2 one rail. Leave
the scope section out until the probe is there; the station then runs
without the scope values.
The on-device checks run shell commands over the console (free -m,
smartctl, lsusb, /sys/class/net/..., hwclock). The defaults fit the
simulated board: change device.serial_pattern, bios_version,
min_memory_mb, the USB test stick (vid_pid, expected_count), the
Ethernet interface and the temperature limit to your product. The login user
and prompt are in boot.user and boot.login_prompt.
- Run with a known-good board and look at every measurement in
report.html, not just the verdict. Tighten the limits from what good boards actually show. - Record the golden log from that board (Golden boot log).
- Provoke a few real faults if you can — pull a USB stick, unplug Ethernet — and check that exactly the expected step fails.
The sequence, the limits and the reports are tested end to end against the simulated board on Linux, Windows and macOS in CI. The drivers have not been run against real instruments: the scope commands follow Keysight InfiniiVision scopes, the others are common SCPI. Reports from real benches are welcome as issues.
bench-automation · MIT licensed · instrument names are trademarks of their owners; bench-automation is not affiliated with them.
bench-automation
Links
Related tools