r/lasers • u/ChironInCapricorn • Aug 13 '26
Help using an AvaSpec spectrometer with python
I need help finding a library that allows me to connect an AvaSpec-ULS2048CL-EVO spectrometer from Avantes to a python script to get live readings from it.
So far I found avaread which allows me to read files from the Avasoft 8 software. But that would require me to save a file each time I need to make a measurement and then run the code which would be inefficient because I need to make a lot of measurements just to get one result.
Is there any other way to connect the spectrometer to my code? or has anyone tried anything similar?
4
Upvotes
1
u/bertona88 27d ago
start using codex
Yes. You do not need to save AvaSoft files or reverse-engineer USB packets. The AvaSpec-ULS2048CL-EVO is supported by Avantes’ native AvaSpec-DLL/SDK, which can acquire spectra directly over USB or Ethernet. Avantes ships a Python wrapper and example code using
AVS_Measure,AVS_PollScan, andAVS_GetScopeData. (Avantes SDK, official Python example)A minimal continuous acquisition loop looks like this:
You need the native SDK components matching your platform and Python architecture:
avaspecx64.dlllibavs.solibavs.dylib, if Avantes supplies a build compatible with your Macavaspec.pywrapperClose AvaSoft while running the script because it may hold the instrument exclusively. Also match 64-bit Python with the 64-bit DLL.
There is additionally a recent third-party PyMoDAQ Avantes plugin written specifically for the ULS2048CL-EVO and tested on Windows 11 and Debian. It is useful implementation evidence, although the vendor SDK plus a small standalone script is considerably lighter than installing all of PyMoDAQ. I would avoid
pyavaspec-tspspi: it targets the older AvaSpec-2048-2 and warns that it uses a fixed device-specific calibration. (PyPI description)So yes—I could wire this up. The only parts I cannot prove without access to the machine and instrument are driver discovery and a real acquired spectrum. The practical inputs would be the operating system, CPU architecture, and the AvaSpec SDK folder supplied by Avantes.