rf-bench-drivers-arduino-relay-board
Python driver for the Arduino+W5500 network-controlled 4-channel relay
board. See hardware/arduino-relay-board/
for the firmware.
Status: ✅ tested on hardware 2026-06-25 against the board running at
10.1.1.36. Full acceptance test inhardware/arduino-relay-board/test_relays.pypasses against the shipped firmware.
Install
pip install -e ~/Dropbox/build/rf-bench/drivers/arduino-relay-board
Once published to PyPI:
pip install rf-bench-drivers-arduino-relay-board
Quick start
from rf_bench.arduino_relay_board import ArduinoRelayBoard
with ArduinoRelayBoard("10.1.1.36") as r:
print(r.idn()) # N0GQ,ArduinoRelayBoard,1.0,2026,id=1
r.on(1) # energize relay 1
r.on(3) # energize relay 3
print(f"{r.status():04b}") # → "0101" (relays 1 and 3 on)
r.pulse_high(2, 250) # energize relay 2 for 250 ms, then off
print(r.get_state(1)) # → True
print(r.status_all()) # → (True, False, True, False)
r.off(1)
r.reset() # all off
API
class ArduinoRelayBoard:
NUM_RELAYS = 4
def __init__(self, host, port=5025, timeout=2.0, auto_connect=True): ...
def connect(self) -> None
def close(self) -> None
def idn(self) -> str
def help(self) -> str
def on(self, relay: int) -> None # relay = 1..4
def off(self, relay: int) -> None
def pulse_high(self, relay: int, duration_ms: int) -> None
def pulse_low(self, relay: int, duration_ms: int) -> None
def get_state(self, relay: int) -> bool
def status(self) -> int # bitmask, bit 0 = relay 1
def status_all(self) -> tuple[bool, ...] # length 4
def reset(self) -> None
def all_off(self) -> None # alias for reset()
All methods are thread-safe — internal threading.Lock serializes
access to the TCP socket.
Errors
ArduinoRelayBoardError— board returnedERR: …, or the socket was closed unexpectedly.ArduinoRelayBoardTimeoutError— no response withintimeoutseconds. Subclass ofArduinoRelayBoardError.ValueError— bad relay index (not 1..4) or non-positive duration.
Pulse semantics
pulse_high(n, ms) and pulse_low(n, ms) return immediately. The
board schedules the revert internally using millis(), so the timed
behaviour is independent of network latency or Python-side scheduling.
pulse_high(1, 30000)— relay 1 energized now, de-energized 30 s later. The driver returns in milliseconds; the board handles the delay.pulse_low(1, 250)— relay 1 de-energized now, re-energized 250 ms later. Useful when a relay was previously commandedON.
A subsequent on(), off(), or pulse_*() on the same relay cancels
any pulse in flight.
Related
hardware/arduino-relay-board/— board firmware.drivers/relay/— XL9535 I²C 16-channel relay expander (different hardware: local I²C via Bus Pirate, not Ethernet).projects/esp32/scpi-relay/— ESP32+WiFi equivalent.
License
GPL-3.0-or-later, same as the rest of rf-bench.
Metadata
Release files for rf-bench-drivers-arduino-relay-board 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rf_bench_drivers_arduino_relay_board-0.1.0.tar.gz | 18.4 kB | Without provenance | Details for rf_bench_drivers_arduino_relay_board-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rf_bench_drivers_arduino_relay_board-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rf_bench_drivers_arduino_relay_board-0.1.0-py3-none-any.whl |
Total release size: 37.4 kB
Release files / rf_bench_drivers_arduino_relay_board-0.1.0.tar.gz
| Download URL | rf_bench_drivers_arduino_relay_board-0.1.0.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28500cd0e7cf16d9f1e5ef3bb49594964f8df5e2d062fd9ca95acbaed838a354
|
|
BLAKE2b-256 checksum How to use checksums |
236226b6c71639c4f417f1fb2409e19f6b6e41d3a662798fac0826c362bf8338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / rf_bench_drivers_arduino_relay_board-0.1.0-py3-none-any.whl
| Download URL | rf_bench_drivers_arduino_relay_board-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8ca55d6e9949fb928234328092b6e82e6348f76586d724202dbe7d643d29603
|
|
BLAKE2b-256 checksum How to use checksums |
7a5d848623458fdf00918b0d10171c66e0370d810fc878e02265f368c7421f2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for rf-bench-drivers-arduino-relay-board 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.