Software

Posts related to software:
10/1/12
Free MATLAB Program for Building IQ Baseband Signals

In this post we will take a look at a free MATLAB program called IQ Baseband Builder (IQBB) that is available for free download at MATLAB Central. IQBB program allows you to generate an ideal or non-ideal baseband IQ signal, analyze that signal using various plots, and then download the signal to either a CSV file or one of Agilent's new two channel waveform generators, the 33512B and 33522B.

Back in August Agilent introduced a new family of waveform generators, the 33500B series (click here to view my post on the intro). The 33500B features a new exclusive waveform generation technology called Trueform which delivers the performance specs of a high end waveform generator, but at a much lower price point. For more on Trueform waveform generation technology check my post on it by clicking here. From the 33500B series of waveform generators, the 33522B and 33512B provide excellent solutions for generating baseband IQ signals since they provide two channels that can easily be synchronized.

Let's take a look at an overview of the IQBB's features and capaiblities. Below you will find a screen shot of the IQBB GUI.


The IQBB program creates an IQ signal using digital data (binary ones and zeros), user defined modulation type, and a user defined samples per symbol count. The digital data can either be generated randomly by the program (default) or the user can upload existing digital data via a CSV file. For modulation type, IQBB allows the user to select between 4 to 256 QAM formats (Binary or Gray coding). Once the basis parameters of the IQ signals have been defined, IQBB provides the following features for shaping, distorting, and displaying the resulting IQ baseband signals:
  • Pulse shaping filters including raised cosine, root raised cosine, Gaussian, and rectangular. There are also settings for defining filter parameters such as beta and filter order.
  • The ability to add white noise to the I and Q signals.
  • Phase balance adjust of the signals
  • Amplitude balance adjust of the signals
  • DC offset adjust of the I and Q signal
  • Plots for analyzing the resulting signals including a constellation diagram, eye diagram, frequency domain plot, time domain plot, and filter response plot.
Once the I and Q signals have been generated and analyzed they can be exported to a waveform generator (33512B and 33522B) or a CSV file. The IQBB program uses a LAN connection to export signal data remotely to either the 33512B or 33522B.

Let's look at an example of the 33522B's signal quality using a IQ baseband signal created with the IQBB program. The signal was 64 QAM, 5 samples per symbol, and had a raised cosine impulse response. The resulting signal was captured with a wideband scope and analyzed with Agilent's 89600 Vector Signal Analysis software. A screen shot from the software is shown below.


With Trueform technology the 33522B was able to deliver a 64 QAM baseband signal with only 0.3 % error vector magnitude! Notice too that the phase error is in milli-degrees and the magnitude error is in mV.

In this post we look at a free MATLAB called IQ Baseband Builder that allows you to generate ideal or non-ideal IQ baseband signals. The program can connect remotely to an 33522B or 33512B waveform generators and export the software IQ signals so they can be generated in hardware. If you have any questions from this post send me an email and if you have anything to add use the comments section below.


For more info on the 33500B family of waveform generators click here



7/24/12
Free Program for Analyzing Clocks and Oscillators

In this blog post we will look at a free MATLAB program that I created and posted on MATLAB Central for download. The program is called Stability Analyzer 53230A and it provides stability analysis capabilities of clock and oscillator measurements, including Allan and Hadamard Deviation calculations. The "new" program is actually an update to a previous version of Stability Analyzer 53230A that was created over a year ago, but the new version has much more capability. The following is a summary of the program and its capabilities.

Description:
The Stability Analyzer 53230A (2.0) is a free MATLAB program that allows you to analyze the stability of clocks, oscillators, and other signal sources using frequency measurements. The program either inputs / uploads frequency measurements from Agilent’s 53230A universal counter or stored measurements on a CSV file. The program provides the user with a choice of two stability calculations, Allan deviation or Hadamard deviation (both overlapping). The program outputs three plots:
  • Allan or Hadamard deviation plot with optional confidence intervals. 
  • Frequency vs time plot of all measurements 
  • Histogram frequency plot 
All plots provide zoom and pan capabilities as well as the ability to identify a particular plot point. The program is setup and run via a graphical user interface (GUI) and is started from the MATLAB command line. If the 53230A universal counter is used with the program for making measurements then the Instrument Control toolbox is required in your MATLAB package.

Example run:
Below is an example analysis made with the Stability Analyzer 53230A program on a 69.251 MHz oscillator. The gap-free frequency measurements were made with the 53230A universal counter. The measurements were made at a gate time of 10 ms and a total of 5,000 measurements were made for a total measurement time of 50 seconds. The result can be seen below (click to enlarge).


In the Time vs Frequency plot you can see at the measurement gate time (10 ms or 100 Hz) that the dominate noise types seem to be White FM and Flicker FM. From the Overlapping Allan Deviation plot we can see from the slope that from the Tau value of 50 ms to the Tau value of 5 s the oscillator signal is dominated by Random Walk FM noise.

Click here to download the Stability Analyzer 53230A from MATLAB Central

If you are new to stability analysis I recommend the NIST Handbook of Frequency Stability Analysis

Click here for more info on Agilent's 53230A universal counter



6/18/12
Sending Binary-Block Waveform Data to an AWG using MATLAB

In this post we will look at how to send waveform points as a binary-block to an arbitrary waveform generator (AWG) using MATLAB. The reason for sending a waveform as binary data versus ASCII data is simple, the binary data is much smaller compared to the equivalent ASCII data. This cuts down on remote IO latency between the computer and AWG for faster performance. Also there is typically a limit on the size of a waveform that can be sent to an AWG remotely in ASCII so for large waveforms you may have to use binary data. Before continuing there are two previous GPETE blog posts that I would recommend to you related to this topic. The first is a post that covers how to connect to an instrument remotely using MATLAB, to go to this post click here. The second is a post that explains how you can get waveform data from a PC or a scope to a modern AWG without using a remote connection, to go to this post click here.

The MATLAB function that makes the binary transfer of waveform data points easy to do is the binblockwrite(). This function writes binary-block (binblock) data to an instrument. To learn more about the binblockwrite() function check out the MATLAB help page on the method by clicking here or type “help binblockwrite” into the MATLAB command line. Note that the binblockwrite function only be used if you have the Instrument Control Toolbox for MATLAB, which is needed anyway to control instruments remotely with MATLAB. For the binblockwrite function to work properly you need to know the endian format of your computer and the AWG. The term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item (for more info click here). If the endian format of your computer does not match that of the AWG you will need to swap the endian format on the instrument using the proper command before you call binblockwrite.

Let’s lot at an example using MATLAB to send waveform points to Agilent’s 33522A function / arbitrary waveform generator using SCPI. In the below MATLAB example waveform data was converted to a binary-block and sent to the 33522A using a remote USB connection. The SCPI language used in the MATLAB code was for Agilent’s 33521A / 33522A function / arbitrary waveform generators. If you are using a different AWG chances are the command language will be different. The comments in green are describing what is happening in the code.

%opens and creates a visa session for communication with function generator
fgen = visa('AGILENT','USB0::0x0957::0x2C07::MY50000780::0::INSTR');
set (fgen,'OutputBufferSize',2000000);
fopen(fgen);

%Query Idendity string and report
fprintf (fgen, '*IDN?');
idn = fscanf (fgen);
fprintf (idn)
fprintf ('\n\n')

%Clear and reset instrument
fprintf (fgen, '*RST');
fprintf (fgen, '*CLS');

%Clear volatile memory
fprintf(fgen,'SOURce1:DATA:VOLatile:CLEar');

%create waveform
i = 1:1:100000;        % Set rise time (100000 points) */
z = (i-1)/100000;
   
fprintf(fgen, 'FORM:BORD SWAP'); %swap the endian forma
binblockwrite(fgen, z, 'float32''SOURce1:DATA:ARBitrary testarb, '); %send the data using binary to the instrument

fprintf(fgen, '*WAI'); %wait for operation to finish
fprintf('Download Complete\n\n')

%Set desired configuration of 33522A
fprintf(fgen,'SOURce1:FUNCtion:ARBitrary testarb'); % set current arb waveform to defined arb pulse
fprintf(fgen,'SOURce1:FUNCtion ARB'); % turn on arb function
fprintf(fgen,'SOURCE1:VOLT 2'); % set max waveform amplitude to 2 Vpp
fprintf(fgen,'SOURCE1:VOLT:OFFSET 0'); % set offset to 0 V
fprintf(fgen,'OUTPUT1:LOAD 50'); % set output load to 50 ohms
fprintf(fgen,'SOURCE1:FUNCtion:ARB:SRATe 100e6'); % set sample rate
%Enable Output
fprintf(fgen,'OUTPUT1 ON'); % turn on channel 1 output

% Read Error
fprintf(fgen, 'SYST:ERR?');
errorstr = fscanf (fgen);

% error checking
if strncmp (errorstr, '+0,"No error"',13)
   errorcheck = 'Arbitrary waveform generated without any error\n';
   fprintf (errorcheck)
else
   errorcheck = ['Error reported: ', errorstr];
   fprintf (errorcheck)
end

%Save Arb to USB stick, titled test arb
 %fprintf(fgen, 'MMEM:STOR:DATA "USB:\TEST ARB"');

%closes the visa session with the function generator
fclose(fgen);

The majority of the above code is setting up the connection, configuring the 33522A settings, and error checking (to download the 33522A’s programming guide that specifies its commands click here). The main two lines we are interested in for handling binary data are highlighted. The first highlighted line sends a command to the 33522A to swap its endian format to match the format of the incoming data. The second highlighted line is the binblockwrite function, which will convert and send the waveform as a binary-block to the 33522A. The four arguments used in the binblockwrite function are as follows:
  1. “fgen” is the object that refers to the 33522A.
  2. “z” is the array holding the waveform data.
  3. “float32” states the precision. This allows the function to set the number of bits written for each value and the interpretation of the bits. Besides floating-point values, character and integer formats can be used.
  4. “SOURce1:DATA:ARBitrary testarb, “ is the header that will be prefixed to the binary data. In this example it is the beginning of the command to send a binary waveform to the 33522A.
Note that the binary data is in the binary-block format defined by IEEE and the binblockwrite function automatically configures and prefixes the IEEE header to the binary data (the header states the length of the binary data).

The above example MATLAB code creates a simple ramp waveform named "testarb" with a amplitude of 2 Vpp and a frequency of 1 KHz (100 MS/s / 100 KS = 1 KHz). The example MATLAB file was run and the resulting waveform can be seen in the below scope screen shot.


In this post we looked at how to send waveform points to an AWG as a binary-block of data using MATLAB. MATLAB has a function called "binblockwrite" that makes sending binary data to an instrument easy. Before sending the binary data, you want to ensure the endian format of the data matches the AWG's endian read format. Feel free to copy the MATLAB code example used in the post or send me an email and I can send you the .m file. If you have any questions feel free to email me and if you have any personal incites to add use the "Comments" section below.

For more information on the 33522A function / arbitrary waveform generator click here



4/23/12
Controlling Instruments with Excel without Writing Code

The below video demonstrates how to use Excel to connect to, control, and read data back from an instrument. What makes this possible is a free software package from Agilent called Command Expert.  For an overview of Command Expert that was covered in an earlier post click here. When you download the Command Expert software package it creates a plug-in for Excel. You can then use the Excel plug-in to create a spreadsheet that can connect, control, and grab measurements from one or more instruments. This is all without writing a single line of code. From there you can use the various data handling features in Excel, such as plotting, to analyze data and create test reports. The following video demonstrates the capability.


Command Expert is super easy to use and it contains easy to follow examples to get you started. 






3/19/12
Tutorials Using VBA and Excel for Instrument Control

This post provides two video examples on using Visual Basic for Applications (VBA) and Excel for instrument control. The first video is meant to get you started. The second video shows a quick example on reading measurement data into Excel from an instrument. Excel provides an easy way to post process and analyze measurement data with its built-in math functions and plotting capability. It is also low cost since just about everyone has Excel on their work computers. To get the instrument's address the video uses a free software program called Agilent Connection Expert. The link for downloading Connection Expert can be found at the end of this post.




For more details on using VBA just go to YouTube and search on "VBA" there is a ton of videos out there showing various features. If you know of any good VBA examples or tutorials out there please share in the "Comments" section below.

Click here to get Agilent IO Libraries (Connection Expert is part of IO Libraries)



1/31/12
Matlab Function for Creating Arbitrary Waveform Files

This post features a Matlab function called convertToArb( ) that converts a vector / array of data into a waveform format that can be loaded onto Agilent's 3352xA function / arbitrary waveform generators (33521A one channel and 33522A two channel). This function converts a row or column vector into a 3352xA format .arb file (a waveform file that can be loaded onto the 33522A or 33521A). The vector data should contain voltage values ranging from 10 V to - 10 V. The convertToArb( ) function will generate a .arb file in the current Matlab open directory. The file can then be imported to the 33521A or 33522A via a USB memory stick. You can copy the code for the function below or you can download the function from Matlab Central (link at the end).

function convertToArb(data,samplerate,fName)

%check if data is row vector, if so convert to column
if isrow(data)
    data = data';
end
    
%data=importdata(filetoread1);
numberofpoints = length(data);

%Get max and min values from waveform data
data_min=min(data);
data_max=max(data);

%range has to be the maximum absolute value between data_min and data_max
range=abs(data_max);
if(abs(data_min)>abs(data_max))
    range=abs(data_min);
end
    
%Data Conversion from V to DAC levels
data_conv=round(data*32767/range);

fName = [fName '.arb']; %add file extension to file name

%File creation and formatting
fid = fopen(fName, 'w');
fprintf(fid,'%s\r\n','File Format:1.10');
fprintf(fid,'%s\r\n','Channel Count:1');
fprintf(fid,'%s\r\n','Column Char:TAB');
fprintf(fid,'%s%d\r\n','Sample Rate:',samplerate);
fprintf(fid,'%s%6.4f\r\n','High Level:',data_max(1));
fprintf(fid,'%s%6.4f\r\n','Low Level:',data_min(1));
fprintf(fid,'%s\r\n','Data Type:"Short"');
fprintf(fid,'%s\r\n','Filter:"OFF"');
fprintf(fid,'%s%d\r\n','Data Points:',numberofpoints);
fprintf(fid,'%s\r\n','Data:');
%Write data to file and close it
fprintf(fid,'%d\r\n',data_conv);
fclose(fid);

The input arguments for the convertToArb( ) function are as follows:
  • 'data' is the vector containing the waveform points that you want to convert to a .arb file
  • 'samplerate' is the sample rate setting for the 33521A or 33522A. The total time of your waveform is equal to: samplerate * number of points in the file.
  • 'fName' is the name you want to assign to the .arb file that is created, for instance "myArb" will create a "myArb.arb" file.
The following example Matlab script uses the convertToArb( ) function to create a waveform that consists of three different sine waves summed together.

%example script to demonstrate function convertToArb(data,samplerate,fName) 
xAxis = 0:.001:1; %create x axis for plot
count = length(xAxis); %get size of waveform
yAxis = zeros(1,count); %allocate array

for i = 1:count
    %build waveform that consists of three sinewaves summed together
   yAxis(i) = sin((2*pi)*xAxis(i)) + (.5*sin((2*pi)*xAxis(i)*3)) + (.3*sin(pi*xAxis(i)));
end

%call function to convert it to .arb file named myArb.arb
convertToArb(yAxis,1e6,'myArb');

Below is the resulting waveform generated with the example script captured on a scope.






1/16/12
Using the Power of the Cloud in Test and Measurement

Recently an article I wrote entitled "Using the Power of the Cloud in Test and Measurement" was published online by Wireless Design and Development. Below is the first couple paragraphs of the article to read and if you are interested in it follow the link at the bottom to read it in its entirety.

"The cloud" continues to become more and more pervasive in our everyday business and personal lives. Many people today use the cloud and do not even realize it. Gmail and Facebook, for example, are cloud-based services. The cloud, more formally known as cloud computing, refers to software, computation, and data storage/retrieval services, which from a user's perspective, happen somewhere out in the ether. Users don't need to know where the services are homed or how the services are provided.

The cloud model offers several benefits: We no longer have to worry about storage space or processing power because the cloud adjusts dynamically to satisfy these needs. Also, we can be confident that data is securely and safely backed up by the cloud service provider. But best of all, the cloud provides us with ubiquitous access to our data with devices like PCs, smart phones, and tablet computers. In this article, we will discuss how we can use the cloud to access test data and test system resources from anywhere, at any time.

In our global society, product design rarely moves from the drawing board to the manufacturing floor in the same geographical location. It is common for a product's hardware design to be developed in one country, its software design to be created in a second country, and its manufacturing to be completed in a third country. For this model to work well, team leaders often try to create a process that provides geographically separated team members real-time remote access to product test data, testing resources, and the ability to modify test system routines. If they are successful, they can avoid product delays and save money on test equipment. The cloud is a powerful tool for enabling this process.





10/31/11
Agilent Releases "Command Expert" Software

Agilent recently released a free software package called "Command Expert." If you write software that controls test and measurement instruments Command Expert will make your life easier. For non-software writers that need to create remote instrument control sequences this will also make your life easier. One of the best things about Command Expert is it's free. The below bullets outline Command Expert's top four headlines.
  • Enables fast prototyping and development of instrument command sequences
  • Provides seamless integration with Excel, LabVIEW, Visual Studio, VEE and SystemVue
  • Makes it easy to find, use, and view full documentation for SCPI and IVI-COM commands
  • Simplifies the process of retrieving measurement data from instruments
Command Expert allows you to easily build instrument routines or sequences using SCPI and IVI commands. You can then test the sequences and read back measurement data right into the Command Expert interface. Once you have your finished sequence you can save it to run again later or you can export it to your current instrument control programming project. Command Expert will wrap the sequence up into a function that can be directly exported into your programming project (it generates the code for you). Supported development environments  include Visual Studio, VEE, LabView, Excel, and System Vue. You start out by adding your connected instruments to the instrument pane. From there you can select instruments to access their SCPI or IVI documentation. The documentation UI on Command Expert makes it really easy to search, find, and get info on the selected instruments command set. Once you begin adding a command to your sequence, Command Expert has command auto complete capabilities to make it easy. It also can quickly guide you through adding parameters to commands. Below is a screen shot of Command Expert's UI. It shows a user that adding a command to their sequence for a scope that they named "InfiniiVision" (click to enlarge).


You can also insert wait statements into sequences. Once your sequence is built you can test and fine tune it using Command Expert. When you are done you can save your sequence or export it to a programming environment. 

One of my favorite features on Command Expert is how it integrates with Excel. It automatically plugs into Excel allowing you to create stand alone Excel sequences. This an awesome feature for non-programmers or for programmers who just want to setup a test routine quickly. Once you create a sequence using Command Expert you can export it to an Excel spreadsheet where that sequence can run on its own with no coding required (Command Expert must be installed on the PC). On an Excel based sequence you can setup cells on the spreadsheet as input parameters for defining instrument ranges or settings and you can use plotting features for displaying measured data. Below is an example using a scope:


Once again Command Expert is totally free so I encourage you to check it out if you are instrument programmer or if you are looking for a away run instrument routines without buying expensive software packages.




10/24/11
Video Demo Using Agilent iOS Programming Tools with Xcode to Control LXI Instruments

In the video below I demonstrate how to use Agilent iOS IO programming tools using Apple's Xcode to connect and query an Ethernet connected instrument. The tools abstract low level network sockets, data buffering, and error handling to make the creation of instrument control apps faster and easier. The Agilent iOS IO programming tools are free for download along with the example app used in the video. If the video screen is too small to view in the blog just click on it to view directly in youtube where more sizing options are available.


The link below will take you to the webpage where you can download the programming tools demonstrated in the video. On the website you can also find programming tools for Android.

Smart device programming tools website



10/17/11
Matlab Program for Simulating ECG Waveforms with an Arbitrary Waveform Generator

Because of the popularity of my 2/21/11 post Simulating Complex ECG Patterns with an Arbitrary Waveform Generator I decided to create a Matlab program that allows you to create and customize electrocardiogram (ECG) waveforms that can be easily transferred to an arbitrary waveform generator (AWG). The program is called "ECG Waveform Simulator" and can be downloaded free of charge from Matlab Central (see link below). The program allows you to customize the "typical" ECG waveform by allowing you to modify amplitude, duration, and in some cases interval for the standard ECG waveform parts including the P wave, Q wave, R wave, S wave, T wave, and U wave. The program allows you to directly transfer the ECG waveform you created to an 33521A or 33522A AWG via a Ethernet connection or to store it on a CSV file that could later be uploaded to an AWG. This programmed combined with an AWG provides engineers involved with designing and testing ECG monitoring and measurement equipment an simple and flexible test solution.

One huge benefit of using modern AWGs, like the 33521A and 33522A, for simulating ECG waveforms is a feature typically referred to as arbitrary waveform (arb) sequencing. Arb sequencing allows the user to seamlessly create a complex waveform pattern combining multiple arbs stored on the AWG. It is analogues to creating a playlist on your MP3 player using various songs stored in the MP3's memory. Sequencing gives you the ability to create complex ECG patterns by combining multiple ECG waveforms. Below is a screen shot from a scope showing an example of three different ECG waveforms that I created using the ECG Waveform Simulator. The three waveforms were output using the sequencing capability on the 33522A AWG (notice the second waveform is played twice).


In the above sequence the first ECG waveform is played once, the second is played twice, and the third is played once. Of course we could have just as easily played the fist waveform 50 times, the second 10 times, and third 101 times. For more information on creating arb sequences with the 33521A or 33522A check out my post Creating Arbitrary Waveform Sequences.

Click here to download ECG Waveform Simulator from Matlab Central

Click here to check Agilent's AWGs



10/3/11
Plotting Tools Now Available for Displaying Measurement Data on Android Devices

Back in early September I blogged about how Agilent launched a webpage entitled "Smart Device Programming Tools and Examples for Instrument Control" that features IO programming tools for controlling LXI instruments with Android and iOS smart devices. The IO programming tools and accompanying example apps that demonstrate the use of the tools are all free to download (for more info on the IO tools click here). In this post I am happy to announce that last week programming tools for plotting and analyzing measurement data on Android devices were added to the webpage. The free plotting tools are called Agilent Android Plots or AAPlots for short. Below is a sample plot that was created using AAPlots on a Motorola Xoom:

AAPlots includes features like markers, pinch zoom, and touch panning. AAPlots includes the following chart types: XY line chart, scatter chart, stripline chart, histogram chart, area chart, and bar chart. 

Besides just AAPlots, the source code for four more Android example apps were added to the webpage, they are as follows:
  • AAPlotsDemo: This  app demonstrates the use of the AAPlots programming tools in detail
  • Example 34972A: This app demonstrates the use of AAIo and AAPlots on the 34972A DAQ / Switch Unit.
  • Example MSOX3054A: This app demonstrates the use of AAIo and AAPlots on the MSO-X 3054A Oscilloscope.
  • Example 53230A: This app demonstrates the use of AAIo and AAPlots on the 53230A Universal Counter.
The webpage includes an email link for sending sending comments, suggestions, and feedback on the iOS and Android instrument control programming tools.




9/27/11
Remote Long Distance Control of LXI Instruments

Below are two videos I did featuring two flexible low cost wireless methods for remote long distance control of LXI instruments. This is for test / datalogging / data acquisition applications where there is no Ethernet or other network available, for instance when doing outdoor test measurements. The first video features using an RF Ethernet Bridge and the second video features using a cellular router. In each video a particular instrument is featured, but the remote long distance control method discussed could be used with any LXI instrument.

RF Ethernet Bridge:
Cellular Router:

One aspect not covered in the video when using these methods for remote long distance control of LXI instruments is network latency. Because of the distance between the computer and instrument and because of the various network layers, network latency can be much longer so any software created for these types of long distance instrument control application should be robust enough to handle longer network latency. For more info on using a a cellular router check out an earlier post I did on using a cellular router for instrument control, click here



9/6/11
Smart Device Programming Tools and Examples for Instrument Control

I am excited to announce that Agilent just launched a website where you can download free of charge smart device programming tools and examples for instrument control. What is a smart device you ask? Smart device refers to the smart phones and tablet PCs that continue to become more and more a part of our personal and professional computing and connected lifestyle. One of the big benefits of smart devices for test and measurement is they offer the ultimate in ubiquitous access to test data and instrument control. They are natural fit with LXI instrumentation since they can communicate with an Ethernet network, either using Wi-Fi or through a cellular provider’s network via the Internet.

One of the challenges today of using smart devices for Ethernet based instrument control is there is a not much smart device programming experience out there and there is a lack of smart device programming tools specific to the test and measurement industry. Agilent is working to change that by providing programming tools and example code for Apple’s iOS and Google’s Android specifically designed for LAN / LXI instrument control.


The first programming tools and examples we are rolling out are for instrument IO. When you create instrument control software on a Windows-based PC, many IO tools are available, such as VISA and IVI-COM drivers, that make instrument programming easier by doing all the low-level connection management and data handling for you. Unfortunately these tools and drivers do not exist for smart device programming environments until now. The IO programming tools can be downloaded below for both the iOS and Android. Also below you will find other links for content related to LXI instrumentation and using smart devices for instrument control. 

Also on the webpage you will find an email node. Please feel free to use this email node for any questions you have on using the smart device programming tools and for suggestions on future smart device programming tools you would like to see. The link for the new webpage can be found below, enjoy!




8/16/11
Simple Way to Use the Power of the Cloud for Test and Measurement

In today's economy technology companies have their resources spread across the globe. These global engineering resources have to work closely together throughout the design and testing life cycle of a product. One major challenge these global engineering teams face is sharing real test data access or control of testing resources across thousands of miles and country borders. In this blog post we will look at a simple but secure example of how to use cloud computing or the cloud to share test data and test resource control across the globe.

Cloud computing refers to using hardware and software computing resources in a computer network, such as the internet, for computation and storage, instead of just on a local computer. I am going to use the term “cloud” in this article to refer to computing assets on the internet that are provided by a third party such as Google or Amazon. The cloud can provide three main benefits to test:

1. Share test data across global engineering teams that can be accessed anywhere at any time without a company firewall getting in the way.

2. To serve as an always connected intermediary between your test software and your computing device. Imagine starting or stoping a test from your smart phone at the airport.

3. You can leverage the massive computing capability of the cloud for test applications that require a lot of computing power for post processing measurement data.

In this post we will focus on cloud benefits for bullets 1 and 2. For our cloud test example we will use a popular and free cloud service called "Dropbox." Dropbox allows you to set up a folder or file directory on your computing device, such as a PC or smart phone, that is sync'd to the cloud (Dropbox server) for backup. When you change or add a file on one computing device Dropbox will automatically sync the change or addition on any other computing device you have Dropbox installed. For security Dropbox is password protected, for more info on Dropbox click here.

For storing, sharing, and viewing test data Dropbox is a great tool for 3 main reasons:

  1. It allows you to securely back up your test data on the cloud 
  2. It allows you to easily share test data among geographically separated teams and companies, such as if you are using a CM that does not have access to your companies intranet.
  3. It allows you to access test data from almost anywhere securely without having to deal with a VPN, such as if you wanted to check the outcome of a test on your smart device at an airport in India.
Now getting the test data to Dropbox is fairly easy since all major software development environments like Labview, Matlab, or Visual Studio have easy to use APIs that allow you to write data to various file types such as an Excel Spreadsheet. The way we incorporate Dropbox into the test mix is by having our test program write to files that are located in a Dropbox folder. Then as long as the computer running your test program is connected to the internet Dropbox will automatically send your test data to the cloud and sync it to other computing devices sharing that same Dropbox account. Now the test data is safely back-upped and securely shared.

We can even go a step further and add certain types of remote control aspects to our test using Dropbox. If instead of just writing data to a file on Dropbox, we have our test program also read from a file we could could control our test from the cloud too! We could do something as simple as use a small section of the test data file for changing basic test settings to something as complex as using a scripting language to change entire test routines. 

As a proof of concept for this post I setup an example cloud test using Agilent's 34972A DAQ / Switch Unit, VEE programming language, and Dropbox. The example cloud test was created to simulate a long term DAQ type testing environment. It makes temperature, voltage, fan rotation, and irradiance measurements on a DUT. I added two simple settings controls to the test data Excel file that allow you to turn on or off a fan and heater on the DUT. The VEE program reads the settings from the Excel file periodically and uses the control features on the 34972A to change the DUT settings. Below is a screen shot of the excel spread sheet from my example cloud test program (click to enlarge). You can also get your own read-only version of my test data file using the Dropbox link I provided below.




To conclude Dropbox provides an easy to use secure way to leverage the power of the cloud to back up, access, and share test data easily and securely. We even looked at a way to use Dropbox and the cloud to control a test remotely from anywhere without the hassle of VPNs. If you have a test example where you use the power of the cloud I would love to hear about please share as a comment or shoot me an email.



7/19/11


Going Cellular with LXI

Test and measurement instruments with the LAN eXtensions for Instrumentation or LXI standard use LAN or Ethernet for remote connectivity (click here for more info on LXI). The Ethernet standard is widely used all over the globe and because of its wide use there is a wide array of low cost off the shelf networking products that make connecting to LXI instruments from anywhere at any time with various types of computing devices possible. The wide array of off the shelf LAN compatible network products available today provides a major advantage for LXI in long distance testing, long duration testing, distributive testing, and various DAQ applications because of the low cost and connection flexibility they provide. In this blog post we are going to look one such off the shelf networking device, a cellular router, and the benefits it provides for testing.

The router you use at home uses an Ethernet connection to access the internet. A cellular router on the other hand uses a cellular provider’s network to access the internet. This means if you connect an LXI instrument to the cellular router that instrument can now be accessed from any cellular network or WiFi network or Ethernet network that is connected to the internet. This provides four big test advantages:
  1. It gives you the ability to easily setup long distance remote testing sites from almost anywhere around the globe as long as it is in range of a cellular tower. 
  2. It gives you the ability to run a distributed test with one remote controller.
  3. It allows you to access measurement data or control instruments from almost anywhere around the globe with various computing devices such as a laptop, smart phone, or server.
  4. It allows you to perform remote testing in a moving vehicle as long as the vehicle remains in the range of cellular network towers. 
As explained above and illustrated in the figure below, cellular routers make LXI instrument access almost totally ubiquitous.

No cellular provider is going to let you use their network for free so you do need to purchase a mobile broadband USB stick or a WiFi broadband tethering device along with a monthly data plan. The USB broadband device can be connected directly to the cellular router or the WiFi broadband tethering device can be connected over WiFi. Of course with the WiFi broadband tethering device you could just use a basic WiFi router that has a bridge mode.

There are some security hurdles and concerns you should be aware of when using any router. Consumer routers, including cellular routers, in default mode assume all the devices connected directly to them are client devices and not servers. Because of this they block all external connection requests from client devices outside of their local network. This is a big problem because LXI instruments are servers (that is how they host a web page) so computers or controllers external to the router's network that try to connect to them will be blocked by the router. To overcome this you need to access the router's port forwarding feature or DMZ feature. Port forwarding allows you to specify certain network ports to allow connection requests to come in on and which IP address on the router’s local network to forward them to. You can also use the router's DMZ feature which allows you to forward all incoming connection requests, regardless of port, to a specified local IP address. Using port forwarding and DMZ features also opens up security concerns. Any opening you make into the router to access an instrument is open to anybody on the internet. This can be especially troublesome to LXI instrument running a Window's based PC operating system because they are vulnerable to cyber attacks. The port forwarding method is more secure than DMZ because it allows you to use obscure port numbers that are not used by the general public and then forward the connection request or message to a more commonly used port on the instrument such as port 80 or 5025. For more information on increasing security when accessing instruments through a router shot me an email.

When purchasing a cellular router you want to pay attention to its list of compatible broadband devices. Also be aware that the cellular provider that you purchase the broadband device from probably does not guarantee that their device will work on a cellular router so if you need support help go to the manufacturer of the router. Currently the largest cellular or broadband router maker is cradlepoint, you can check them out at http://www.cradlepoint.com/

.



7/13/11

Fetching Large Amounts of Instrument Data with Matlab

Matlab is a great tool for handling and analyzing measurement data, but you can run into problems when trying to read or fetch large amounts of measurement data from an instrument. Problems range from timeouts, to memory errors, to only a portion of the measurement data being returned. In this post we will look at an easy to implement Matlab code example for fetching and storing large amounts of measurement data.

Let's start out by looking at a high level overview of the easy way to write a quick matlab script for making and fetching measurements with a remote instrument:

  1. Setup and open a connection to the instrument. One of the steps here is setting up the size of the input buffer for reading measurement data.
  2. Configure the instrument for the measurement.
  3. Trigger the measurement.
  4. Fetch the measurement data from the instrument using the query() method and store it in one huge string
  5. Convert the string of data to a number format array like double for post processing and analysis
This method is easy to implement but can lead to problems when dealing with large amounts of data. There are a couple of reasons for this. The first being it does not use memory very efficiently. Notice between the input buffer allocation, the long string that the data is read to, and the final numerical array there are three large chunks memory being allocated for one set of data. This can lead to "Out of memory" errors. Especially in Windows machines where RAM is fragmented between a number of processes and Matlab needs contiguous memory to store a numerical array. Another reason is the various protocol layers that are used in an IO operation can be unstable when reading a large contiguous chunk of data. 

A better and still easy to implement way to fetch large amounts of data is to format it as binary data (versus ASCII) over the IO and to break the data into smaller blocks and reassemble the blocks in Matlab. Lets demonstrate with example Matlab code. For this demonstration we will make 1M double format timing measurements on a 2 GHz oscillator using the Agilent 53230A universal counter. Below we will look at only the code portions that involve reading the measurement data. If you would like a full version of the "Lots_of_Data.m" script used here just email me. 

%The Lots_of_Data script makes 1M timestamp measurements on 
%a 2GHz oscillator using the 53230A. The measurements are read 
%from the instrument in binary form. The measurements are read
%and handled in 500 reading block sizes set the input buffer 
%size in bytes.We want to read in 500 readings per block each 
%reading is 23 bytes including comma. 'obj1' is the handle to the 
%53230A object
buffer = 23 * 500;
set(obj1, 'InputBufferSize', buffer);
%Perform measurement settings and trigger 
%Here we send readings to 53230A output buffer 
fprintf(obj1,'FETCH?');
%fread()will be used to read all measurements as binary data 
%instead of ASCII characters to cut down on overhead
%get prescale value first and convert to string then to double
prescale = fread(obj1,5);
str2double(char(prescale))'
%allocate double array for faster performance
arrayDouble = zeros(1,1e6);
%read blocks of 500 readings from the 53230A at a time. 
%Convert the binary values to doubles and add to the array 
%of doubles. This method conserves memory versus reading all 
%the data in at once
for i=1:2e3,
tempBin = fread(obj1,(23*500));
 %replace string commas with spaces so we can convert to double array
tempChar = char(tempBin)';
tempChar = strrep(tempChar, ',', ' ');
%replace array of string values to array of doubles
  if i ~= 1
        arrayDouble((((i-1)*500)+1):(i*500)) = strread(tempChar);
  else
      arrayDouble(1:500) = strread(tempChar);
  end
end

In the above example the 'fread' method was used to fetch the data in binary form instead of ASCII data. This reduces the size of the data being passed over the IO. Also the 1M readings were collected in blocks of 500 that were later reassembled in a numerical array for post processing and analysis. This means we only had to allocate one large chunk of memory instead of three like we did in the first example.

If you know of a better more efficient way to fetch large amounts of measurement data and store it in Matlab please share with a comment below or an email to me. If you are working with extremely large sets of data and get out memory errors check out Matlab's video on optimizing memory usage from the link below. You can also track your Matlab memory usage for optimization purposes using the free Memory Monitor program (link below).






6/1/11

Agilent Releases First Ever LXI Instrument Control Smart Device App

On May 27th Agilent released the first LXI direct instrument control application for iOS based smart devices like the iPhone, iPod, and iPad. The app allows you to control and monitor Agilent's popular 34972A LXI Data Acquisition Unit. The 34972A is often used for remote and / or long term DAQ applications so it is a great fit for monitoring and controlling via a mobile device. The 34972A DAQ app was developed by yours truly with some help from a colleague on Agilent's R&D software team. The 34972A DAQ app can be downloaded free of charge from the App Store. A link to the 34972A DAQ app can be found below at the end of this blog post.
I also wanted to advertise an article I wrote that was published by Evaluation Engineering entitled "Controlling LXI Instrumentation With Smart Devices." The article is based on my experiences creating the 34972A DAQ app. It discusses network hurdles you face when communicating with LXI instrumentation via a smart device and some of the coding complexities you face when creating LXI instrumentation control software for smart device. The link for the article can be found below.

Finally if you are interested in getting started creating your own LXI instrument control software for the iOS platform I can send you some free code for a simple example app I created. The app is called "StarIDN." The StarIDN app will connect to an LXI instrument, send the "*IDN" SCPI command to the instrument, and display the result. If you are interested in the sample code send me an email at neil_forcier@agilent.com. You can open the sample app using Apple's Xcode development environment by navigating to the "StarIDN.xcodeproj" file in the app's folder. Downloading Xcode and running the StarIDN app in the iPhone / iPad simulator that Xcode provides is totally free. If you want to run the app on a real iOS device or submit a finished app to the iTunes App Store you will have to dish out $99. Use the following link to get started as an iOS developer http://developer.apple.com/devcenter/ios/index.action.







5/7/11

Free Matlab Program for making Allan Deviation Measurements with the 53230A Universal Counter

Recently I created a Matlab program for making Allan deviation measurements using Agilent's 53230A universal counter called "Stability Analyzer 53230A." The program performs true Allan Deviation measurements using the 53230A's gap-free sampling capability. The program provides an "All Tau Analysis" plot of the Allan deviation calculations. The Allan deviation calculations made are based on an array of Tau values you as the user provide. A second plot is also done of the measurement data that features time on the x axis and frequency on the y axis. All of the measurements and Allan deviation calculations can be accessed from the Matlab's command line after the program runs for further analysis. It is a great easy to use program for doing general frequency stability measurements on oscillator, clocks, and amplifiers.

The program uses LAN to connect and control the 53230A. All you need is the 53230A's IP address to connect. The program requires Matlab's Instrument Control Toolbox package to be installed. You can make the measurements on any of the 53230A's channels including channel 3, the optional microwave channel. This give you the ability to make stability measurements all the way up to 15 GHz. The "Stability Analyzer 53230A" program is free to download from Matlab Central (link below). In the downloaded program folder there is a Word document with operating instructions.

Below are two plots from an example run of Stability Analyzer 53230A (double click to enlarge). The example signal used was a 10 MHz signal with 0.1 Hz of frequency modulation added to simulate a cyclic disturbance such as temperature cycling. We can easily deduce the frequency of the cyclic noise in either plot. In the Allan deviation this is clear because we see dips at tau value 10s which is equal to the period of the noise and 20s which is an integer multiple of the noise's period. In the second plot we can see the time domain shape of the noise (sine) and its period.









5/2/11
Agilent Releases BenchLink Waveform Builder Pro

Today (5/2/11) Agilent released its 33503A BenchLink Waveform Builder Pro Software. Waveform Builder Pro is the first full-featured waveform creation software for pulse/function/arbitrary waveform generators. The software enables engineers to take full advantage of the signal generation capabilities of the Agilent 33200 Series, 33521/22A, 81150/60/80A waveform generators and makes custom waveform creation fast and simple! This Microsoft Window-based program provides easy-to-use arbitrary waveform creation tools and libraries of advanced signals, waveform sequencing, equation editor, signal filtering and windowing functions.


This is pay for software ($750). I had a chance to test it out for a couple of hours. It is fairly easy to use compared to past waveform editor software I have used. It gives you a lot of waveform editing and math tools that you could only get in a software package like Matlab, but a lot easier to use and cheaper. Below are some key features on the 33503A BenchLink Waveform Builder Pro Software:
  • Standard waveform library provides quick access to common signals (sine, square, triangle, ramp, pulse, exponential)
  • Comprehensive library of built-in signals provides fast and easy access to complex signals
  • Free-hand, point, and line-draw modes to create custom shapes
  • Equation editor allows you create waveforms with exact polynomials
  • Advanced math functions provide additional flexibility for more complex signals
  • Sequencing editor allows you to build and arrange composite waveforms to optimize your design
  • Filtering and windowing functions allow you to smooth transitions between waveforms
  • Fast Fourier Transform (FFT) allows you to view the frequency characteristics of your signals
  • Complimentary Cumulative Distribution Function (CCDF) curves allows you to view the power characteristics of your signals

1/17/11
Connecting and Controlling an LXI Instrument Using its Web Interface



From speaking with LXI instrument owners I have noticed that a large majority of them do not even realize that their instruments have a built in web interface hosted by a web server inside the instrument. Often these web interfaces provide a way to control the instrument remotely with only a web browser. In this blog post video I show you how to connect to and access an LXI instrument's web interface.






9/25/10
Innovative Way to Interface a Measurement Instrument with a Computer

In this post I am taking a turn from the usual. Typically when I praise a new product it is an Agilent product. Here I am going to lay some praise on an innovative new NI product, USB-TC01 Thermocouple Measurement Device. The innovation in this device is not the measurement technology but the way it interfaces with a computer allowing you to easily retrieve data. Typically interfacing a measurement instrument with a computer and retrieving measurement data from it involves either installing software (that you may have to pay for) or installing drivers and creating your own software. The clever USB_TC01 requires no drivers and no software! The way it works is by connecting to your computer via USB. To Windows the TC01 appears as a mounted disk drive (so no driver). By navigating to the now mounted TC01 “drive” you can launch software that is stored on the TC01. The software allows you to display readings, log readings, and download readings. It also has extras that make it easy to interface with LabView. Pretty cool functionality for a mere $129 price tag.
The technology is similar to the LXI instrument connection standard (to learn more about LXI click here). An LXI compliant instrument acts like a web server so you can connect it to a computer via LAN. The difference between LXI and the TC01 is LXI does require software (web browser which everyone already has), you need to know the instrument’s IP address or host name, and the LXI standard only requires instrument manufacturers to put network setting control in the web interface and not instrument control. Although most LXI instrument manufacturers, like Agilent, allow you to control and retrieve data from the instrument via the web interface.


7/9/10
Easy Instrument Connectivity with Matlab

Matlab is my favorite tool for creating complex arbitrary waveforms since it has a wealth of built-in mathematical capabilities and makes it easy to create and manipulate long floating point matrices. But often when I suggest matlab to colleagues as a tool for creating arbitrary waveforms for test instrumentation they either don't know matlab can connect to instruments or they think they have to sit down and learn how to use some complex driver. This could not be farther from the truth! Matlab makes it easy to connect to instrumentation by providing a graphical user interface instrument control toolbox. Here is a quick summary on how to access and use matlab's instrument control toolbox.
1. Go to matlab's 'Start' menu, select 'Toolboxes', select 'Instrument Control', and 'Test and Measurement Tool' as shown in the top figure.
2. Follow the instructions to establish a connection with the instrument as shown in the middle figure.
3. Go to the 'Session Log' tab and copy the needed connection code from the window and paste it in your script or function.
Now isn't that easy?
For any Matlab experts out there, when I try to build strings that are 1.2 MB long Matlab lab seems to lock up on me (I give it a while to run). Is there a special way to handle strings that long or is that out of matlab's capabilities (which I doubt)?






For more information on Matlab's instrument control toolbox click here