Communicating with a Bronkhorst Mass Flow Sensor - Device has no serial number?

274 Views Asked by At

I'm trying to communicate with a few scientific measurement devices in our lab and came across a strange issue. We use Bronkhorst Mass Flow Readers to measure the amount of helium gas running through our lines.

NOTE --- I'm running my code through git bash on a Windows 10 machine. The hardware is connected via an RS232 cable. I have not tested this on Linux, but I can if necessary for troubleshooting. We are forced to use Windows 10 because of a different piece of hardware. If Linux ultimately works, I'll need to find a Windows 10 solution anyway.

In an attempt to write a class to automate the COM port determination, I found that these devices don't output a serial number. The below code shows what I'm doing, I'll provide more detail momentarily.

import serial
from serial.tools import list_ports
import pandas as pd


def identify_devices():

    a = list_ports.comports()
    df = pd.DataFrame()
    df['com_port'] = [port.name for port in a]
    df['vendor_id'] = [port.vid for port in a]
    df['product_id'] = [port.pid for port in a]
    df['serial_number'] = [port.serial_number for port in a]
    df['description'] = [port.description for port in a]
    df['location'] = [port.location for port in a]
    df['manufacturer'] = [port.manufacturer for port in a]
    df['product'] = [port.product for port in a]
    df['interface'] = [port.interface for port in a]
    df['hwid'] = [port.hwid for port in a]

    return df

There's a lot more to the code, but it essentially boils down to this. The output is as follows.

In [18]: identify_devices()
Out[18]:
  com_port  vendor_id  product_id serial_number                              description location           manufacturer product interface                                     hwid
0     COM4     1027.0     24577.0      FTSTT5NA                   USB Serial Port (COM4)     None                   FTDI    None      None       USB VID:PID=0403:6001 SER=FTSTT5NA
1     COM1        NaN         NaN          None               Communications Port (COM1)     None  (Standard port types)    None      None                           ACPI\PNP0501\1
2     COM6     1027.0     24577.0     FTXEF0AHA                   USB Serial Port (COM6)     None                   FTDI    None      None      USB VID:PID=0403:6001 SER=FTXEF0AHA
3     COM5     1659.0      8963.0                Prolific USB-to-Serial Comm Port (COM5)      1-8               Prolific    None      None  USB VID:PID=067B:2303 SER= LOCATION=1-8

COM5 above is the device I'm interested in. I was expecting a serial number similar to the ones in COM4 and COM6 to populate that field, but instead it's empty. I've tried looking into the RS232 cable to see if it's blocking the serial number somehow, but I came up empty-handed.

I've tested this with multiple Bronkhorst devices and 3 different RS232 cables, they all produce the same issue. I can't imagine the devices do not have serial numbers.

I'm looking for a solution or some direction on where to go from here. Please let me know if there are questions or if clarifications are needed, thank you.



EDIT:

I checked out the device manager in Windows and found the correct serial information for the COM4 device hidden in the parent property. Navigating to that same location in the Bronkhorst device manager, I find that the layout is a bit different. See the picture below.

What are the differences here? Can pyserial look for items in the ROOT_HUB30 path?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I can't imagine the devices do not have serial numbers.

Sorry, you did hit the jackpot with those Prolific chips. Apparently, they ship with no serial number written. Older devices did not even have a spot to write a unique serial number (see here).

If you are lucky your chips will be of the newer sort and you should be able to write a serial number yourself using Prolific's tool.

If that's not a solution for you (I'm thinking maybe those are client's products and you'd have to ask for their permission) maybe you can tweak pyserial to swallow and clean those numbers (whatever they are) you are getting.

If you look at the code that should not be very difficult...

I used to have some of these Prolific bridges but unfortunately, I could not find any of them so all of the above is just hearsay. Anyway, I hope you find it helpful.

EDIT: I got hold of one Prolific bridge but unfortunately, this one was of the older 2303HXA type. There is no OTP memory or even an EEPROM so writing the serial number is out of the question (there is no place to write it to).

But I can confirm the same behavior you got on Windows (I even got a warning informing me that the device has been phased out and not supported since 2012). On Linux, there is no serial number anywhere either.

I've also noticed that if you want to write to the newer chips you will need to supply the port with 6.5V instead of the normal 5V you get from the USB (Prolific offers an adaptor but I guess it should not be difficult to DIY it).