Skip to main content

Python driver for Brooks Instrument mass flow controllers

Project description

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: brooks-mfc 192.168.1.150 --set 7.5. 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.

>>> 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.open()   # set to max flow
>>> await fc.close()  # set to zero flow

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

brooks_mfc-0.1.0.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

brooks_mfc-0.1.0-py3-none-any.whl (12.6 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