Click here to Skip to main content
15,867,308 members
Articles / Web Development / HTML

FreeCal - GPIB Instrument Automation for Metrology Test and Measurement

Rate me:
Please Sign up or sign in to vote.
4.65/5 (19 votes)
4 Sep 2017CPOL6 min read 175.1K   7.4K   90   33
FreeCal is a free 100% .NET suite of utilities and instrument drivers for controlling multiple instruments in a Test and Measurement environment.

Sample screenshot

*** UPDATE - 04SEP2017 ***

A quick announcement to inform everyone that I have updated the source code to .NET 4.6.2 and fixed all of the errors that showed up.  You can find the latest source code on GitHub here https://github.com/scottpage/FreeCal.

I'm working through an issue that spews files all over the desktop, so use caution when building/running the program.  I'll have it resolved in a few hours, so you may want to wait until you see the timestamps change on the master.  I posted the latest update around 1930 CDT (0030 UTC)) on 04SEP2017.

I'll revise this write-up as things change.

Cheers! 

Introduction

FreeCal is a free 100% .NET suite of utilities, procedures, and instrument drivers for controlling instruments in a Test and Measurement environment. However, it can be used for any type of Instrument Control needs. I have started to develop libraries for TCP/IP, USB and serial devices.

The demo application will not run unless the NationalInstruments.NI4882.dll file is installed in the GAC. You can rebuild the source and change all references from the GAC to a specific file location. The application also requires that you have a National Instruments GPIB interface controller installed (USB, PCI or ISA card) in the system.

You can download the National Instruments drivers from here, but if you are downloading the source for this application then you probably already have everything you need.

Note: My apologies to all of the VS.NET users. For the past 6 months I only had the SharpDevelop IDE and not VS.NET. I now have VS.NET, and have converted the entire application. The new VS.NET source can now be downloaded from this page using the the link provided above.

Scope

My goal for this application is to provide a 100% free alternative to applications like LabView, LabWindows, SureCal, MetCal, and MeasurementStudio for Visual Studio .NET.

Features

  • Base instrument libraries for Signal Generators, Spectrum Analyzers, Network Analyzers, Power Meters, Function Generators, Universal and RF/Microwave Counters, Attenuator/Switch Drivers, EEPROM Power Sensors, Digital Multimeters and any other type of instrument that can be controlled remotely. All categories have specific instruments that have been coded for compatibility (due to the fact that all instruments have their own specific language for communication).
  • Charts/graphs are integrated into the code with the use of ZedGraph: A flexible charting library for .NET (Thanks to JChampion for ZedGraph, many sleepless nights have been avoided developing an integrated charting library).
  • Procedures for Power Sensors, Signal Generators, Spectrum Analyzers and Network Analyzer Calibration Kits have already been developed (so far most of them partially completed due to time), but they are not difficult to create as you will see in the examples below.
  • Several conversion functions included to aid in the development and presentation of data: Frequency conversion from one range to another (i.e. MHz to GHz), Amplitude and Time conversions are also included as a base for almost all formulas and instrument communication.
  • I recently started construction of a visual editor that allows "drag and drop" style test creation. It is included in the source and can be found in the demo under the Tools menu.
  • Integrates with MySQL using the MySQL.NET Connector. I have created a number of data classes that ease the task of saving result data to a MySQL database.
  • Various forms have been created for several of the instrument categories, like Network Analyzers. One of the most difficult tasks in RF/Microwave is downloading and manipulating data from the Agilent 8500 Series NWA, so I spent a lot of time writing the NWA data transfer classes.
  • Because every instrument has its own tolerances and capabilities, the drivers have been written to include all of this (any missing information is easily added as it is all structure based).
  • Instrument drivers and procedures are written with a "One Procedure Any Instrument" mindset. You can write one procedure that can calibrate any instrument of the same category. This is due to each instrument driver including the specifications for each test.

Requirements

The following software/hardware is required to operate FreeCal:

  • The National Instruments NI-488.2 (Win32) Version 2.3 driver.
  • One of the following NI boards: AT-GPIB/TNT(PnP), GPIB-ENET/100, GPIB-USB-B, PCI-GPIB, PCI-GPIB+, PCI-GPIB/LP, PCI-8212, PCI Express(TM) Interface for GPIB, PCMCIA-GPIB, PCMCIA-GPIB+, PMC-GPIB, PXI-GPIB, or PXI-8212, PXI-8232.
  • Some knowledge of GPIB instrument communication may be required depending on the instrument you are creating or the test/procedure you may develop. The NI driver download includes all GPIB documentation you should need to properly understand its use.

Quick Start

If you just want to get started controlling an instrument, the following is all you need:

  1. First, install the NationalInstruments.NI4882.dll file (located in the FreeCal\Program\Resources folder) into the GAC (all references point to the GAC for this file, unless you want to specify that all libraries look for the file at a specific location instead). This file is also installed when you download the National Instruments Win32 GPIB driver v2.3.
  2. Add a reference to the NationalInstrument.NI4882 library in the GAC, or if you decide to use the file directly then specify its location. Also reference the FreeCal.Instruments.dll, and depending on the family of instrument you wish to control, its respective library. For example, if you want to control a Signal Generator, then add a reference to the file FreeCal.Instruments.Microwave.SignalGenerators.dll. Some instrument libraries make reference to the FreeCal.Data.dll and if required the compiler will state that a reference must be made.
  3. Include the following line of code in the Namespace declaration section at the top of your code file (depending on the family of instrument to be controlled).
    VB
    Imports FreeCal.Instruments.Microwave.SignalGenerators
  4. Create a variable of the family (or specific instrument you are controlling).
    VB
    Dim SigGen As SignalGenerator = New AgilentE4433B(0, 19, False)

    The first parameter is the board (0 - 3), the second is the Primary Address of the instrument, and the third parameter is normally always false (used for pulling the current instrument state instead of presetting to defaults (not implemented 100%)). There is an optional fourth parameter (boolean) for simulation mode, it is False by default but if it is supplied as True, the instrument will run in a simulated state, not sending commands to the bus, all data sent to the instrument will be returned when read from the instrument.

Now that you have created the instrument variable, each instrument category has its own "Sections" property that will display all of the capabilities an instrument can provide. The following example will show you how to create an instrument and control it:

VB
'Don't forget to Import (using in C#) the proper namespace for the category
'of instrument you wish to control.

Imports FreeCal.Instruments.Microwave.SignalGenerators
Imports FreeCal.Instruments.Microwave.PowerMeters
VB
Public Sub ControlInstrument
    'Create the instrument
VB
 Dim SigGen As New AgilentE4433B(0, 19, False)
'Or Dim SigGen As SignalGenerator = New AgilentE4433B(0, 19, False)
 Dim PwrMtr As New AgilentE4417A(0, 13, False)
VB
'Control the instrument
Dim TestLevel As Single = -10
VB
    SigGen.Sections.RF.Frequency.Suffix = FrequencyEnum.GHz
    SigGen.Sections.RF.Frequency.CW = 3.5
    SigGen.Sections.RF.Amplitude.Suffix = AmplitudeEnum.dBm
    SigGen.Sections.RF.Amplitude.Level = TestLevel
    SigGen.Sections.RF.OutputState = OnOffStateEnum.[On]
    Dim Result As Single = PwrMtr.Sections.Measurements.Measure("A")
    MessageBox.Show("The " & PwrMtr.Model & " read " & Result & ".")
End Sub

Summary

That's all you need to get started, but there are many more instruments, tools and helpful forms that are included to help in the design of tests and procedures.

As of this date, the only documentation is included as a Word doc at the root of the FreeCal_src.zip file. I am working on documenting the entire project for future releases.

Enjoy!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) IndySoft
United States United States
1986 - Started programming

1992-1995 - At 15, I became a PC repair technician at PC Performance Centers in Greenwood Village, CO and worked my way up to a senior repair tech, before they went out of business.

1995-1999 - Worked with Walker Fenton, the Netcom site dev. I waw "Director of IT" at the time.

1999-2007 - Calibration Technician in the U.S. Marines

2004-2007 - Metrologist for Lockheed Martin at Stennis Space Center, MS

2007-2012 - Turbofan Jet Engine Test Team Leader and system programmer for Rolls-Royce at Stennis Space Center, MS.
Invented and developed the first ever multi-computer development turbofan jet engine test cell control room training simulator with a physical throttle interface, and real-time calculated turbofan jet engine for Rolls-Royce global

2012-2016 - Automation Specialist II for Prime Controls in Metairie, LA; New Orleans pump stations, WTPs/WWTPs, jail control systems, etc.

2016 - 2019 Freelance programmer

2019-Present IndySoft Senior Web and Automation Developer.

Comments and Discussions

 
QuestionEver Finish this project? Pin
Teaguekm29-May-17 10:01
Teaguekm29-May-17 10:01 
AnswerRe: Ever Finish this project? Pin
Scott Page3-Sep-17 16:35
professionalScott Page3-Sep-17 16:35 
GeneralRe: Ever Finish this project? Pin
Teaguekm4-Sep-17 6:58
Teaguekm4-Sep-17 6:58 
GeneralRe: Ever Finish this project? Pin
Scott Page4-Sep-17 8:12
professionalScott Page4-Sep-17 8:12 
GeneralMy vote of 5 Pin
Koh Twee Toong15-May-13 6:16
Koh Twee Toong15-May-13 6:16 
GeneralCool stuff wish I had the interface so I could start creating some scientific equipment! Pin
ProtoBytes22-Oct-10 19:58
ProtoBytes22-Oct-10 19:58 
GeneralMy vote of 5 Pin
shinchulkyu31-Aug-10 21:38
shinchulkyu31-Aug-10 21:38 
GeneralRe: My vote of 5 Pin
Scott Page 202219-Aug-22 17:01
Scott Page 202219-Aug-22 17:01 
GeneralError reading from instruments Pin
mprice031718-Sep-06 19:17
mprice031718-Sep-06 19:17 
AnswerRe: Error reading from instruments Pin
Scott Page19-Sep-06 9:10
professionalScott Page19-Sep-06 9:10 
GeneralRe: Error reading from instruments Pin
mprice031719-Sep-06 9:48
mprice031719-Sep-06 9:48 
QuestionRe: Error reading from instruments Pin
Scott Page19-Sep-06 9:52
professionalScott Page19-Sep-06 9:52 
GeneralRe: Error reading from instruments Pin
Scott Page19-Sep-06 9:58
professionalScott Page19-Sep-06 9:58 
GeneralRe: Error reading from instruments Pin
mprice031720-Sep-06 12:51
mprice031720-Sep-06 12:51 
GeneralRe: Error reading from instruments Pin
Scott Page21-Sep-06 9:17
professionalScott Page21-Sep-06 9:17 
GeneralRe: Error reading from instruments Pin
Scott Page21-Sep-06 9:21
professionalScott Page21-Sep-06 9:21 
GeneralRe: Error reading from instruments Pin
Scott Page21-Sep-06 9:38
professionalScott Page21-Sep-06 9:38 
GeneralRe: Error reading from instruments Pin
mprice031722-Sep-06 9:54
mprice031722-Sep-06 9:54 
GeneralRe: Error reading from instruments Pin
Scott Page22-Sep-06 9:57
professionalScott Page22-Sep-06 9:57 
GeneralRe: Error reading from instruments Pin
mprice03172-Oct-06 6:49
mprice03172-Oct-06 6:49 
AnswerRe: Error reading from instruments Pin
Scott Page2-Oct-06 10:44
professionalScott Page2-Oct-06 10:44 
GeneralRe: Error reading from instruments Pin
mprice031712-Oct-06 17:42
mprice031712-Oct-06 17:42 
QuestionProblem reading from device Pin
krugerr9-Mar-06 0:08
krugerr9-Mar-06 0:08 
AnswerRe: Problem reading from device Pin
skinned_knuckles14-Jun-06 12:00
skinned_knuckles14-Jun-06 12:00 
AnswerRe: Problem reading from device Pin
Scott Page22-Jun-06 16:11
professionalScott Page22-Jun-06 16:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.