Rigol DP832 MCP Server
Controls Rigol DP832 programmable power supplies via Ethernet using VISA TCP/IP, enabling AI agents to manage channels, measurements, and protection settings.
README
Rigol DP832 MCP Server
A Python library and Model Context Protocol (MCP) server for controlling Rigol DP832 programmable power supplies via Ethernet connection using VISA TCP/IP.
Features
- Ethernet-only: Focused on Ethernet connections, no USB/USBTMC dependencies
- VISA TCP/IP: Uses industry-standard VISA TCP/IP for reliable communication
- Full DP832 Support: Complete control of all DP832 channels and features
- Network Discovery: Automatic discovery tools to find your DP832 on the network
- Easy to Use: Simple Python API for power supply control
- MCP Server: Model Context Protocol server for AI agent integration
- AI-Ready: Direct integration with AI assistants and automation workflows
Supported Models
- DP832: 3-channel programmable power supply (primary focus)
- DP821: 2-channel programmable power supply
- DP712: 1-channel programmable power supply
Installation
Option 1: Install via pip (Recommended)
Install directly from GitHub:
pip install git+https://github.com/amahpour/rigol_dp832_mcp_server.git
Option 2: Clone and Install
- Clone this repository:
git clone https://github.com/amahpour/rigol_dp832_mcp_server.git
cd rigol_dp832_mcp_server
- Install the package:
pip install .
Option 3: Development Install
For development with editable mode:
git clone https://github.com/amahpour/rigol_dp832_mcp_server.git
cd rigol_dp832_mcp_server
pip install -e .
Quick Start
1. Connect Your DP832
Connect your DP832 to your network via Ethernet cable and configure its IP address.
2. Find Your Device
Use the automatic discovery tool to find your DP832:
python rigol_dp832/find_dp832.py
This will scan your network and provide the exact connection string to use.
3. Use the Library
from rigol_dp832.rigol_dp import DP832
# Connect to your DP832
ps = DP832(
conn_type="VISA",
visa_resource_string="TCPIP0::192.168.1.100::5555::SOCKET"
)
# Get device information
device_id = ps.id()
print(f"Connected to: {device_id['model']}")
# Set channel 1 to 5V, 1A and turn it on
ps.set_channel_settings(channel=1, voltage=5.0, current=1.0)
ps.set_output_state(channel=1, state=True)
# Read measurements
voltage = ps.measure_voltage(1)
current = ps.measure_current(1)
print(f"Voltage: {voltage:.3f}V, Current: {current:.3f}A")
# Turn off the output
ps.set_output_state(channel=1, state=False)
# Close connection
ps.close()
MCP Server Usage
This repository includes a Model Context Protocol (MCP) server that allows AI agents to directly control your Rigol power supply. The MCP server provides a comprehensive set of tools for device discovery, connection management, channel control, measurements, and protection settings.
1. Install Dependencies
Before running the MCP server, install the required Python packages:
pip install pyvisa fastmcp
Or install from the requirements file:
pip install -r requirements.txt
Or install the package itself (which pulls in all dependencies):
pip install git+https://github.com/amahpour/rigol_dp832_mcp_server.git
2. Add the MCP Server to Your Client
Add the following to your MCP client configuration. Replace /path/to/rigol_dp832_mcp_server with the actual path where you cloned the repository.
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"rigol-dp832": {
"command": "python3",
"args": ["/path/to/rigol_dp832_mcp_server/mcp_rigol_dp832.py"],
"env": {}
}
}
}
Claude Code (run this command):
claude mcp add --transport stdio rigol-dp832 -s user -- python3 /path/to/rigol_dp832_mcp_server/mcp_rigol_dp832.py
You can optionally set a static IP address and port via environment variables instead of relying on auto-discovery:
{
"mcpServers": {
"rigol-dp832": {
"command": "python3",
"args": ["/path/to/rigol_dp832_mcp_server/mcp_rigol_dp832.py"],
"env": {
"RIGOL_DP832_IP": "192.168.1.100",
"RIGOL_DP832_PORT": "5555"
}
}
}
}
Configuration Options:
RIGOL_DP832_IP: IP address of your power supply (optional — uses auto-discovery if not set)RIGOL_DP832_PORT: Port number (default: 5555)
3. Restart Your Client
Restart Cursor or Claude Code for the new MCP server to be picked up.
Once configured, you can interact with your power supply through natural language commands such as:
- "Connect to the power supply"
- "Set channel 1 to 5V and 1A"
- "Enable output on channel 1"
- "Measure the voltage and current on channel 1"
- "Discover available power supplies on the network"
Available MCP Tools
The MCP server provides the following tools:
Device Discovery & Connection
discover_devices()- Find all Rigol power supplies on the network (auto-discovery)test_connection(ip_address=None)- Test connection to configured device or specific IPconnect(ip_address=None, port=None)- Connect to configured device or specific IP/portdisconnect()- Disconnect from current deviceget_device_info()- Get information about connected device
Channel Control
set_channel_settings(channel, voltage, current)- Set voltage and currentget_channel_settings(channel)- Get current settingsset_output_state(channel, state)- Enable/disable outputget_output_state(channel)- Get output state
Measurements
measure_voltage(channel)- Measure voltagemeasure_current(channel)- Measure currentmeasure_all(channel)- Measure voltage, current, and power
Protection Settings
set_ocp_enabled(channel, state)- Enable/disable overcurrent protectionget_ocp_enabled(channel)- Get OCP stateset_ocp_value(channel, current_limit)- Set OCP current limitget_ocp_value(channel)- Get OCP current limitset_ovp_enabled(channel, state)- Enable/disable overvoltage protectionget_ovp_enabled(channel)- Get OVP stateset_ovp_value(channel, voltage_limit)- Set OVP voltage limitget_ovp_value(channel)- Get OVP voltage limit
Status & Diagnostics
get_output_mode(channel)- Get output mode (CV/CC/UR)get_ocp_alarm(channel)- Check OCP alarm statusget_ovp_alarm(channel)- Check OVP alarm statusclear_ocp_alarm(channel)- Clear OCP alarmclear_ovp_alarm(channel)- Clear OVP alarmping()- Health check
Network Discovery Tools
Automatic Discovery
python rigol_dp832/find_dp832.py
Scans your network and finds DP832 devices automatically.
Test Specific IP
python rigol_dp832/test_ip.py 192.168.1.100
Tests a specific IP address for DP832 connectivity.
Comprehensive Network Scan
python rigol_dp832/network_discovery.py
Performs a detailed network scan with multiple discovery methods.
API Reference
Connection
from rigol_dp832.rigol_dp import DP832
ps = DP832(
conn_type="VISA",
visa_resource_string="TCPIP0::<IP_ADDRESS>::5555::SOCKET"
)
Device Information
device_id = ps.id()
# Returns: {'manufacturer': 'RIGOL TECHNOLOGIES', 'model': 'DP832', ...}
Channel Control
# Set voltage and current
ps.set_channel_settings(channel=1, voltage=5.0, current=1.0)
# Enable/disable output
ps.set_output_state(channel=1, state=True)
# Get current settings
settings = ps.get_channel_settings(channel=1)
# Returns: {'voltage': 5.0, 'current': 1.0}
Measurements
# Individual measurements
voltage = ps.measure_voltage(channel=1)
current = ps.measure_current(channel=1)
# All measurements at once
measurements = ps.measure_all(channel=1)
# Returns: {'voltage': 5.0, 'current': 0.5, 'power': 2.5}
Protection Settings
# Overcurrent Protection (OCP)
ps.set_ocp_enabled(channel=1, state=True)
ps.set_ocp_value(channel=1, setting=1.5)
ocp_enabled = ps.get_ocp_enabled(channel=1)
ocp_value = ps.get_ocp_value(channel=1)
# Overvoltage Protection (OVP)
ps.set_ovp_enabled(channel=1, state=True)
ps.set_ovp_value(channel=1, setting=6.0)
ovp_enabled = ps.get_ovp_enabled(channel=1)
ovp_value = ps.get_ovp_value(channel=1)
Examples
See rigol_dp832/ethernet_example.py for a complete working example.
Troubleshooting
Connection Issues
- Check IP Address: Verify the IP address is correct
- Network Connectivity: Ping the device:
ping 192.168.1.100 - SCPI Interface: Ensure SCPI over Ethernet is enabled on the DP832
- Firewall: Check that no firewall is blocking port 5555
- PyVISA: Ensure PyVISA is installed and working
Common Error Codes
-1073807339: Connection timeout (device not found or not responding)-1073807343: Invalid resource string format-1073807346: Device busy or locked
Requirements
- Python 3.6+
- PyVISA >= 1.11.0
- Network connection to DP832
What's Excluded
This library focuses on Ethernet connections only. The following have been intentionally excluded:
- USB/USBTMC connections
- Custom socket implementations
- Web server functionality
- OpenAI integration
License
This project is based on the original instrument-controllables library and maintains compatibility with the DP832 instrument control functionality.
Contributing
Feel free to submit issues and enhancement requests!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。