Skip to main content

Python driver for Brooks Instrument mass flow controllers

Project description

brooks-mfc

Python driver and command-line tool for Brooks Instrument mass flow controllers.

Installation

pip install brooks-mfc

Usage

This driver uses an undocumented REST API in the devices's web interface for communication. The compatibility and stability of this interface with all Brooks controllers is not guaranteed.

Command Line

To test your connection and stream real-time data, use the command-line interface. You can read the flow rate with:

$ brooks-mfc 192.168.1.200
{
    "Customer Flow Totalizer": 0.0,
    "Flow": -0.3,
    "Flow Hours": 1.0,
    "Flow Totalizer": 0.0,
    "Live Setpoint": 0.0,
    "Operational Hours": 50.0,
    "Setpoint": 0.0,
    "Supply Voltage": 22.93,
    "Temperature": 27.11,
    "Valve Position": 0.0
}

You can optionally specify a setpoint flow with the set flag: brooks-mfc 192.168.1.150 --set 7.5. The units of the setpoint and return are specified using the --units flag. 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 brooks_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. Optionally, units can be passed with either command. If no units are specified the existing units configured for the device are used.

>>> await fc.get()
>>> await fc.get('%')
{
    "Customer Flow Totalizer": 0.0,
    "Flow": -0.3,
    "Flow Hours": 1.0,
    "Flow Totalizer": 0.0,
    "Live Setpoint": 0.0,
    "Operational Hours": 50.0,
    "Setpoint": 0.0,
    "Supply Voltage": 22.93,
    "Temperature": 27.11,
    "Valve Position": 0.0
}
>>> await fc.set(10)
>>> await fc.set(10, 'SCCM')

There's much more that could be set or returned from the flow controllers but I haven't had a reason to flesh all the the options out. Feel free to submit an issue with requests or a PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for brooks-mfc, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size brooks_mfc-0.1.4-py3-none-any.whl (14.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size brooks_mfc-0.1.4.tar.gz (12.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page