
Thorlabs Optical Power Meter
io.github.K-Dense-AI由 GitHub 帳號 K-Dense-AI 發布v0.1.2更新於 Oct 24, 2026
MCP server for Thorlabs optical power meters (PM100 family, PM400, PM101, PM5020) over SCPI.
概覽
透過 SCPI 控制 Thorlabs 光功率計,讓助理讀取雷射功率、記錄穩定性並調整波長、平均次數與量程。
- 可以做什麼
- 單次讀取光功率,並讀取感測器溫度與裝置、探頭資訊
- 依時間記錄功率序列,提供平均值、標準差、RMS、峰對峰穩定度與漂移,可另存為新的 CSV 檔
- 設定校正波長、平均次數與功率量程(自動或固定)
- 對感測器做暗電流歸零,並在斷電重啟後重新連線
- 查看連線資訊、目前安全限制與原始 SCPI 指令日誌
- 適用情境
- 適合光學或光子學實驗室:桌上有 Thorlabs PM100D、PM100A、PM100USB 或 PM400 功率計時,可讓助理取讀值、分析雷射預熱或漂移、量測濾光片穿透率。也可用內建模擬器在沒有硬體時試用。
- 執行需求
- 以 Python 套件(uvx labmcp-thorlabs-pm)透過 stdio 在本機執行。需要可經 VISA/USBTMC 存取的 Thorlabs 功率計,並以位址形式提供資源字串;Windows 需安裝 NI-VISA 執行環境並用 Thorlabs 驅動切換工具,Linux 需為廠商 0x1313 設定 udev 權限,macOS 需 libusb。選用環境變數 LABMCP_ADDRESS、LABMCP_LIMITS、LABMCP_READ_ONLY、LABMCP_SIMULATE。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Thorlabs Optical Power Meter,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Thorlabs Optical Power Meter — MCP Server
Let an AI agent read laser power, log stability and warm-up drift, set the wavelength correction, averaging and range, and dark-zero the sensor on Thorlabs optical power meters through their documented SCPI command set over USB (USBTMC / VISA).
Try it without hardware
The simulator is a PM100D with an S120C photodiode (or S302C thermopile) looking at a 1.234 mW, 632.8 nm HeNe laser. Setting the wrong wavelength on the photodiode gives a proportionally wrong reading, as on the real bench.
Connect your power meter
- Driver. Thorlabs meters enumerate as USB Test & Measurement Class (USBTMC) devices, vendor ID
0x1313.- Windows: the Thorlabs driver (TLPM / Thorlabs VISA) is not visible to PyVISA. Install the free NI-VISA runtime, then switch the meter to the NI-VISA driver with the Thorlabs Driver Switcher (installed with the Thorlabs Optical Power Monitor software), and start the server with
?backend=@ivi(see below). This is the route Thorlabs documents for PyVISA. - Linux: pyvisa-py talks USBTMC directly (installed with this package). Give your user access to the device, e.g.
/etc/udev/rules.d/99-thorlabs-pm.rules: thensudo udevadm control --reload-rulesand re-plug the meter. NI-VISA also works (?backend=@ivi). - macOS: pyvisa-py + libusb (
brew install libusb); NI-VISA is an alternative.
- Windows: the Thorlabs driver (TLPM / Thorlabs VISA) is not visible to PyVISA. Install the free NI-VISA runtime, then switch the meter to the NI-VISA driver with the Thorlabs Driver Switcher (installed with the Thorlabs Optical Power Monitor software), and start the server with
- Find the resource string:
uvx labmcp ports(orpython -m pyvisa info). It looks likeUSB0::0x1313::0x8078::P0012345::INSTR(the product ID depends on the model: PM100D0x8078, PM100USB0x8072). - Test the connection:
For the second input of a PM5020 add
--option channel=2.
Add to your MCP client
Claude Code
Claude Desktop / Cursor / Windsurf (claude_desktop_config.json, .cursor/mcp.json, …)
Add --read-only to allow readings but block wavelength, averaging, range and zero changes. For other clients, generate the snippet with uvx labmcp config thorlabs-pm --address <resource> --client vscode (also cursor, codex, claude-code).
Tools
get_connection_info, get_command_log and reconnect are built into every LabMCP server.
A power meter only measures, so this server has no hazard tools. Your laser is the hazard: wear the right eyewear and never exceed the sensor's rated power or power density.
Safety limits
Override at launch: --limit max_series_duration_s=3600. One call can log at most 3640 s (the tool's timeout minus a margin): longer estimates are refused, and a series that runs slower than estimated stops early and returns what it measured (completed: false). save_path must end in .csv and must not exist yet (an existing file is never overwritten); it is checked before logging starts.
Example prompts
- "Set the meter to 1064 nm and tell me the power after the objective."
- "Log the laser power every 2 s for 10 minutes and report the RMS and peak-to-peak stability. Save the data to ~/data/laser_warmup.csv."
- "I've capped the sensor. Zero it, then I'll remove the cap and you read the power."
- "Measure the transmission of this ND filter: read the power without it, then again after I insert it, and give me the optical density."
- "Is the thermal sensor head still warming up? Read its temperature every minute until it's stable."
Notes
- Wavelength matters. Photodiode responsivity varies by a factor of several across the sensor's range, so a wrong wavelength setting gives a wrong power. The server sends whole nanometres (the PM400/PM101/PM5020 references specify an integer), so 632.8 nm is set as 633 nm. That changes the responsivity by far less than the sensor's calibration uncertainty.
- Units.
MEAS:POW?answers in the meter's configured unit (W or dBm). The driver readsSENS:POW:UNIT?first and always returns watts, so a front-panel unit change can't mislead the agent. - Out of range. The meter answers INFINITY / 9.9E37 when the signal exceeds a manually selected range. The server reports this as an error that suggests auto-ranging.
- Zeroing (
SENS:CORR:COLL:ZERO) runs in the background. The server polls…:ZERO:STAT?, checks the error queue, and returns the zero value (…:ZERO:MAGN?). Zero values are lost when the meter reboots. - Energy (pyroelectric) sensors are recognised but not supported: single-pulse energy measurement needs a trigger/fetch workflow that this server doesn't implement yet.
- Averaging is
SENS:AVER:COUN. One sample takes ~3 ms on the PM100 series and 1 ms on the PM400/PM101/PM5020. The reply timeout scales with the averaging count. - PM101 and PM5020: Thorlabs' command references for these list exactly the commands used here. The PM5020 adds a channel suffix (
SENS2,MEAS2,SYST:SENS2:IDN?), selected with--option channel=2. Neither has been tested yet, and PM5020 LAN/serial connections have not been tried. The PM100D's Windows TLPM DLL driver is not used; this server speaks SCPI only. - The simulator's error replies for out-of-range values (
-222,"Data out of range") use the standard SCPI code. The Thorlabs documents only list-113,"Undefined header"explicitly.
Hardware verification
來源:servers/physics/thorlabs-power-meter/README.md,提交 46545ea
工具
0版本歷史
2- v0.1.2最新Sep 27, 2026
- v0.1.0Sep 26, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分