在浏览器里直接调设备。
Talk to industrial devices from a browser tab.
串口 · WebUSB · WebSocket · MQTT · Modbus RTU · HART · 自定义协议
![]() AOMaster 4-20 mA / 0-10 V 6 种波形 |
![]() HART 通用仪表调试 PV / SV / TV / QV |
![]() WebSocket JSON / HEX / Modbus 实时曲线 |
![]() MQTT 发布 / 订阅 · QoS 保留消息 · 统计 |
浏览器里的设备调试台,纯静态前端,没有上位机要装、没有后端要起。打开网页、选设备、连上、看原始报文、手动发命令、看实时曲线,就这样。
一个标签页,一根线,跟设备直接对话。
- 临时调一块 Modbus RTU 板子,不想装某厂家 200MB 的上位机
- 进车间带个 USB 转 485,笔记本插上就是 HART 调试工具
- 新设备走 WebSocket 或 MQTT,想边看流量边看曲线
- 调 RP2040 WebUSB 小电流采集,不想单独装桌面上位机
- 把链接发给同事,比发
setup.exe省事 - 内部协议没有现成工具,用 自定义设备 页面拼一个,不用写 JS
不适合:长时间数据采集、生产监控、SCADA。这是个调试工具。
| 设备 | 传输 | 默认参数 | 说明 |
|---|---|---|---|
| AOMaster | 串口 | 115200 8N1 | 4-20mA / 0-10V 信号源,6 种波形 |
| Modbus RTU | 串口 | 9600 8N1 | 读写保持 / 输入寄存器 |
| HART | 串口 | 1200 8O1 | 设备搜索、通用命令、PV/SV/TV/QV |
| WebSocket | WebSocket | — | JSON / HEX / Modbus 报文调试 |
| MQTT | MQTT over WS | — | 发布订阅、QoS、保留消息、统计 |
| MicroScope Power | WebUSB | VID 0xCAFE, PID 0x4012 |
RP2040 小电流波形采集、游标、校准、CSV/PNG 导出 |
| 自定义设备 | 任意 | — | 模板 + 解析规则,无需写代码 |
普通设备切换时通讯方式和参数会跟着自动切换。MicroScope Power 这类独立 WebUSB 工具会在设备页内部保留自己的连接和采集控制。
开发模式不用构建,起一个静态服务即可:
python -m http.server 4173用 Chrome / Edge 打开 http://localhost:4173。
要发布的话:
npm install
npm run build
npm run preview构建脚本是 scripts/build.mjs(基于 esbuild),产物在 _site/。
适合在笔记本、工控机或现场环境拷贝一份,无需联网拉代码。
获取离线包
- 每次推送到
main:打开 Actions → Offline package,在最新一次运行里下载 Artifactmodusignal-offline-<版本>.zip。 - 打
v*标签发布:在 Releases 下载modusignal-offline-<标签>.zip。
本地运行
解压后双击 start-modusignal.bat(Windows)或运行 start-modusignal.sh(macOS/Linux),会自动起服务并打开浏览器。
也可手动执行:
python -m http.server 4173用 Chrome / Edge 打开 http://localhost:4173。串口和 WebUSB 功能需在 localhost 或 HTTPS 下使用。
自己打包
npm install
npm run build:offline产物在 _release/modusignal-offline-<版本>.zip(系统无 zip 命令时为 .tar.gz)。解压目录内的 OFFLINE.txt 有简要说明。
| 功能 | 浏览器 |
|---|---|
| 串口(Web Serial) | Chrome / Edge 89+,需要 HTTPS 或 localhost |
| WebUSB | Chrome / Edge,需要 HTTPS 或 localhost |
| WebSocket | 现代浏览器都行 |
| MQTT over WebSocket | 现代浏览器都行 |
Firefox 和 Safari 没有 Web Serial / WebUSB,串口和 WebUSB 设备用不了,其它功能正常。
英文版的 Architecture 表已经列得很清楚了,这里不重复。简单说就是:设备层和传输层分开,加新设备 = 写一个驱动 + 注册 + 加一个页面。像 MicroScope Power 这种自己管理 WebUSB 和曲线的专用上位机,可以在注册表里标记为 standalone,详见 CONTRIBUTING.md。
硬件、电路与外壳介绍见 MicroScope Power 立创开源项目,固件源码见 MicroScope-Power。
MicroScope Power 页面嵌入了 pages/devices/microscope-power/ 下的浏览器上位机。它直接通过 WebUSB 连接 RP2040 固件(VID 0xCAFE、PID 0x4012),页面内自带采样率、ADS8866 ADC 采集、曲线缩放平移、游标、校准、CSV/PNG 导出。
使用时通过 localhost 或 HTTPS 用 Chrome / Edge 打开站点,在设备库选择 MicroScope Power,再在内嵌上位机里点击 连接设备。这里没有打包原项目的 Pico 固件、SDK 和构建产物,上位机源码和回归测试只在此仓库维护,MicroScope-Power 仓库仅保留固件。采集工具栏保持单行,电流读数、游标、零点偏移和 CSV 都使用 µA。
网页已同步 MicroScope-Power 的采集可靠性优化:USB 命令确认与超时处理、精确窗口统计与包络、按设备时间戳绘图及导出、丢帧断点和 ADC/时序诊断。连续帧按相邻设备时间戳估算采样间隔,时序延迟不会在每帧末尾画出空白;真正丢帧仍显示断点。切换采样率会清空旧缓存并开始新采集段。保留了本站的固件更新检查;新增回归测试随 npm test 运行。
显示设置 → 低通滤波 提供一阶数字低通,默认关闭。可选择 10 Hz 至 20 kHz 的常用截止频率,或自定义 1–45000 Hz;超出实际采样率 45% 时显示受限后的有效频率。滤波按设备时间轴估算的采样间隔作用于每个样本,曲线、游标、统计和低通 CSV 使用同一结果,缩放和平移不会改变截止频率。低通 CSV 另含原始电流与实际截止频率列,并可独立导出原始 CSV。归零仍使用原始 ADC 数据。降低截止频率会衰减短脉冲、增加响应延迟,数字滤波不能消除已经混叠或饱和造成的信息损失。
曲线支持左键拖框同时放大时间轴和电流轴,右键拖动平移,双击恢复最新波形与自动 Y 轴。滚轮仍可缩放时间轴,Ctrl/Alt + 滚轮缩放电流轴;启用游标后,左键单击设置 A/B,拖动仍用于框选。
功率与能量:固件 0.2.2 起上传输出端实测电压,上位机约每 0.5 秒读取一次,以最近的有效电压和原始校准电流计算功率、累计能量与平均功率。电压为低速检测,功率与能量均标为估算;电压过期或丢失的采样时段不补算。旧固件可手动填入负载端供电电压。滤波、视图缩放和暂停显示不会影响累计;重新采集、清屏、校准、手动电压或电压模式改变会重新统计,亦可独立重置和导出统计 CSV。保留有符号电流,避免将零点负噪声截断为正向能量。
| 地址 | 读写 | 含义 |
|---|---|---|
| 0x0000 | R/W | 信号类型(电流 / 电压) |
| 0x0001 | R/W | 波形:0=恒定 1=阶跃 2=斜坡 3=方波 4=三角 5=正弦 |
| 0x0002 | R/W | 设定值 / 低值 |
| 0x0003 | R/W | 高值 / 阶跃保持时间 |
| 0x0004 | R/W | 周期 20–65535 ms / 阶跃循环次数(0=无限) |
| 0x0005 | R/W | 占空比 × 10 |
| 0x0006 | R | 固件输出指令值(回读,非模拟量实测) |
| 0x0007+ | R/W | 步进序列值 |
上位机用 01 03 00 00 00 07 04 08 读取 0x0000..0x0006。回包必须包含全部 7 个寄存器;0x0000 选择电流/电压单位,0x0006 是固件最近请求输出的指令值,不能证明 DAC 已发送成功或模拟输出已到达该值。模拟量原始值按 1000 缩放:原始值 10600 在电压模式表示 10.600 V,在电流模式表示 10.600 mA。回读曲线的 Y 轴会随回包类型切换为 0..10 V 或 4..20 mA。
斜坡、方波、三角波和正弦波周期限制为 20..65535 ms,以 1 ms 步进,设定频率为 1000 / 周期(ms),最高 50 Hz;周期 0 与固件一致恢复为默认 1000 ms,其余超出范围的输入在预览及发送前统一限幅。阶跃单步保持范围仍为 1..65535 ms,循环次数 0 表示无限循环,先写 0x0007+ 序列值,再写头部寄存器。
默认轮询周期 50 ms(约 20 点/秒),用于低速指令值回读,不能还原 50 Hz 波形。设定预览是理想数学曲线;频率、抖动、幅值及模拟输出建立时间需通过示波器或采集设备验证。
不想写 JS 也能配一个驱动出来:
- 输出范围、单位、步长
- 发送模板,支持
{value}、{value:2}、{unit}占位符 - 解析规则:正则、JSON 路径、HEX 偏移、Modbus 载荷
- 数值换算:
解析值 × 比例 + 偏移
仍在持续迭代。新设备和解析能力会陆续加进来,欢迎在 issues 里讨论你想要的功能。需要新设备但不方便自己写驱动的,提一个 issue 附上协议文档、报文样例和默认连接参数即可。
欢迎 PR 增加设备或修复驱动,提交前请看 CONTRIBUTING.md。
如果 modusignal 帮你省下了一个下午跟厂家上位机较劲的时间,点个 star 能让更多人看到它。
A static web app for debugging serial / WebUSB / WebSocket / MQTT devices from a browser. No installer, no backend, no database. Open the page, pick a device, connect, and you get raw frames, manual send, parsed values, and a real-time chart.
Open a tab. Plug in a device. Talk to it.
- Bench-test a Modbus RTU board without firing up a 200 MB vendor tool
- Walk into a plant with a USB-to-485 dongle and a laptop, and you have a HART debugger
- Bring up a new MQTT/WebSocket-speaking device and watch traffic on a live curve
- Capture RP2040 WebUSB current waveforms without installing a desktop host
- Hand a colleague a URL instead of a
setup.exe - Build a quick UI for an in-house protocol with the Custom device page (no JS required)
Not what it's for: long-running data acquisition, plant monitoring, anything you'd actually call SCADA.
| Device | Transport | Default | Notes |
|---|---|---|---|
| AOMaster | Serial | 115200 8N1 | 4-20 mA / 0-10 V signal source, 6 waveforms |
| Modbus RTU | Serial | 9600 8N1 | Read / write holding & input registers |
| HART | Serial | 1200 8O1 | Device search, universal commands, PV/SV/TV/QV |
| WebSocket | WebSocket | — | JSON / HEX / Modbus message debug |
| MQTT | MQTT over WS | — | Pub / sub, QoS, retain, message stats |
| MicroScope Power | WebUSB | VID 0xCAFE, PID 0x4012 |
RP2040 current waveform capture, cursors, calibration, CSV/PNG export |
| Custom | any | — | Template + parser, no code |
Switching regular devices also switches the transport and its defaults. Standalone WebUSB tools, such as MicroScope Power, keep their own connection and capture controls inside the device page.
Serve the repo as static files:
python -m http.server 4173Open http://localhost:4173 in Chrome or Edge. That's it — no install, no build.
To produce a deployable build:
npm install
npm run build
npm run previewThe build script is scripts/build.mjs (esbuild). Output goes to _site/.
Use this when you want a self-contained copy on a laptop or a plant PC without cloning the repo.
Download
- Push to
main: open Actions → Offline package, pick the latest run, download the artifactmodusignal-offline-<version>.zip. - Tagged release (
v*): downloadmodusignal-offline-<tag>.zipfrom Releases.
Run locally
Double-click start-modusignal.bat (Windows) or run start-modusignal.sh (macOS/Linux). It starts a local server and opens the browser.
Or manually:
python -m http.server 4173Open http://localhost:4173 in Chrome or Edge. Web Serial and WebUSB need localhost or HTTPS.
Build the zip yourself
npm install
npm run build:offlineOutput: _release/modusignal-offline-<version>.zip (or .tar.gz if zip is not installed).
| Feature | Browsers |
|---|---|
| Serial (Web Serial API) | Chrome / Edge 89+, HTTPS or localhost |
| WebUSB | Chrome / Edge, HTTPS or localhost |
| WebSocket | any modern browser |
| MQTT over WebSocket | any modern browser |
Firefox and Safari don't ship Web Serial or WebUSB, so serial and WebUSB devices won't work there. Everything else works.
index.html app shell (topbar, sidebar, mount points)
pages/
home.html home and device grid
request.html new-device request form
devices/ one HTML page per device
devices/microscope-power/
standalone MicroScope Power WebUSB host assets
shared/workbench.html shared log + chart panel
src/
app.js state, routing, events, device orchestration
protocols.js command / telemetry dispatch
device-registry.js device registry
page-loader.js async HTML fragment loader
chart.js Canvas 2D real-time chart
echarts-charts.js ECharts waveform preview
config.js app metadata
transports/ serial / websocket / mqtt sessions
devices/ per-device drivers
modbus/modbus.js Modbus RTU framing
hart/hart.js HART framing
framing/ generic frame parsing (lines, header/tail, CRC16)
Devices and transports are kept separate. Adding a new device is usually: a driver file in src/devices/, an entry in device-registry.js, and a page in pages/devices/. Dedicated browser-tool pages can be registered as standalone when they own their transport and UI, as MicroScope Power does. See CONTRIBUTING.md for details (the contributing guide is in Chinese).
Find the hardware, circuit and enclosure details on the MicroScope Power OSHWHub project, and firmware sources in MicroScope-Power.
The MicroScope Power page embeds the browser host from pages/devices/microscope-power/. It talks directly to the RP2040 firmware over WebUSB (VID 0xCAFE, PID 0x4012) and keeps its own controls for sample rate, ADS8866 ADC capture, chart zoom/pan, cursors, calibration, and CSV/PNG export.
Use Chrome or Edge from localhost or HTTPS, then choose MicroScope Power in the device library and click Connect device inside the embedded host. The Pico firmware, SDK, and build outputs from the source project are not bundled here; this repository is the sole home for the browser host and its regression tests, while MicroScope-Power contains the firmware. The capture toolbar stays on one row; readings, cursors, zero offsets, and CSV data use µA.
The host includes MicroScope-Power capture reliability improvements: acknowledged USB commands with timeouts, exact window statistics and envelopes, device timestamps for plotting and export, discontinuities for dropped frames, and ADC/timing diagnostics. Consecutive frames use their measured start-time interval, so timing delays do not produce an empty strip at every frame boundary; genuine dropped frames still break the trace. Changing the sample rate clears the buffer and starts a new capture segment. The site-specific firmware update checker is retained; regression tests run with npm test.
Display settings → Low-pass filter provides a first-order digital low-pass, off by default. Choose a preset from 10 Hz to 20 kHz or a custom cutoff from 1 to 45000 Hz; the effective cutoff is limited to 45% of the measured sample rate. Filtering uses sample intervals estimated from device timestamps, before plot aggregation. The waveform, cursors, statistics, and filtered CSV share the same results; zooming and panning do not change the filter. Filtered CSV includes raw current and effective cutoff columns, and raw CSV remains separately available. Zero calibration always uses raw ADC data. Lower cutoffs attenuate short pulses and delay the response; digital filtering cannot recover information lost through aliasing or saturation.
Drag with the left button to box-zoom both time and current; drag with the right button to pan. Double-click restores the latest waveform and automatic Y scale. The wheel still zooms time, while Ctrl/Alt + wheel zooms current. With cursors enabled, a left click places A/B and a left drag still box-zooms.
Power and energy: firmware 0.2.2 adds measured output-voltage telemetry. The host polls it about every 0.5 seconds and combines the latest valid voltage with raw calibrated current to estimate power, accumulated energy and average power. Voltage is sampled at a lower rate, so these readings are estimates; expired voltage and missing current intervals are excluded. Older firmware can use a manually entered load voltage. Filtering and plot navigation do not affect accumulation. Starting a capture, clearing data, calibration, changing manual voltage or changing voltage mode resets the statistics; they can also be reset separately and exported as CSV. Signed current is preserved to avoid biasing zero-input noise toward positive energy.
| Addr | R/W | Meaning | Raw unit |
|---|---|---|---|
| 0x0000 | R/W | Signal type: 0=current, 1=voltage | enum |
| 0x0001 | R/W | Waveform: 0=const 1=step 2=ramp 3=square 4=triangle 5=sine | enum |
| 0x0002 | R/W | Setpoint / low value; step count in step mode | mV or uA |
| 0x0003 | R/W | High value; step dwell in step mode | mV/uA or ms |
| 0x0004 | R/W | Period 20–65535 ms; step loop count (0=infinite) | ms / count |
| 0x0005 | R/W | Duty cycle | permille |
| 0x0006 | R | Firmware output command (not analog measurement) | mV or uA |
| 0x0007..0x0016 | R/W | Step sequence values, max 16 points | mV or uA |
Raw analog values are scaled by 1000: voltage uses mV (10600 = 10.600 V), current uses uA (10600 = 10.600 mA). The web UI polls registers 0x0000..0x0006 in one Modbus RTU read so the response contains both signal type and output command readback:
01 03 00 00 00 07 04 08
The response must include all seven registers. Register 0x0000 selects the engineering unit (0=current, 1=voltage). Register 0x0006 reports the firmware's most recent requested output, not confirmation of a completed DAC transfer or an analog measurement. The readback chart Y axis follows the response type: 4..20 mA for current and 0..10 V for voltage.
Ramp, square, triangle and sine periods are limited to 20..65535 ms in 1 ms steps before preview and transmission. Period 0 restores the 1000 ms default, matching the firmware; other out-of-range values are clamped. Configured frequency is 1000 / period(ms), up to 50 Hz. Step dwell remains 1..65535 ms, with loop count 0 meaning infinite; the sequence is written before the header.
Default 50 ms polling (about 20 points/s) provides low-rate command readback and cannot reconstruct a 50 Hz waveform. The setpoint preview is an ideal mathematical curve; verify output frequency, jitter, amplitude and settling time with a scope or acquisition device.
If your device isn't built in, the Custom page lets you describe it without writing JS:
- Output range, unit, step
- Send template with
{value},{value:2},{unit}placeholders - Parser: regex, JSON path, HEX offset, Modbus payload
- Scaling:
parsed × scale + offset
modusignal is actively maintained. New devices and parsers land regularly — see open issues for what's being discussed and feel free to chime in. If you'd like a device supported but don't want to write the driver yourself, open a request with the protocol doc, sample frames, and default connection parameters.
PRs that add devices or improve existing drivers are welcome. Please read CONTRIBUTING.md first (Chinese; English version coming).
Apache License 2.0. See LICENSE.txt.
If modusignal saved you an afternoon of fighting with a vendor installer, a star helps other people find it.
by 飞起小鹏 · modusignal.cn




