Tuesday, February 20, 2018

Taking Control of Instruments With LabVIEW

If you have ever thought "Man, I am so sick of pushing these buttons on this instrument I could punch someone!", or your instrument is strategically placed on the opposite side of the lab from your computer, then you are in luck. The everyday mundane tasks of using instrumentation for your projects is inevitable. Sometimes it requires pushing buttons every hour or so, and sometimes it requires pushing those buttons 30+ times a minute. In short, doing this for days on end can lead to mental breakdown. Science proves it.

A very common and complex instrument to deal with is a spectrum analyzer.

These instruments are packed with so many modes, buttons, and screens that it is hard to keep track of where you are, and what you are actually trying to measure. What is even worse is having to take the same measurement over and over again on different frequencies, which requires even more button pushing! I dare say you spend 85% of the measurement time setting up the instrument, connecting cables, and fumbling around the menus, and 15% of the measurement time actually taking your data measurement. There is a ton of lost time in doing this, and even more dangerous is the pent up anger that builds.

This is where LabVIEW can help. LabVIEW Drivers can be created to control this instrument. And if you are lucky, there might already be LabVIEW drivers someone else created out there that you can utilize. But the big question is, where do you start? The very first place I look for these LabVIEW drivers when I get a new instrument handed to me is www.ni.com/idnet. This site has a wide variety of LabVIEW instrument drivers available to download for free. In a perfect world, every instrument you look for will already have LabVIEW drivers already created. But chances are you will have an instrument that you cannot find any LabVIEW drivers. Let us know, and we can write you some LabVIEW drivers! We have done this for several instruments already. Just for the sake of this blog post, I went and found the LabVIEW drivers for a Keysight N9030B spectrum analyzer. I downloaded the project and have over 350 already made LabVIEW driver commands for the spectrum analyzer.

So LabVIEW driver development is already done, check that one off the list. Now that I have the LabVIEW drivers, what do I do with them? You can simply create a VI by placing the LabVIEW driver calls, and wire them together. Here is an example of how to use the LabVIEW driver calls.

Here is a simple VI I created to control the spectrum analyzer. Here is the order of the LabVIEW driver calls: Initialize, set to Swept SA, set center frequency and span, set a marker, do a peak search, change mode to Channel Power, take a channel power measurement, and finally close the communication. In the amount of time that you read that, I could have probably run this VI four different times. No joke. Now imagine how much you could accomplish in a day by making a simple VI like this one! Now imagine if you made more and more of these VIs, incorporated switching, and made a graphical user interface. You could have yourself an automated test, without ever having to push buttons, connect/disconnect cables, fumble through menus. Life would be great, wouldn't it?! This is the power of LabVIEW and controlling your instruments.

Don't have time to do all of that, or completely feel overwhelmed? Let us know! We can help by making the automated test for you! This is where Endigit excels.

I'm sure there are still a lot of questions about controlling instruments, and we are going to have this be a series of instrument control posts. We will dive deeper in some of these subjects.  Comment below if you have any requests for blog posts about instrument control, or anything else, for that matter, that you want to read a blog about!