Skip to main content

Multi-Board Workflows

Multiple HMCLS boards can collaborate in real time over an Ethernet network using the NET command block and the event flag system.

Network Topology​

All boards must be on the same Ethernet subnet, each with its own address:

BoardExample IP
Board A192.168.1.21
Board B192.168.1.22
Board C192.168.1.23

On a network with a DHCP server, each board receives its own address at boot; read it on the device screen. To keep the same addresses from one session to the next, reserve them in your router (DHCP reservation). Without a DHCP server, every board falls back to the same address (192.168.1.11): do not connect several boards to the same segment in that case.

Triggering Another Board​

Board A can raise a flag on Board B by sending a NET command:

Board A loop — signal Board B
NET command "192.168.1.22" "FLAG SET 1"

Board B's script waits for the flag:

Board B loop — wait for signal from A
if flag (consume) 1:
LED1 on

Python Example​

You can coordinate boards from a Python script on the PC. The example below makes this PC the owner of both boards (so that it receives their messages), starts the acquisition on both, then signals Board B when Board A reports a spike on channel 0.

multi_board_trigger.py
import socket

MY_IP = "192.168.1.50" # the IP of this PC
IP_A = "192.168.1.21"
IP_B = "192.168.1.22"
CMD_PORT = 55152
TEXT_PORT = 55153

tx = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

def send_cmd(ip: str, text: str) -> None:
tx.sendto(text.encode(), (ip, CMD_PORT))

# Listen first: replies, `say` messages and events come back on port 55153
rx = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
rx.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
rx.bind(("0.0.0.0", TEXT_PORT))
rx.settimeout(30.0)

# Take both boards and start the acquisition (SETUP is only needed if the board asks for it)
for ip in (IP_A, IP_B):
send_cmd(ip, f"DEST {MY_IP}")
send_cmd(ip, "START")
print("Acquisition started on both boards.")

print("Waiting for a spike on Board A channel 0...")
try:
while True:
data, addr = rx.recvfrom(512)
for line in data.decode(errors="replace").splitlines():
if addr[0] == IP_A and line.strip() == "spike ch0":
print("Spike detected on Board A — triggering Board B.")
send_cmd(IP_B, "FLAG SET 1")
raise SystemExit
except socket.timeout:
print("Timeout: no spike detected within 30 s.")

Board A's Loop script must send a message when a spike is detected, so that the PC can catch it (flag 33 + channel is raised by spike detection):

Board A Loop — announce spike on channel 0
if flag (consume) 33:
say "spike ch0"

Board B's Loop script reacts to flag 1:

Board B Loop — react to trigger from PC
if flag (consume) 1:
LED2 on // yellow: triggered

See NET Relay and Multi-Board Flag Coordination for the protocol-side details.