Skip to content

Add Coherent FieldMaster GS power meter driver#101

Merged
dccote merged 2 commits into
masterfrom
device/coherent-fieldmaster-powermeter
Jul 6, 2026
Merged

Add Coherent FieldMaster GS power meter driver#101
dccote merged 2 commits into
masterfrom
device/coherent-fieldmaster-powermeter

Conversation

@dccote

@dccote dccote commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a driver for the Coherent FieldMaster GS laser power/energy meter, which connects over RS-232 through a generic FTDI adaptor. Verified end-to-end against real hardware (reads ~4.6 W from an LM-10 thermopile head).

  • FieldMasterDevicePowerMeterDevice subclass driven through the library's SerialPort primitives.
  • DebugFieldMasterDevice — hardware-free stub (classIdVendor=0xFFFF, classIdProduct=0xFFF1).
  • tests/testFieldMasterDevice.py — 6 debug tests (always run) + 2 hardware tests (skipTest when the meter is absent / not on its Home screen).
  • FieldMaster GS manual added under hardwarelibrary/manuals/.
  • CHANGELOG.md entry under Unreleased.

Protocol (verified)

  • 9600 baud, N/8/1, no handshaking — the meter wires only TxD/RxD/GND (3-wire).
  • Commands: pw? (power, W), en? (energy, J), wv?/wv <m> (wavelength), v (version).
  • Wavelength is exposed in nanometres (family convention) and converted to metres on the wire.

Two operational constraints worth knowing

  1. Home screen only. The meter processes RS-232 only while on its Home or Trend screen; otherwise it silently buffers. doInitializeDevice probes on connect and raises with that hint. (Do not send it h/q — they navigate it off Home and wedge the serial firmware until a power cycle.)
  2. Terminator is a Menu setting (LF / CR / CR-LF). Pass it as terminator= (default b'\n'); it is applied to port.terminator, which both reads and writes use, so they stay in sync with the meter's Menu.

Usage

from hardwarelibrary.powermeters import FieldMasterDevice

meter = FieldMasterDevice(serialNumber="FTFDLOTS")   # terminator=b'\r\n' if Menu is CR-LF
meter.initializeDevice()
print(meter.measureAbsolutePower())        # watts
print(meter.getCalibrationWavelength())    # nm
meter.shutdownDevice()

Test plan

  • pytest hardwarelibrary/tests/testFieldMasterDevice.py → 6 passed, 2 skipped (no/absent hardware)
  • Live read against the physical meter (LF and CR-LF terminators both read ~4.60 W; CR correctly refused since the unit's Menu is LF)

🤖 Generated with Claude Code

dccote and others added 2 commits July 6, 2026 12:53
Problem: The lab's Coherent FieldMaster GS laser power/energy meter connects
over RS-232 through a generic FTDI adaptor and had no driver. The meter has
several non-obvious operational constraints (it only answers RS-232 from its
Home/Trend screen, and its message terminator is a front-panel Menu setting)
that make it easy to get wrong.

Solution: Add FieldMasterDevice, a PowerMeterDevice subclass driven through
the library's SerialPort primitives, plus a hardware-free DebugFieldMasterDevice
and a test file (debug tests always run; hardware tests skipTest when the meter
is absent or not on its Home screen). Protocol verified against real hardware:
9600 8N1, no handshaking (3-wire), configurable terminator routed through the
port's terminator, pw?/en?/wv?/v commands. Wavelength is exposed in nanometres
(family convention) and converted to metres on the wire. The FieldMaster GS
manual is added under hardwarelibrary/manuals/ and the change is recorded in
CHANGELOG.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem: The FieldMaster's message terminator (LF/CR/CR-LF) is a front-panel
Menu setting. Hardcoding it meant a unit whose Menu differed from the driver's
assumption would silently fail to initialize even though it was connected and
on its Home screen.

Solution: doInitializeDevice now probes for the terminator. It tries the
configured terminator first (default LF), then the remaining candidates,
clearing the meter's line buffer between attempts, and keeps the first one that
draws a reply on the port. Only when none replies does it raise the
Home-screen hint. Verified on hardware: a deliberately wrong default falls
through to the working terminator and still reads power.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dccote
dccote merged commit b1cf98a into master Jul 6, 2026
14 checks passed
@dccote
dccote deleted the device/coherent-fieldmaster-powermeter branch July 6, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant