Electronic DC load control library using SCPI protocol over UDP.
- Model: MP71077x series DC Electronic Load
- Interface: Ethernet (UDP Socket)
- Default Port: 3000
- Protocol: SCPI (Standard Commands for Programmable Instruments)
The MP71077x driver is part of the dcload_device package:
from dcload_device import MP71077xfrom dcload_device import MP71077x
# Connect to load
load = MP71077x("192.168.1.80")
# Set CC mode current
load.set_ci_current(1.0)
# Enable input
load.input_on()
# Read back current setpoint
print(load.get_ci_current())
# Disable input
load.input_off()load = MP71077x(ip, port=3000, timeout=2)Parameters:
ip(str): Device IP addressport(int): UDP port (default: 3000)timeout(float): Socket timeout in seconds (default: 2)
Enable load input.
load.input_on()Disable load input.
load.input_off()Query current input state.
state = load.get_input_state() # "ON" or "OFF"Set constant-voltage setpoint.
load.set_cv_voltage(5.0)Read CV voltage setpoint.
Set upper voltage protection limit.
Read upper voltage limit.
Set lower voltage protection limit.
Read lower voltage limit.
Set constant-current draw.
load.set_ci_current(2.0) # draw 2ARead CI current setpoint.
Set upper current protection limit.
Read upper current limit.
Set lower current protection limit.
Read lower current limit.
Set constant-power draw.
load.set_cp_power(10.0) # draw 10WRead CP power setpoint.
Upper power protection limit.
Lower power protection limit.
Set constant-resistance mode value.
load.set_cr_resistance(10.0) # 10 OhmRead CR resistance setpoint.
Upper resistance protection limit.
Lower resistance protection limit.
For advanced usage or custom SCPI commands:
Send command to device (no response expected).
load.write(":INP 1")Send command and retrieve response.
response = load.query(":CURR?")Flask-based HTTP interface for remote access.
cd dcload_device
python -m flask --app flask_app run --port 5000Server runs on http://localhost:5000
Enable or disable load input.
Request:
{"state": true}Response:
{"ok": true}Set CV voltage and/or voltage limits.
Request:
{"cv": 5.0, "upper": 30.0, "lower": 0.0}Set CI current and/or current limits.
Request:
{"ci": 2.0, "upper": 10.0, "lower": 0.0}Set CP power and/or power limits.
Request:
{"cp": 10.0, "upper": 200.0, "lower": 0.0}Set CR resistance and/or resistance limits.
Request:
{"cr": 10.0, "upper": 1000.0, "lower": 0.1}Read voltage setpoint and limits.
Response:
{"cv": 5.0, "upper": 30.0, "lower": 0.0}Read current setpoint and limits.
Read power setpoint and limits.
Read resistance setpoint and limits.
Read input on/off state.
Response:
{"state": "ON"}load = MP71077x("192.168.1.80")
load.set_ci_current(2.0)
load.set_upper_current_limit(5.0)
load.input_on()import time
for i in [0.5, 1.0, 1.5, 2.0, 2.5]:
load.set_ci_current(i)
time.sleep(1.0)
load.input_off()Verify PSU output and regulation under load:
from dcload_device import MP71077x
from psu_device import MP711001
import time
psu = MP711001("192.168.1.100")
load = MP71077x("192.168.1.80")
psu.set_voltage(1, 5.0)
psu.set_current(1, 3.0)
psu.output_on(1)
load.set_ci_current(2.0)
load.input_on()
time.sleep(1)
result = psu.measure(1)
print(f"Voltage under load: {result['voltage']}V")
print(f"Current drawn: {result['current']}A")
load.input_off()
psu.output_off(1)The driver automatically reconnects on socket errors.
try:
load.set_ci_current(2.0)
load.input_on()
except Exception as e:
print(f"Error: {e}")- Transport: UDP (connectionless); lower overhead than TCP
- Timing: 0.1-0.15s delay between commands for stability
- Reconnection: ~0.5s delay on error recovery
- Check device IP address and that port 3000 is reachable
- Try increasing
timeoutparameter
- Confirm units match device expectations (V, A, W, OHM)
- Check that protection limits are set wide enough to allow the setpoint
- Main documentation: ../README.md
- PSU device: ../psu_device/README.md
- Multimeter device: ../multimeter_device/README.md