Package: pfeiffer-vacuum-protocol
Pfeiffer Vacuum ProtocolA python interface for controlling Pfeiffer vacuum gauges over RS485.Installation, Testing, and DependenciesThis library is available on pip.  Please install it with the following command.pip install pfeiffer-vacuum-protocolTesting is done with python's unit testing framework.  You can verify the current branch is working with the following command.[cmpierce@turing dist]$ python -m unittest pfeiffer_vacuum_protocol.tests
...............................
----------------------------------------------------------------------
Ran 31 tests in 0.006s

OKThe only required dependency is your favorite serial library.  This package was developed and tested againstpySerial.  However, it should be compatible with any library that implements python's IO interface.Description and Hardware CompatibilityThis library was created to communicate with a Pfeiffer vacuum PPT 100 over its RS485 interface.  These gauges can be purchased cheaply from ebay and this library enables simple readout of pressure from the gauges through python.To correctly do this, you'll need to make a quick custom cable for the device.  Please follow the pinout in the PPT 100 manual reproduced here.  On this particular gauge, V DC is 24 V.Cheap RS485 adapters exist that allow the gauge to be directly connected to a PC.  Currently, only functions relevant to the PPT 100 are implemented in the library.  The following is a table of compatibility for other models reproduced from the PPT 100 manual.  If you are interested in other gauges, then please consider contributing.Quickstart GuideThe library is designed for and tested against thepySerialinterface for communicating with the gauges.  However, because it can technically be used with any serial interface that implements python's IO interface, I have decided against imposing which library to use in the dependencies of this project.  To use pySerial as in this example, please installit through pip withpip install pySerial.The most common operation is to read out pressure from the gauge.  The following example will read out pressure from a gauge attached to COM port 1 with address 1 on the RS485 network.  The pressure returned will be in bar.importserialimportpfeiffer_vacuum_protocolaspvp# Open the serial port with a 1 second timeouts=serial.Serial("COM1",timeout=1)# Read the pressure from address 1 and print itp=pvp.read_pressure(s,1)print("Pressure:{:.3f}bar".format(p))Invalid Character FilterSome users have reported invalid characters coming from their serial device. Sometimes this can be resolved by simply ignoring those extra characters. The library comes with a filter built in. This is kept off by default to properly display errors to the user. However, it can be enabled/disabled by running one of the following function after import.importpfeiffer_vacuum_protocolaspvppvp.enable_valid_char_filter()# Filter onpvp.disable_valid_char_filter()# Turn it off againThe filter can also be overridden on a per-function basis. The relevant functions have an optional argument calledvalid_char_filterwhich can be set toTrueorFalseto enable or disable the filter in a more targeted way.Package Referenceread_error_code(s, addr, valid_char_filter=None)Reads Pfeiffer's low level error code on the gauge.  This appears to be useful for diagnosing failure of the transmitter itself.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnserror_code: pfeiffer_vacuum_protocol.ErrorCode enum element
The error code returned by the gauge, this can be one ofNO_ERROR,DEFECTIVE_TRANSMITTER,
orDEFECTIVE_MEMORYread_software_version(s, addr, valid_char_filter=None)Returns the vacuum gauge's firmware version.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnsfirmware_version: three element tuple if ints
The version numbers as the tuple (major, minor, sub-minor)read_gauge_type(s, addr, valid_char_filter=None)Returns the name of the vacuum gauge attached at this address.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnsgauge_type: str
The model name of the gauge attachedread_pressure(s, addr, valid_char_filter=None)Reads the pressure from the gauge and returns it in bars.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnspressure: float
Pressure measured by gauge in barswrite_pressure_setpoint(s, addr, val, valid_char_filter=None)Sets the gauge's "vacuum setpoint".  In the manual, this appears to tell the gauge if it's operating in a high or low pressure regime to change some of its signal processing.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnsNoneread_correction_value(s, addr, valid_char_filter=None)Returns the current correction value used to adjust pressure measurements for different gas compositions.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnscorrection_value: float
The current correction valuewrite_correction_value(s, addr, val, valid_char_filter=None)Sets the correction value on the gauge.  Used to adjust the pressure measurement for different gas compositions.Parameterss: pySerial object
The open serial device attached to the gaugeaddr: int
The address of the gaugevalid_char_filter: bool
Manually override the valid character filterReturnsNoneenable_valid_char_filter()Globally enable a filter to ignore invalid characters coming from the serial device.disable_valid_char_filter()Globally disable a filter to ignore invalid characters coming from the serial device.