Python driver for MKS mass flow controllers.
Project description
mfc
Python driver and command-line tool for MKS mass flow controllers.
Installation
pip install mfc
If you want the older python2/tornado driver, use pip install mfc==0.2.11
and review this README.
Usage
This driver uses the ethernet port on the side of the device for communication. If you use this driver, you only need to provide power to the top ports.
Command Line
To test your connection and stream real-time data, use the command-line interface. You can read the flow rate with:
$ mfc 192.168.1.200
{
"actual": 4.99,
"gas": "CO2",
"max": 37,
"setpoint": 5.00,
"temperature": 27.34
}
You can optionally specify a setpoint flow and/or gas with e.g.
mfc 192.168.1.150 --set 7.5 --set-gas N2
. See mfc --help
for more.
Python
This uses Python ≥3.5's async/await syntax to asynchronously communicate with the mass flow controller. For example:
import asyncio
from mfc import FlowController
async def get():
async with FlowController('the-mfc-ip-address') as fc:
print(await fc.get())
asyncio.run(get())
The API that matters is get
, set
, and set_gas
.
>>> await fc.get()
{
"actual": 4.99,
"gas": "CO2",
"max": 37,
"setpoint": 5.00,
"temperature": 27.34
}
>>> await fc.set(10)
>>> await fc.open() # set to max flow
>>> await fc.close() # set to zero flow
>>> await fc.set_gas('N2')
There is also set_display
, which will only work on devices that support it.
>>> await fc.set_display('flow')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mfc-0.4.0.tar.gz
.
File metadata
- Download URL: mfc-0.4.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 247e7a4397824489b054122a0cddacd40d8de0470b6bd2995b748eb1573e30dd |
|
MD5 | cbe239488f7fcfa5f216d0b6b6df7435 |
|
BLAKE2b-256 | a6327128eed5fce268a18181590a9d9cf6723a8458a55c614eede325326cabec |
File details
Details for the file mfc-0.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: mfc-0.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5328e9a5ce9a03e856b5be5c95b0e585e47b22937361fe604d36f0bb4392e7f8 |
|
MD5 | f389de2c46392c02c835698d0ad6fb26 |
|
BLAKE2b-256 | 0110b79f588fd26c69743f93c14eab02168be55ac932d3efb745178f83eec5ca |