Monitoring of the gas-puff and pressure system of LAPD at the Basic Plasma Science Facility (BAPSF). The repository covers two largely independent subsystems:
- Pfeiffer Vacuum gauge logging — continuous pressure acquisition and real-time monitoring (see below).
- Gas-puff acquisition — a Raspberry Pi pipeline tying together a Sensirion flow meter, a piezo valve driven through an AD/DA board, and a pressure transducer.
Everything for the Pfeiffer subsystem lives in pfeiffer/. It talks to a Pfeiffer Vacuum MaxiGauge TPG 366 controller over Ethernet, continuously logs every connected sensor's pressure to daily HDF5 files, and provides a live plotting GUI.
- Controller: Pfeiffer MaxiGauge TPG 366 (up to 6 pressure sensors).
- Transport: TCP socket over Ethernet — default controller IP
192.168.7.44, port8000. - Protocol: Pfeiffer serial/ASCII mnemonic protocol (
PRX,TID,GAS, etc.) with ACK/NAK handshaking, tunneled over the socket. Line termination isCR+LF. - Units: Pressure logged in Torr.
| File | Purpose |
|---|---|
| pfeiffer/PfeifferVacuumCommunication.py | Low-level driver. Defines the MaxiGauge class (socket connect/disconnect, mnemonic send/enquire, ACK/NAK handling) and the MaxiGaugeError / MaxiGaugeNAK exceptions. |
| pfeiffer/Pfeiffer_control.py | Acquisition loop. Continuously polls all sensors and appends readings to a daily HDF5 file. |
| pfeiffer/Pfeiffer_GUI.py | PyQt5 real-time plotting GUI that reads the latest HDF5 file. |
connect()/disconnect()— open/close the TCP socket (2 s timeout, up to 300 retries).get_all_pressure_reading()— returns(status_list, pressure_list)for all sensors via thePRXmnemonic, with retry on garbled responses.get_device_id()— sensor model IDs (TID).get_gas_type()— gas calibration setting per sensor (GAS), mapped through theGAS_TYPEtable (Nitrogen, Argon, Hydrogen, Helium, Neon, Krypton, Xenon, CAL).pressure(sensor)— single-sensor reading (PR<n>), with status decoded viaPRESSURE_READING_STATUS(e.g. Underrange, Overrange, Sensor error/off, No sensor).
Run this to start logging:
cd pfeiffer
python Pfeiffer_control.pyWhat it does:
- Writes to
C:\data\gauge\pressure_data_<YYYY-MM-DD>.hdf5, rolling over to a new file automatically at the day boundary. - HDF5 layout: a
PfeifferVacuumgroup containing one resizable dataset per sensor ("1","2", …) plus atimestampdataset (seconds since epoch). Each sensor dataset carriesModel,Gas,Unit, andModified timeattributes; when a gauge or gas setting changes, the new value is appended to the relevant attribute list rather than overwritten. - Uses HDF5 SWMR (Single-Writer/Multiple-Reader) mode so the GUI can read while the writer is running.
- Resilience: logs connection STARTED / LOST / RECOVERED events to
C:\data\gauge\connection_log.txt, transparently reconnects onMaxiGaugeError/TimeoutError, and auto-recovers from stale SWMR locks by invokingh5clear(triesh5clearonPATH, then a vendored fallback path).
Configuration: the controller IP, HDF5 output directory, and
h5clearfallback path are set near the top of pfeiffer/Pfeiffer_control.py. Adjust them for your machine.
cd pfeiffer
python Pfeiffer_GUI.pyA PyQt5 window that opens the most recent HDF5 file in C:\data\gauge (SWMR read) and refreshes every 0.5 s in a background thread. It shows two stacked panels:
- Top: the last 30 seconds of pressure.
- Bottom: the full day binned into 5-minute averages.
The sensor to plot (sensor_number) and the rolling window length (n_points) are configurable at the top of the file.
h5py, numpy, portalocker, PyQt5, matplotlib, and the HDF5 h5clear command-line tool (bundled with the HDF Group HDF5 distribution).
The gas-puff side runs on a Raspberry Pi and coordinates the valve, flow meter, and pressure transducer. The data flow:
flowchart LR
subgraph gas[gas puff]
direction LR
ADC[AD/DA board] -->|DAC out| amp[Amplifier]
amp --> piezo[Piezo valve]
amp --> |optional|scope
psi[Pressure transducer] -->|ADC in| ADC
end
Pi === ADC
subgraph central[" "]
in["input.txt"]-->Pi[Raspberry Pi]
Pi-->out["output.csv"]
flow[Flowmeter] -->|serial| Pi
Trigger -->|GPIO pin| Pi
LabTimeServer --> Pi
flow .->|data| out
end
in .->|data| out
psi .->|data| out
- Flow meter: Sensirion SFC5xxx, accessed over the SHDLC serial protocol. Driver docs: https://sensirion.github.io/python-shdlc-sfc5xxx/index.html
- Trigger: hardware shot trigger read on a Raspberry Pi GPIO pin (via a small C library,
gpio_detect.so). - Output: per-shot flow data saved to HDF5.
Arduino firmware for the trigger/status display lives in arduino_src/, and hardware datasheets (AD/DA board, amplifiers, Arduino) are in doc/.
The src/ directory holds the gas-puff Raspberry Pi code. It is a separate pipeline from the Pfeiffer logger above.
| File | Role |
|---|---|
| src/flowmeter_main.py | Main acquisition entry point — GPIO trigger handling, multiprocessing-based flow capture, and per-shot HDF5 saving. |
| src/FlowMeterCommunication.py | FlowMeter wrapper around the Sensirion sensirion-shdlc-sfc5xxx driver. |
| src/wavegen_control.py | Driver for the waveform generator / AD/DA board used to drive the piezo valve. |
| src/kernel.py | High-level GasPuffValve interface coupling the valve, trigger, and waveform output. |
| src/input.py | Waveform definition (generate_pulse_waveform) and a small Tkinter control panel. |
| src/main.py | Standalone example that programs and bursts a pulse waveform. |
Note: some wavegen-coupled paths are partially archived/commented;
flowmeter_main.pyis the current acquisition driver.
See LICENSE.