r/Optics • • 23h ago

I built an open-source browser app (WebUSB) to control an Ocean Insight HDX spectrometer—no OceanView or drivers needed

Thumbnail
gallery
37 Upvotes

In our lab we use an Ocean Insight HDX quite often, and every new computer meant reinstalling OceanView, drivers, and licenses all over again. So I built Spektra: an open-source web app that talks to the spectrometer directly over USB, with nothing to install.

How it works: It uses the browser's WebUSB API and a JavaScript implementation of Ocean Insight's binary protocol (OBP)—handling packet framing, reading the onboard wavelength calibration, setting integration times, and pulling raw 16-bit spectra with no vendor driver or SDK. The protocol notes are documented here:PROTOCOL.md.

What it does so far:

  • Live view and single acquisitions, auto exposure, averaging, dark subtraction, and boxcar smoothing
  • Automatic peak detection with sub-pixel position, FWHM, area, and SNR
  • Wavelength or photon-energy axis, with Jacobian intensity conversion (counts/meV) so broad PL bands aren't shifted
  • CSV export with acquisition metadata

It runs in Chrome and Edge on Windows, macOS, and Linux—and, somewhat to my surprise, on an Android phone over a USB-C OTG adapter (shown in the screenshot). On Windows, the HDX just needs the WinUSB driver installed once via Zadig.

So far it's only been tested on an HDX. Newer Ocean Insight spectrometers use the same OBP protocol and should mostly just need a small per-model profile, but I can't verify them without the hardware. If you have another Ocean spectrometer and are willing to test it—or want to contribute—I'd really appreciate it.

Happy to answer questions or hear what features you'd want in a tool like this.