Skip to main content

Lightweight Python driver for Omega CN-series temperature controllers using Modbus over serial

Project description

Omega Controller (Python)

Lightweight Python driver for Omega CN-series temperature controllers using Modbus over serial (via minimalmodbus).

Features

  • PV/SV: get present value and set temperature setpoint
  • On/Off: get and set the controller on/off
  • Modes: PID, ON/OFF, MANUAL, and PID Program (Ramp/Soak)
  • PID tuning: get/set P, I, D
  • Program params: read/write 64-register blocks for Ramp/Soak (A/B)
  • Error handling: maps Omega error/status codes and raises helpful exceptions

Install dependencies:

pip install minimalmodbus

Install this driver from via pypi:

pip install omega-controller

Quickstart

from omega_controller import OmegaController, OmegaControllerError

# Adjust port/slave as needed for your setup
ctrl = OmegaController(port="COM3", slave_address=1, baudrate=9600, parity="even", bytesize=7, stopbits=1, mode="ascii")

try:
    # Optional: raise if the controller is reporting an error
    ctrl.check_errors()

    # Read process value (°C)
    pv = ctrl.get_pv()
    print("PV:", pv)

    # Set temperature setpoint (°C)
    ctrl.set_sv(150.0)

    # Switch to PID Program (Ramp/Soak) mode
    ctrl.set_control_method("program")

    # Tune PID
    ctrl.set_p(12.3)
    ctrl.set_i(600)
    ctrl.set_d(120)

except OmegaControllerError as e:
    print("Controller error:", e)
finally:
    ctrl.close()

API Overview

  • PV/SV
    • get_pv(raise_on_error=False) -> Optional[float]
    • get_sv() -> Optional[float]
    • set_sv(temp_c: float) -> None
  • Control method
    • get_control_method() -> Optional[int] (0=PID, 1=ON/OFF, 2=MANUAL, 3=PROGRAM)
    • set_control_method(method: int|str) -> None
  • PID
    • get_p()/set_p() – proportional band (0.1 resolution)
    • get_i()/set_i() – integral time (seconds)
    • get_d()/set_d() – derivative time (seconds)
  • Ramp/Soak program parameters
    • Blocks: A = 0x2000–0x203F, B = 0x2080–0x20BF (64 regs each)
    • read_program_block(block) / write_program_block(block, values)
    • read_program_param(block, offset) / write_program_param(block, offset, value)
  • Errors
    • check_errors(raise_on_error=True) – checks status and PV error codes
    • Raises OmegaControllerError with descriptive message

Serial Settings

  • Some models use alternate status/PV addresses; this driver handles common variants

Compatibility

  • Tested on: Omega CN7800
  • Expected to work with many CN-series models using the same Modbus map

Roadmap - Contributions Welcome

  • Test on additional Omega models
  • Add remaining serial commands from the manual (alarms, limits, etc.)

Project details


Download files

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

Source Distribution

omega_controller-0.0.5.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

omega_controller-0.0.5-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file omega_controller-0.0.5.tar.gz.

File metadata

  • Download URL: omega_controller-0.0.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for omega_controller-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c840489c98e9485d1c45a5e340ad1fad4fde8ca4b806733d5e5f620c3f1573d7
MD5 f01cb1e8eb0f28b3d56a446bfc95360f
BLAKE2b-256 a4a80c95074af1660f9a83a088c06d213daacb3623c3a317f757bfb2b0e79b35

See more details on using hashes here.

File details

Details for the file omega_controller-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for omega_controller-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c6385b24233842feebc3028ecb259b1294915a7875b8e084fb3a05cc435c7425
MD5 ebd2df464018e69bba38e799f0c0c99b
BLAKE2b-256 5456fe968772aba38bd7f8cfc26164f6f58ec206088ec764d630fb8b3ea07077

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page