Wasatch.NET  2.1.4
.NET application driver for Wasatch Photonics spectrometers
Overview

Wasatch.NET is an application-level wrapper over Wasatch Photonics' USB and SPI APIs. It is provided so that application developers don't need to worry about opcodes and [de]marshalling octets of raw data; they can simply call high-level properties and methods like integrationTimeMS and getSpectrum().

Wasatch.NET is expected to work from all .NET-compatible languages, including:

Platform Test status
C# tested with Visual Studio 2017 Community
LabVIEW tested with 2017 32-bit (see Wasatch.LV)
MATLAB/Simulink tested with 2017b 64-bit (see Wasatch.MATLAB)
Embarcadero Delphi tested with Delphi Community Edition 10.2 over COM (see Wasatch.Delphi)
VBA (Excel) tested with Office 2010 64-bit (see Wasatch.Excel)
R not started (planned via rClr)
Xamarin not started
Visual Basic.NET not started
F# not started
Wolfram Mathematica not started

If there are others you would like to see listed, please let us know and we'll test them!

Downloads

Pre-compiled installers are available for 32-bit and 64-bit Windows:

Quick Start

if (driver.openAllSpectrometers() > 0)
{
WasatchNET.Spectrometer spectrometer = driver.getSpectrometer(0);
spectrometer.integrationTimeMS = 100;
double[] spectrum = spectrometer.getSpectrum();
}

For sample calling code, see the included C# ./doc/README-WinFormDemo.md "WinFormDemo".

Documentation

API documentation is available here:

The driver is designed to closely mimic the USB APIs defined in the following documents:

Therefore, most questions about parameters, modes and options can likely be resolved by review of the underlying spectrometer communication interface.

Installation

Wasatch.NET is distributed in a Microsoft Installer (.msi) file, which installs the WasatchNET.dll and LibUsbDotNet.dll under C:\Windows (so they'll always be in the system path). FTDI drivers are also installed to support SPI communications.

It also installs a simple C# spectroscopy GUI app, WinFormDemo, under \Program Files\Wasatch Photonics (or Program Files (x86) on 32-bit systems), giving you a means to control the spectrometer and quickly verify the driver is installed and working correctly.

Besides double-clicking the .msi installer, there are one or two additional steps required for a complete installation:

Post-Install Step #1: libusb drivers

Wasatch.NET is a high-level "application driver," which communicates with our spectrometers using the "mid-level" driver LibUsbDotNet, which in-turn communicates using the "low-level" USB driver libusb-win32. However, Windows doesn't know that our spectrometers are meant to use libusb-win32 until we tell it!
So the first thing we need to do is install the .INF files which associate our USB devices (via VID/PID) with libusb. This is the process to do so:

Update Drivers
Browse
Select
Install
Done

Post-Install Step #2: COM registration (optional)

This step is believed ONLY required for developers using Visual Basic 6 (VB6) or Visual Basic for Applications (VBA, part of Microsoft Excel).

Because our .msi installer does not register the .tlb file needed by VB6/VBA, you need to perform one additional manual step:

Run as Administrator
Done

Build

So you'd like to build and compile Wasatch.NET yourself from source? Good, that's how we like to do it too...you learn so much more that way :-)

Dependencies

The driver was written and tested under Visual Studio 2017 Community on Win10 64-bit. It is itself dependent on the following libraries:

LibUsbDotNet

URL: https://sourceforge.net/projects/libusbdotnet/files/LibUsbDotNet/

This is a .NET wrapper over the standard libusb-win32 which is used by many USB device vendors. The pre-compiled DLL provided in our lib/ directory was built from v2.2.8 using Visual Studio 2017 Community against the .NET 4.0 Client Profile.

FTDI

See README-SPI.md.

Build Configuration

Our standard DLL is built against .NET 4.0 Client Profile with debugging enabled, and the WinFormDemo is built against .NET 4.6.1.

Although the DLL and demo will build and run "For Any CPU", we went ahead and made build configurations for x64 and x86 because some client platforms prefer binding to specific architectures.

Users are welcome to build the library in other configurations; please let us know if you encounter any issues which we may help resolve.

Testing

The simplest way to test whether your installation is successful is to run the provided WinFormDemo, which should be available on your Start Menu under Wasatch Photonics -> Wasatch.NET -> WinFormDemo.

If you have a Wasatch Photonics spectrometer plugged-in and correctly showing under "libusb-win32 devices" in the Device Manager, you should be able to run the demo, then click "Initialize" to connect to the spectrometer.

Support

For questions about the driver or API, please contact:

support@wasatchphotonics.com

Wrapper Completeness

The Wasatch.Driver series of wrappers over our USB API are provided as reference implementations to demonstrate how to command and control our spectrometers over USB from a variety of platforms and languages. As working examples and "convenience wrappers," they are not guaranteed to include convenience functions for every call and option within the hardware API, nor are they necessarily the most efficient or optimal implementation in any given language.

The formal and complete interface to our spectrometers is provided in our USB API documentation. Standard USB drivers to access that direct interface are plentiful on all standard operating systems: libusb, WinUSB etc. No additional wrappers or libraries are required to make full use of our spectrometers from the platform of your choice.

If there is a spectrometer or spectroscopy function that you do not find provided in our open-source wrapper collection, please contact us and request its addition; or if you wish to "get your hands dirty," feel free to create your own implementation and optionally share it with us for merge into the base distribution. Wasatch Photonics is proud to help support our online community, but not too proud to decline patches when they improve the product!

That said, some known areas for improvement can be found in our Backlog (below).

Troubleshooting

"The best driver is already installed."

If you have trouble installing our libusb-win32 drivers, see:

No spectrometer found

This can happen when Wasatch Dash or another older Wasatch driver product has been installed on the same computer as ENLIGHTEN or one of our newer drivers (like Wasatch.NET).

You can tell that this is the problem if you look in the Windows Device Manager, and you can see "Wasatch Photonics Device FX2" listed under "Universal Serial Bus controllers".

To resolve, first uninstall the older driver, by right-clicking "Wasatch Photonics Device FX2" and selecting "Uninstall device":

Uninstall Device

Make sure you click "Delete the driver software for this device":

Delete the driver software

From the "Action" menu, select "Scan for hardware changes" to re-enumerate the device under the correct device driver:

Scan for hardware changes

You should now see your spectrometer listed under the expected libusb-win32 driver:

Scan for hardware changes

You should now be able to re-run your Wasatch.NET, Wasatch.PY or ENLIGHTEN software and connect to your spectrometer.

Backlog

Version History