Skip to content
Alexander edited this page Jun 12, 2016 · 11 revisions

AnalytMTC Python Bindings

Here you can find quick & dirty Python (3.7.x) bindings for flow meter and flow controller from Analyt-MTC. It is important that they look like the controller from Alicat (https://github.com/numat/alicat) but the bindings will not work for Analyt-MTC!!!

I just started using my own bindings and this repository will be updated soon ... It's included into some of my projects for my PhD thesis.

How to use

Clone from GitHub: git clone https://github.com/schlenzmeister/AnalytMTC.git

Import my module "AnalytMTC" to your project. import AnalytMTC as mtc

Create a minimal instance with fc = mtc.AnalytMTC()

In this case "/dev/ttyUSB0" is used for serial communication. You can use a USB->Serial converter but keep in mind that you might change the serial port ("/dev/ttyUSB1", "/dev/ttyUSB2", ...).

It is better to use more paramters. For example I use this for a 500 ml/min flow controller with the ID "A": fc500 = mtc.AnalytMTC(unitid='A', maxflow=500)

You need to start the comunication now: fc500.startCommunication()

To stop the communication e.g. in case of exceptions use this: fc500.stopCommunication()

Example to set flow to 250 ml/min

fc500 = mtc.AnalytMTC(unitid='A', maxflow=500)
fc500.startCommunication()
fc500.setFlow(flow=250)
fc500.stopCommunication()

Example to receive data

fc500 = mtc.AnalytMTC(unitid='A', maxflow=500)
fc500.startCommunication()

print(fc500.getAirPressure())
print(fc500.getTemperature())
print(fc500.getGas())
print(fc500.getCurrentFlow())
print(fc500.getTargetFlow())

fc500.stopCommunication()

Gas mixtures

You can use multiple flow controllers to create a gas mixture. Therefore you need (at least) two controllers (A 100 ml/min and a 500 ml/min):

fc500 = mtc.AnalytMTC(unitid='A', maxflow=500)
fc500.startCommunication()
fc100 = mtc.AnalytMTC(unitid='B', maxflow=100)
fc100.startCommunication()

mfc = mtc.MultiAnalytMTC(fc500, fc100)

You can now set a total flow and a ratio for the mixture. This will create a total flow of 80 ml/min with a ratio of 60/40:

mfc.setSplittedFlow(80, 60)

This yields 48 ml/min from controller A and 32 ml/min from controller B.