Skip to main content

SpecMPC

SpecMPC is a Python package for interfacing with a Motorized Probe Controller (BIGTREETECH SKR MINI E3 V3.0) used in Bruker BioSpin products. The name combines “spec,” short for spectrometer, with “MPC,” short for Motorized Probe Controller.

The controller is used to:

  1. Move the iris rod of an EPR probe linearly on the Z axis.
  2. Turn a goniometer on the X axis.

Requirements

  • Python 3.8 or later
  • numpy
  • pySerial

Installation

Install through PyPI:

python -m pip install SpecMPC

From the project root, install SpecMPC with pip:

python -m pip install .

For development, install it in editable mode:

python -m pip install -e .

Terminal Control Panel

After installation, the SpecMPC command opens an interactive control panel.

Use auto-detection:

SpecMPC

Or specify the serial port and baud rate:

SpecMPC -p COM3 -b 96000

All connection arguments are optional. If an argument is skipped, SpecMPC uses the default value from MPC.

Available startup options:

SpecMPC [-h] [-p PORT] [-b BAUD_RATE] [--write-timeout WRITE_TIMEOUT] [--timeout TIMEOUT] [-v VERBOSE]

Inside the control panel, call public MPC methods by typing the method name followed by arguments:

SpecMPC> status
SpecMPC> move IRIS 0.8
SpecMPC> theta Goniometer 15
SpecMPC> feedrate IRIS 5
SpecMPC> set_axis_alias Z Probe
SpecMPC> homing_sensitivity IRIS 120
SpecMPC> relative true
SpecMPC> send_command M114 true
SpecMPC> help
SpecMPC> exit

Argument values such as numbers, true, false, and none are converted to Python values automatically.

Axis aliases are display names only. By default, Z is shown as IRIS and X is shown as Goniometer; commands sent to the controller still use the underlying X, Y, Z, or E axis letters.

Graphical Control Panel

SpecMPC also includes a Tkinter GUI. Start it with:

SpecMPC-gui

You can pre-fill the connection settings from the command line:

SpecMPC-gui -p COM3 -b 96000

The GUI attempts to connect automatically when it opens. By default, the port selector uses Auto, which lets SpecMPC detect the controller. To open the GUI without connecting automatically:

SpecMPC-gui --no-auto-connect

The GUI provides controls for:

  • Top tabs for IRIS, Goniometer, Y, E, Connection, Advanced, and Raw command.
  • A bottom log window for status and command output.
  • Connecting and disconnecting from the controller.
  • A connection LED: red for disconnected, green for connected, and orange while busy.
  • Selecting a motion axis directly from the top-level tabs.
  • Moving a linear axis.
  • Rotating a rotational axis.
  • Viewing a live vertical position rail or rotation dial for the selected axis.
  • Homing a selected linear axis.
  • Setting home position.
  • Reading current status.
  • Automatically switching between absolute text-entry moves and relative arrow-step moves.
  • Using the Advanced tab to choose an axis independently and edit display name, motion type, motion limits, feedrate, homing sensitivity, motor current, and steps per unit.
  • Saving, restoring, and resetting controller settings.
  • Sending raw G-code commands.

Display names, motion types, and motion limits changed in the GUI are saved automatically and loaded the next time the GUI starts. Repository defaults are stored in SpecMPC/config/default_config.json; local GUI changes are saved to SpecMPC/config/config.json, which is ignored by git. IRIS defaults to a linear range of 0 to 8. The Advanced tab also has an Override motion limits checkbox for deliberate out-of-range moves on the selected axis only.

The GUI checks the connected serial port periodically. If the controller is physically disconnected, the connection LED turns red and motion controls are disabled.

The selected axis controls are type-aware: linear axes enable position arrows, and rotational axes enable angle arrows. Linear axis tabs show only position controls, and rotational axis tabs show only angle controls.

The motion text box shows the current position or angle. Edit the value and press Enter to move in absolute mode. Use the arrow buttons to move by the selected step; arrow moves automatically switch the controller to relative mode. Linear axes allow 0.1, 0.5, or 1 mm steps. Rotational axes allow 0.1, 0.5, 1, 5, or 10 degree steps.

Python API

First, make sure the product is properly installed and connected to the controller. Connect the controller to the computer with a USB cable and power on the system.

Then create an MPC instance:

import SpecMPC

mpc = SpecMPC.MPC()

To specify a port and baud rate:

import SpecMPC

mpc = SpecMPC.MPC(port="COM3", baud_rate=96000)

Sending Commands

Once the connection has been established, send movement commands through the MPC object:

mpc.move("IRIS", 0.8)          # Move the Z-axis rod linearly by 0.8 mm.
mpc.theta("Goniometer", 15)    # Rotate the X-axis plate by 15 degrees.

Useful status and setup methods:

print(mpc.status())      # Print cached controller status.
print(mpc.position())    # Query current positions from the controller.
mpc.feedrate("IRIS", 5)  # Set Z-axis feedrate.
mpc.homing_sensitivity("IRIS", 120)
mpc.relative(True)       # Enable relative movement mode.
mpc.home("IRIS")         # Home a linear axis.
mpc.save()               # Save configurable settings to EEPROM.

To change display names later, update aliases after creating the controller:

mpc.set_axis_alias("Z", "Probe")

Example Script

import SpecMPC

mpc = SpecMPC.MPC()

mpc.help()
print(mpc.status())

mpc.theta("X", 30)
print(mpc.position())

mpc.theta("X", -60)
print(mpc.position())

mpc.home("X")
print(mpc.position())

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specmpc-0.0.2.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specmpc-0.0.2-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file specmpc-0.0.2.tar.gz.

File metadata

  • Download URL: specmpc-0.0.2.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for specmpc-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9336d4c7181191a30ad730dba9dac1355bb27b990df2f7c8393860645b5e8f64
MD5 ec101fdb9deaa9a7f9bc01905be685a8
BLAKE2b-256 39c8ae382427eb2da34d0d61c25b74a02d28adbc5c6bed2b4d05944c8c40f2ec

See more details on using hashes here.

File details

Details for the file specmpc-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: specmpc-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for specmpc-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b883a651c49a1bfa4f32184590b364f1b59b2bf6fad8f71e0461111ca398c7
MD5 c13890c1c774055ca86acecd08010910
BLAKE2b-256 0bba0c95adfa7b2996e70c151820f8806f89704cb9454c12a76bccd0d5803b98

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page