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.2.tar.gz (9.5 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.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for instrutech_gauges-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f50048b3996320144def195550c160e9b928fe08f4106bb5af5beafec20a0c9f
MD5 616d48c83c1717c1cfc88f6ba57e6c16
BLAKE2b-256 a028bae804ac5dd4ce45b012d02009f9f4dc81842f6570d0db9c3e83583eaa82

See more details on using hashes here.

Provenance

The following attestation bundles were made for instrutech_gauges-0.1.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for instrutech_gauges-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2b54952173f99b96ad3c35e5a84cdd48b6579cfb47b70c50614b4f99b7ee8c
MD5 4dfa79b9bddc34ca111c2c9f37cc9f4d
BLAKE2b-256 cdbc92490a8dfce07ab2b57268c7917e5209cf34a848c7594a00efbf29c684e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for instrutech_gauges-0.1.2-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