numat / mfc

Python driver and command line tool for MKS mass flow controllers.
GNU General Public License v2.0
8 stars 1 forks source link

.set( ) not working #7

Open isabdr opened 1 year ago

isabdr commented 1 year ago

@patrickfuller

I'm trying to control my MFC using a Raspberry Pi4. I'm able to establish a connection with the MFC, .get( ) function is working, and so is .set_gas( ). But when I try to change the actual flowrate with .set( ), .open( ), or .close( ), I'm getting errors.

When I try to use .set( ) on the command line I get: Could not connect to device When I try to use it in a script I get: RuntimeError: Event loop is closed Unclosed client session Unclosed connector

image

Am I missing some sort of previous configuration on the MFC? I'm pretty lost here, so any help is welcome! Thanks in advance!

patrickfuller commented 1 year ago

@isabdr

I've learned that these MFCs can change behavior based on year of assembly + other factors out of this library's control. I know the library works on my MFCs, but you are probably working with different MFCs that I can't test.

I'll take a few guesses and see if I can help.

  1. Are you sure your device is a flow controller and not a flow meter? Not all MKS devices come with the ability to control flow.
  2. Can you access a website when you type the IP address of the MFC into a web browser?
  3. If yes, is there a tab on the website for setting flow rate?
  4. Does a page show up when you go to http://the.mfc.ip.address/flow_setpoint_html? This is the page that this library uses to set flow rate.

Hope this helps!

isabdr commented 1 year ago

@patrickfuller

The MFC is for sure a Mass Controller because we can use it just fine when controlling it through a computer. But I don't seem to be able to access http://the.mfc.ip.address/flow_setpoint_html on the browser, it keeps loading forever, which honestly might have something to do with my version of Windows.

But another thing that called my attention when trying to debug this now is how we have to type in a password to be able to access the full settings in the web browser. Do we need to type in that password anywhere when using your library?

Thanks again for all the help!

alexrudd2 commented 1 year ago

The default passwords are 'config' and 'control' for those respective control settings.

isabdr commented 1 year ago

My password is still 'config' so that is probably not the issue, and I can change the gas type...

alexrudd2 commented 1 year ago

https://github.com/numat/mfc/blob/407579a9651dd2358aeabfc2eca7259982ad9ac9/mfc/driver.py#L24

I wonder what happens if you try changing this to 'control'?

(I should note I've never used this library, only similar ones. Sorry I can't be more helpful)

isabdr commented 1 year ago

It still lets me change the gas type but not the control flow

patrickfuller commented 1 year ago

Hm, can you set the flow rate on the device's website? There should be a tab that lets you set it there.

(If you can set flow rates on the website but not through this driver, then I unfortunately don't know what the issue is.)

isabdr commented 1 year ago

I'm just confused about how you got the 'flow_setpoint_html' link, because when I change settings in the browser, the only thing on the URL bar is the IP address.

patrickfuller commented 1 year ago

@isabdr we probably used Wireshark to monitor the communication traffic as we changed settings on the web interface. We likely cross-checked by searching through the javascript in the browser's debugger console and/or testing the API calls with curl.

If you set up Wireshark to monitor traffic to/from the MFC IP and then change settings on the MFC website while monitoring, you'll probably learn what you need to fix this problem.

leonardo-chiappisi commented 1 month ago

Hi Isabdr,

I am facing the same problem. Did you find a solution at the end?

Best wishes, Leonardo