GithubHelp home page GithubHelp logo

numat / brooks-mfc Goto Github PK

View Code? Open in Web Editor NEW
5.0 9.0 1.0 37 KB

Python driver for Brooks Instrument Mass Flow Controllers

License: GNU General Public License v2.0

Python 100.00%
brooks-controllers mass-flow-controller python-driver

brooks-mfc's Introduction

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
}

Note the "Live Setpoint" is in the configured units (which could be percent of full scale or engineering units). "Setpoint" is always in % of full scale.

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, or the currently configured units if no flag is passed. See brooks-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.

brooks-mfc's People

Contributors

alexrudd2 avatar jamesjeffryes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rossverploegh

brooks-mfc's Issues

[Safe State Flag]

Script works only after manuall logging with "Control" user and turning on Safe State Flag on. Otherwise there is now air flow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.