Python scripts
Small command-line tools for every supported host-side operation.
Setup
Place all Python files in one directory. They share opentag_serial.py.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
Download all scripts · requirements.txt · opentag_serial.py
python3 list_ports.pyRead device info
Requests role, firmware, ID, PHY configuration, counters, and calibration.
Download info.pypython3 info.py /dev/tty.usbmodem1101python3 monitor.py /dev/tty.usbmodem1201
python3 monitor.py /dev/tty.usbmodem1201 --csv live.csvCalibrate a pair
Uses the responder stream, trims the outer 10%, writes the new DTU offset, and saves it by hardware ID.
Download calibrate.pypython3 calibrate.py /dev/tty.usbmodem1201 \
--true-mm 1000 --samples 100The firmware command changes RAM. This script also stores the offset in ~/.config/opentags/calibration.json; the other host scripts reapply it whenever they connect.
Run a static test
Collects a timed responder stream and writes metadata, summary metrics, every sample, exchange time, and RSSI.
Download static_test.pypython3 static_test.py /dev/tty.usbmodem1201 \
--true-mm 5000 --seconds 60 --output test-5m.csvFlash firmware
Downloads the current role image and flashes one STM32 DFU device with dfu-util.
chmod +x flash.sh
./flash.sh initiator
./flash.sh responderThe downloaded image contains the default offset. Run calibrate.py, or reconnect through the browser console, after flashing the responder.