numat / alicat

Python driver and command line tool for Alicat mass flow controllers.
GNU General Public License v2.0
21 stars 27 forks source link

MFC OSError: Could not read control point #104

Closed ericnallon closed 5 months ago

ericnallon commented 5 months ago

Alicat MC-500SCCM Firmware: 7v22.0-R22 Comm setup: RS-232 Serial, Baud 19200 Setpoint Source: Serial / Front Panel

I have the MFC connected to a raspberry Pi4 and can see device at /dev/ttyUSB0. The MFC is connected via USB to 8 Pin Mini Din Male Serial Adapter

from alicat import FlowController

ADDRESS = '/dev/ttyUSB0'
unit = 'E'

mfc = FlowController(address=ADDRESS, unit=unit)

async def get():
    async with FlowController(address=ADDRESS, unit=unit) as flow_controller:
        print(await flow_controller.get())
await get()

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[12], line 1
----> 1 await get()

Cell In[11], line 3
      1 async def get():
      2     async with FlowController(address=ADDRESS, unit=unit) as flow_controller:
----> 3         print(await flow_controller.get())

File ~/devel/python_envs/sampler/lib/python3.11/site-packages/alicat/driver.py:344, in FlowController.get(self)
    328 async def get(self) -> dict:
    329     """Get the current state of the flow controller.
    330 
    331     From the Alicat mass flow controller documentation, this data is:
   (...)
    342         The state of the flow controller, as a dictionary.
    343     """
--> 344     state = await super().get()
    345     if state is None:
    346         return None

File ~/devel/python_envs/sampler/lib/python3.11/site-packages/alicat/driver.py:121, in FlowMeter.get(self)
    104 """Get the current state of the flow controller.
    105 
...
--> 468     raise OSError("Could not read control point.")
    469 value = int(line.split('=')[-1])
    470 try:

OSError: Could not read control point.
ericnallon commented 5 months ago

I guess it's possible that the cable I'm using could not be compatible? Anyone able to share what type of cables they used successfully? The MFC has the 8-pin mini-DIN

alexrudd2 commented 5 months ago

I guess it's possible that the cable I'm using could not be compatible? Anyone able to share what type of cables they used successfully? The MFC has the 8-pin mini-DIN

( I replied via email before seeing this issue. 🙄 )

The Alicat pinout can be found here.

I think it's likely your cable (which appears to be intended for a radio) does not have the correct pinout. I don't use a pre-made cable, but rather connect the correct pins myself (with a breakout board). image.

Test your cable's pinout with a multimeter. If it's incorrect, you could cut it in half, strip the wires of interest, and splice them together (you don't need the rest),

ericnallon commented 5 months ago

Alex,

Thanks for the response both here and through email. I'm also thinking it's the cable and hoping that's the issue. I've ordered a USB-to-Serial converter, serial breakout board, and 8P mini-DIN cable I plan to cut and use with the breakout board.

ericnallon commented 5 months ago

Following up on this. Got it working! Made a custom cable and worked first time. Very happy about this. thank you for your help.

alexrudd2 commented 5 months ago

Following up on this. Got it working! Made a custom cable and worked first time. Very happy about this. thank you for your help.

Glad to hear it! If you have further problems please get in touch. Enjoy your new device :)