Skip to main content

Unofficial library to control and read the BPG400 pressure gauge via RS232C interface

Project description

pybpg400: Unofficial Python library to control and access the INFICON BPG400 pressure gauge (via RS232C)

This is an unofficial Python library (and a mini CLI utility) to control and access the INFICON BPG400 pressure gauge via it's RS232C serial port.

Installation

This library (and the CLI utility) is provided via PyPi:

pip install pybpg400-tspspi

Usage

More elaborate examples can be found in the examples folder.

The device can be simply opened via context management routines (in addition to imperative connect() and disconnect() routines):

from bpg400.bpg400 import RPG400_RS232
from labdevices.pressuregauge import PressureGaugeUnit

with BPG400_RS232("/dev/ttyUSB0") as pg:
	# Perform your operations

The library starts an background thread that continuously parses the datastream received by the BPG400 pressure gauge. To query the latest pressure reading one can simply use the get_pressure method. This method also allows one to supply the unit - it defaults to mbar:

print(pg.get_pressure())

or

print(pg.get_pressure(PressureGaugeUnit.TORR))

One can simply change the display unit using the set_unit method:

pg.set_unit(PressureGaugeUnit.MBAR)
pg.set_unit(PressureGaugeUnit.TORR)
pg.set_unit(PressureGaugeUnit.PASCAL)

The CLI utility

The package also comes with a simple command line utility called bpg400.

One can for example simply query the current pressure using a single shell command:

bpg400 --port /dev/ttyU0``` query
Usage: bpg400 [OPTIONS] command

Controls or queries the BPG400 pressure gauge via a RS232C
serial interface.

Options:

	--port PORTNAME
		Specifies the serial port device to use
	--json
		Sets output format to JSON for further processing
	--debug
		Run in debug mode (dump RX and TX packets)

Supported commands:

	query
		Query the current pressure in the set unit
	setmbar
		Set display unit to millibar
	settorr
		Set display unit to torr
	setpa
		Set display unit to pascal
	degas
		Enable degas mode
	nodegas
		Stop degas mode
	sleep N
		Sleep N seconds before performing next command

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

pybpg400-tspspi-0.0.2.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

pybpg400_tspspi-0.0.2-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

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