Fail-safe interlocks for an automated test bench
Normally-closed everything
Order of operations in a trip
Rearming without surprises
A snippet from the implementation
Straight from the example as deployed on the Raspberry PLC 19R — copy it freely:
def init_plc():
rpiplc.init("RPIPLC_19R")
for pin in (I_MICROFUSES, I_EMERGENCY_STOP, I_SUPPLY_TEST_END):
rpiplc.pin_mode(pin, rpiplc.INPUT)
for pin in (R_GREEN_BEACON, R_RED_BEACON):
rpiplc.pin_mode(pin, rpiplc.OUTPUT)
rpiplc.digital_write(pin, rpiplc.LOW)The full example is a complete program — wiring header, setup and main loop — ready to adapt to your application.
Frequently asked questions
Is a software interlock enough for a real machine?
It complements, never replaces, hardware protection. The bench keeps its hardwired e-stop contactor chain; the PLC layer adds fast supervision, diagnostics and a clean shutdown of the SCPI source.
Why monitor the supply's end-of-test output as an interlock?
The Sorensen XG asserts it when its internal test sequence ends or faults. Treating it like a trip means the PLC and the supply can never disagree about whether power should be flowing.
What does the rpiplc library add over plain GPIO?
It maps the industrial terminals of the Raspberry PLC (I0.x inputs, R0.x relays) to named calls like digital_read("I0.2"), handling the optocoupled 24 V input stages and relay drivers for you.