owon-spe6103-mcp

owon-spe6103-mcp

MCP server for reading and controlling an OWON SPE6103 programmable DC power supply over USB serial, with safety checks and verified SCPI commands.

Category
访问服务器

README

owon-spe6103-mcp

An MCP server that lets an AI assistant read and control an OWON SPE6103 programmable DC power supply (60 V / 10 A / 300 W) over its USB serial port.

Built and verified against real hardware.

*IDN?  ->  OWON,SPE6103,24371986,FV:V5.2.0

Why

Bench work often means "set 16 V, limit 0.5 A, turn it on, watch the current". Doing that by hand breaks your flow, and it is exactly the kind of thing an assistant can do while you keep both hands on the hardware. This server exposes the supply as five small tools, with the dangerous one clearly marked.

Tools

Tool What it does
psu_status Model, port, setpoints, live measurement, output state, protection limits. Read only.
psu_measure Live voltage / current / power only. Cheap, for polling.
psu_set(volt, curr) Sets output voltage and current limit. Does not change the output on/off state.
psu_output_on Actually energises the terminals. Reads back immediately and warns if the current is pinned at the limit (short or reversed polarity).
psu_output_off Turns the output off. Setpoints are kept.

Safety design

  • Anything above 60 V or 10 A is rejected before it is sent to the instrument.
  • psu_set never flips the output on. You set values first, then energise — in that order.
  • psu_output_on says so in its own description, so an assistant reading the tool list knows it is not a read-only call.
  • After energising, the measured current is compared against the limit. Pinned at the limit means a short or reversed polarity, and you get told.
  • The serial port is opened and closed per call, so this does not fight with other tools for the port.

This does not replace a physical means of cutting power. Software paths fail.

Requirements

  • Python 3.10+
  • pyserial
  • mcp (the official Python SDK; FastMCP ships inside it)
pip install pyserial mcp

Connection

The SPE6103 appears as a CH340 USB serial device (VID:PID 1A86:7523). The server finds it automatically. To pin it down:

PSU_PORT=COM8      # Windows
PSU_PORT=/dev/ttyUSB0

Wire protocol, confirmed on hardware: SCPI, 115200 8N1, commands terminated with \n, replies with \r\n.

Install

claude mcp add --scope user psu -- python /path/to/server.py

Then restart your client so the tools appear.

Verified SCPI commands

Command Meaning Example reply
*IDN? Identify OWON,SPE6103,24371986,FV:V5.2.0
VOLT? / VOLT <v> Voltage setpoint 16.000
CURR? / CURR <a> Current limit setpoint 0.500
VOLT:LIM? Over-voltage protection 40.000
CURR:LIM? Over-current protection 10.200
MEAS:VOLT? MEAS:CURR? MEAS:POW? Live measurement 0.000
MEAS:ALL? Live voltage and current 0.000,0.000
OUTP? / OUTP ON / OUTP OFF Output state OFF

SYST:STAT? returns ERR on this firmware. Do not use it.

Two gotchas, both measured on hardware

1. Read replies with read_until(b"\n"), not a fixed byte count. A fixed-size read waits out the full timeout on every query, which turns a 5 ms exchange into an 800 ms one — enough to break a one-second sampling loop.

2. Do not measure immediately after OUTP ON or a setpoint change. The output ramps, and the instrument's own measurement only refreshes about every 0.3 s. Asking for 16 V and reading straight away gives you 2.5 V. Measured ramp, no load:

0.11s  0.000      0.92s  12.010
0.27s  0.160      1.08s  15.690
0.43s  0.160      1.40s  15.960
0.59s  6.150      1.56s  16.000   <- settled
0.75s  6.150

Note the repeated values. Because the reading refreshes slower than you can poll, two identical samples do not mean settled — a naive "wait until two reads match" detector latches onto 0.160 or 6.150 and reports a mid-ramp value as final. This server waits 1.2 s, then polls slower than the refresh (0.35 s) and requires three consecutive matching samples.

This matters beyond cosmetics: with a capacitive load, inrush during the ramp will sit at the current limit, and a naive reader will report it as a short.

Other OWON SPE/SPM models most likely speak the same dialect, but only the SPE6103 has been tested.


日本語

OWON SPE6103(60V / 10A / 300W のプログラマブル直流電源)を、USB のシリアル経由で 読み書きするための MCP サーバーです。実機で確認しながら作りました。

道具

道具 内容
psu_status 機種・ポート・設定値・実測・出力の入切・保護値。読むだけ
psu_measure 実測(電圧・電流・電力)だけ。軽いので見張りに使う
psu_set(volt, curr) 電圧と電流制限を設定する。出力の入切は変えない
psu_output_on **実際に電気が出る。**直後に実測を読み、電流が制限に張り付いていれば短絡・逆接の疑いとして警告する
psu_output_off 出力を切る。設定値は残る

安全のきまり

  • 60V / 10A を超える指示は、機器に送る前に断る
  • psu_set は出力を入れない。値を決めてから入れる、という順序を守れる
  • psu_output_on は説明文の先頭で「実際に電気が出る」と明示している
  • 入れた直後に実測を読み、電流が制限に張り付いていれば警告する
  • ポートは呼び出しごとに開閉するので、他の道具と取り合わない

これは電源を物理的に切る手段の代わりにはなりません。 ソフトの経路は落ちます。

接続

CH340 の仮想シリアル(VID:PID 1A86:7523)として見えます。自動で探しますが、 PSU_PORT で固定もできます。通信は SCPI / 115200bps 8N1、送りは \n、返しは \r\n。

罠(どちらも実機で測って分かったこと)

**1. 応答は read_until(b"\n") で読むこと。**バイト数を決めて読むと、その数が来ないので 毎回タイムアウトを待ち切ります。5ms で済む問い合わせが 800ms になり、 1秒ごとの記録が崩れます。

2. 出力を入れた直後・設定を変えた直後に、そのまま実測を読まないこと。 出力はゆっくり立ち上がり、しかも機器側の実測の更新が約0.3秒ごとです。 16V を指示した直後に読むと 2.5V が返ります。無負荷での立ち上がりの実測:

0.11s  0.000      0.92s  12.010
0.27s  0.160      1.08s  15.690
0.43s  0.160      1.40s  15.960
0.59s  6.150      1.56s  16.000   ← 到達
0.75s  6.150

同じ値が2回続いているところに注意してください。更新より速く読むとこうなるので、 「2回同じなら落ち着いた」という判定は途中の値を掴みます(0.160 や 6.150 で止まる)。 このサーバーは 1.2 秒待ってから、更新より遅い 0.35 秒間隔で、3回続けて一致を見ています。

これは見た目の問題では済みません。容量のある負荷では、立ち上がり中の突入電流が 電流制限に張り付くので、素直に読むと「短絡」と誤判定します。

SYST:STAT? はこの版では ERR を返すので使いません。

ライセンス

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选