Skip to main content

For interfacing with Brooks Instrument Mass Flow Controllers, Meters, and Pressure Controllers with S-Protocol over RS-485.

Project description

sprotocol

For interfacing with Brooks Instrument Mass Flow Controllers, Meters, and Pressure Controllers with S-Protocol over RS-485.

Installation

$ pip install sprotocol

Usage

This package is written for interfacing with Brooks Instrument devices using S-Protocol. S-Protocol is a proprietary protocol based on HART communications utilizing RS-485.

Disclaimer and Overview

This module is intended to ease setting up and utilizing S protocol communications over RS-485 with Brooks Instrument devices. This module is provided for free and is currently in beta. Feedback is welcome and requested features as well as bug fixes will be added over time. It is recommended to review the S-protocol manual for the appropriate device.

S-Protocol Manuals

The following device-specific S-protocol manuals can be found on the Brooks Instrument website.

Getting Started - Single Unit Connection

  1. Connect your S protocol device and note the com port it is connected to.
  2. Import the module s_protocol.py
  3. Initialize the appropriate class—Mass Flow Controller (mfc), Mass Flow Meter (mfm), or Pressure Controller (pc).
  4. Pass in the com port that is connected to the device along with the baudrate. Note that the default baudrate is 19200. Alternately, a serial connection can be passed for the initialization instead.
  5. To begin communicating, the address of the unit is necessary. This can be set in two different ways.
  • Call the get_address method. This is recommended.
From sprotocol import device

gf40 = device.mfc('COM10') 
gf40.get_address()

gf40.read_flow_rate()
  • Set the long_frame_address property to the device address. This will be a bytearray consisting of five elements. See the S-Protocol device manual for more information.
From sprotocol import device

gf40 = device.mfc('COM10') 
gf40.long_frame_address = bytearray(b'\x8aZ\xe7wI')

gf40.read_flow_rate()
  1. Once the address is known by the unit, commands can be sent.
  2. The following commands are supported by each device type. The command number is noted below. The command number can be used to reference the S protocol device manual for the relevant unit. Note that if the baudrate is changed, communications will be lost and the class will need to be reinitialized.

Commands supported by device.

The commands supported are based on the device type. The command numbers are listed. Please see the S-Protocol manual for more information on the commands.

MFC Supported Commands

  1. Read Setpoint—Command 235
  2. Write Setpoint—Command 236
  3. Read Totalizer Status—Command 240
  4. Write Totalizer Status—Command 241
  5. Read Totalizer Value—Command 242
  6. Read Setpoint Source—Command 215
  7. Write Setpoint Source—Command 216
  8. Read Flow Rate—Command 1
  9. Read Full Scale Flow Rate—Command 152
  10. Read Standard Temperature and Pressure—Command 190
  11. Write Standard Temperature and Pressure—Command 191
  12. Write Flow Units—Command 196
  13. Write Temperature Units—Command 197
  14. Write Baudrate—Command 123

MFM Supported Commands

  1. Read Flow Rate—Command 1
  2. Read Full Scale Flow Rate—Command 152
  3. Read Standard Temperature and Pressure—Command 190
  4. Write Standard Temperature and Pressure—Command 191
  5. Write Flow Units—Command 196
  6. Write Temperature Units—Command 197
  7. Write Baudrate—Command 123

Pressure Controller Supported Commands

  1. Read Pressure—Command 1
  2. Read Full Scale Pressure—Command 152
  3. Write Pressure Units—Command 198
  4. Read Setpoint—Command 235
  5. Write Setpoint—Command 236
  6. Read Setpoint Source—Command 215
  7. Write Setpoint Source—Command 216

Commands with selections

Some commands require a selection to be specified. This will be an integer based on tables found in the manual. The tables can also be reviewed in the module.

Sending Additional Commands

Not all commands from the manual are supported with methods. Generic commands may be sent to the unit. The follow methods are supported and can be used to send other commands that are not directly supported.

  1. Write_command(self, command_number, data=None) This is used to send a generic command, specified as an integer, with the data payload. The data payload should be a bytearray consisting of the necessary data for the command. The checksum should not be included in the data bytearray.
  2. Read_command(self) This is used to read the response from the unit and parse it. This should be called approximately 100 ms (or more) after sending a write command. This will return an array with the address, command_byte (should match the integer command sent), the two status bytes, and any returned data bytes. The checksum is not included in the data bytes.

License

sprotocol was created by Darren Weinhold. It is licensed under the terms of the MIT license.

Credits

sprotocol was created with cookiecutter and the py-pkgs-cookiecutter template.

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

sprotocol-0.0.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sprotocol-0.0.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file sprotocol-0.0.2.tar.gz.

File metadata

  • Download URL: sprotocol-0.0.2.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.12.0 Windows/11

File hashes

Hashes for sprotocol-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a75b421d05ee72a8af8b18bc6d621ea725dca15e7a84ab3744c24a2dd87111ea
MD5 fe4dabbe314542e5952f2f1281b43e53
BLAKE2b-256 9c06cf0be9832f9002abb5977bcec69791c9d5204b372f74ab671b3f8aae379d

See more details on using hashes here.

File details

Details for the file sprotocol-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sprotocol-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.12.0 Windows/11

File hashes

Hashes for sprotocol-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8bc91a86c5515e9e23f53edadafad75bcbbc09b6d09ec5a87790b45e6af76f7
MD5 7cb074ff192f05d59c78e73cd136f719
BLAKE2b-256 b68b6273b422a5a44c65f93952316734d25d496ab14ea26a2d0ef526587415d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page