• 0
xcellsior

Read serial number of AD2 using a CLI script in Windows

Question

I'm looking for a way to read the serial number of an AD2 that is connected to a Windows PC.  Here's the why:  I have ~30 AD2 units that are interfacing custom electronics.  Each AD2-Custom Electronics setup has a unique calibration file.  We are moving to netboot for our PCs, so, I need a way to copy the calibration file that goes with the AD2 serial number to the PC that is booting off the network.  We are planning to add between 100 and 300 more AD2 units to this test array so I need to automate this.  So, if I can run a script at startup that can read the AD2's serial number, problem solved.  As a side note, this might move to a PI if we can find a way to interface a PI with the AD2.  That being said, I think we would still want an easy way to read the AD2's serial number from CLI.  For now, I'm looking for answers on how to do this with Windows.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @xcellsior,

I haven't done anything like this specifically, but I did jump down the rabbit hole and found you can use this command in Windows PowerShell to list out the Device ID of an attached Analog Discovery 2 (presuming it is the only "USB Serial Converter" device attached to the PC):

Get-WMIObject Win32_PnPEntity | where {$_.Name -like "USB Serial Converter*"} | Format-Table PNPDeviceID

The 12 digit value after the last backslash (\) will be the serial number of the attached Analog Discovery 2. I did not determine the CLI equivalent of this command though.

If by chance when you say "PI" you happen to mean a Raspberry Pi, the Analog Discovery 2 and accompanying WaveForms software are compatible with the Raspberry Pi 4 Model B.

Let me know if you have any more questions.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0

Hi @xcellsior

You can use the system reported USB SN but you could also use WF SDK from your application or Python script to enumerate the connected device(s).

image.png.aa8af1de9093e7969b65be3cb3697a32.png

image.png.20df683bc149526e91f1617ab8fc651d.png

Share this post


Link to post
Share on other sites
  • 0
14 hours ago, JColvin said:

Hi @xcellsior,

I haven't done anything like this specifically, but I did jump down the rabbit hole and found you can use this command in Windows PowerShell to list out the Device ID of an attached Analog Discovery 2 (presuming it is the only "USB Serial Converter" device attached to the PC):


Get-WMIObject Win32_PnPEntity | where {$_.Name -like "USB Serial Converter*"} | Format-Table PNPDeviceID

The 12 digit value after the last backslash (\) will be the serial number of the attached Analog Discovery 2. I did not determine the CLI equivalent of this command though.

If by chance when you say "PI" you happen to mean a Raspberry Pi, the Analog Discovery 2 and accompanying WaveForms software are compatible with the Raspberry Pi 4 Model B.

Let me know if you have any more questions.

Thanks,
JColvin

Thanks, I'll have to check this out too.  And yes, PI = Raspberry Pi.  I guess I need to start looking into WaveForms.  We are presently using LabView, but it sounds like there is a python lib based on another post, and honestly, I would like to convert the core work from LabView to python if they can accomplish the same task.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now