Skip to main content

Python drivers for InstruTech gauges over serial or TCP serial gateways

Project description

instrutech-gauges

Python drivers for InstruTech gauges over serial or TCP serial gateways.

Install

uv add instrutech-gauges

Or for local development:

uv sync

Available drivers

  • VGC301
  • HornetIGM402
  • Public base class for custom devices: InstruTechAsciiGauge

Quick start (VGC301)

from instrutech_gauges import SerialTransport, VGC301

t = SerialTransport(port="/dev/ttyUSB0", baudrate=19200, timeout_s=0.3)
g = VGC301(t, address=1)

with g:
    print(g.read_sw_version())
    print(g.read_pressure_torr())
    g.set_trip_point(1, "on_below", 4.00e2)
    print(g.read_trip_point(1, "on_below"))

Quick start (Hornet IGM402)

from instrutech_gauges import HornetIGM402, SerialTransport

t = SerialTransport(port="/dev/ttyUSB0", baudrate=19200, timeout_s=0.3)
g = HornetIGM402(t, address=1)

with g:
    print(g.read_sw_version())
    print(g.read_system_pressure_torr())
    print(g.read_pressure_unit())

Firmware notes for HornetIGM402:

  • SES emission setting responses like 0.1MA_EM / 4.0MA_EM are parsed.
  • RU accepts long unit tokens (TORR, MBAR, PASCAL).
  • Optional command families (RU/SU, RDIG*) raise InstruTechUnsupportedCommandError on firmware that returns SYNTX ER.
  • Socket transport defaults to \r command termination.

Without context manager (with)

Use explicit open() / close() with try/finally:

from instrutech_gauges import SerialTransport, VGC301

t = SerialTransport(port="/dev/ttyUSB0", baudrate=19200, timeout_s=0.3)
g = VGC301(t, address=1)

g.open(probe=True)
try:
    print(g.read_sw_version())
    print(g.read_pressure_torr())
finally:
    g.close()
from instrutech_gauges import HornetIGM402, SerialTransport

t = SerialTransport(port="/dev/ttyUSB0", baudrate=19200, timeout_s=0.3)
g = HornetIGM402(t, address=1)

g.open(probe=True)
try:
    print(g.read_sw_version())
    print(g.read_system_pressure_torr())
finally:
    g.close()

Public base class

InstruTechAsciiGauge exposes shared protocol and transport helpers for building new drivers:

  • framing/parsing (#xx...<CR>, *xx...<CR>)
  • query() / query_float() / command_prog_ok()
  • serial reconfiguration (set_baud, set_parity, set_serial_comm)
  • common Mini-Convectron-style commands (VER, RD, TS, TZ, SL/SH, RL/RH, FAC, RST)

Minimal custom driver:

from instrutech_gauges import InstruTechAsciiGauge

class MyGauge(InstruTechAsciiGauge):
    def read_custom_value(self) -> float:
        return self.query_float("RDCUSTOM")

Transport

  • SerialTransport: local serial via pyserial
  • SocketTransport: TCP serial gateways (raw TCP)

SocketTransport defaults to CR (\r) command termination. If your gateway expects CRLF, override it:

from instrutech_gauges import SocketTransport

t = SocketTransport("192.168.1.50", 4001, timeout_s=1.0, write_terminator=b"\r\n")

Runtime serial reconfiguration (set_baud, set_parity) is supported only with SerialTransport.

VGC301 serial notes

Per the VGC301 manual, SB* / SP* / SA* / FAC require RST before they take effect.

  • VGC301.set_baud(...) defaults to reset_after=True
  • VGC301.set_parity(...) defaults to reset_after=True
  • For ODD/EVEN parity, data bits default to 7; for NO parity, data bits default to 8

Error handling

Typical exceptions:

  • InstruTechTimeoutError
  • InstruTechProtocolError
  • InstruTechDeviceError
  • InstruTechUnsupportedTransportOperationError

Release flow

  • CI runs on every push and PR (.github/workflows/ci.yml).
  • PyPI publish runs only on tags that start with v (.github/workflows/publish.yml).
  • Publish is blocked unless tag version matches pyproject.toml version exactly.

Example release:

git tag v0.1.1
git push origin v0.1.1

Configure PyPI Trusted Publisher for this repository so the publish workflow can upload without storing an API token.

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

instrutech_gauges-0.1.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

instrutech_gauges-0.1.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file instrutech_gauges-0.1.3.tar.gz.

File metadata

  • Download URL: instrutech_gauges-0.1.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for instrutech_gauges-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a6ec42f4dcfe994e2023251addedda6789f2bd3c845570ccca929f1594ebbf00
MD5 f42423afde552650aa2ba653a53a2167
BLAKE2b-256 59f95d06bf767eff9236e8ce5d4022bd3ca955cefae7c5405baeebf1391c033e

See more details on using hashes here.

Provenance

The following attestation bundles were made for instrutech_gauges-0.1.3.tar.gz:

Publisher: publish.yml on ograsdijk/instrutech-gauges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file instrutech_gauges-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for instrutech_gauges-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bfc283dbf43fcc0f149a8311c7634ffe94a3b5b3cf16d97187f4c8397f86bab5
MD5 53101d3139c39d43e7663497137cb4fe
BLAKE2b-256 87dae382bc71cdb28d2f83c17afe399548c2e66e0296becabfc96dbc2d9ec366

See more details on using hashes here.

Provenance

The following attestation bundles were made for instrutech_gauges-0.1.3-py3-none-any.whl:

Publisher: publish.yml on ograsdijk/instrutech-gauges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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