Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 42 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Spektra

Spektra is browser-based acquisition and analysis software for the Ocean Insight HDX spectrometer. It runs
as a web page and communicates with the instrument directly over USB, using its own implementation of the
instrument's protocol. No software has to be installed, and the same page works on Windows, macOS, Linux,
ChromeOS and Android devices.
Spektra is browser-based acquisition and analysis software for Ocean Insight spectrometers. It runs as a web
page and communicates with the instrument directly over USB, using its own implementation of the instrument's
protocol. It is tested on the HDX; support for other models is being added and needs test reports ([Supported
instruments](#supported-instruments)). No software has to be installed, and the same page works on Windows,
macOS, Linux, ChromeOS and Android devices.

Application: <https://berameric.github.io/spektra/> · Version 2.0.0 ([changelog](CHANGELOG.md)) ·
[MIT licence](LICENSE)
Expand All @@ -15,7 +16,7 @@ Application: <https://berameric.github.io/spektra/> · Version 2.0.0 ([changelog
## Getting started

1. Open <https://berameric.github.io/spektra/> in Google Chrome or Microsoft Edge.
2. Connect the HDX and press **Connect**; select the instrument in the browser's device dialog.
2. Connect the spectrometer and press **Connect**; select the instrument in the browser's device dialog.
3. Press **Live** for continuous acquisition or **Acquire** for a single spectrum.

On first start, Spektra checks the operating system and browser and lists any preparation still required
Expand All @@ -34,6 +35,28 @@ If the instrument does not connect, see [Troubleshooting](docs/TROUBLESHOOTING.m
| Plot | Zoom and pan by mouse, wheel or touch; range selection; reference spectrum for comparison; overview of the full range when zoomed |
| Export | Spectrum and peak table as CSV with acquisition metadata; plot as PNG; peak table to the clipboard |

## Supported instruments

Spektra recognises an Ocean Insight instrument by its USB IDs and selects the driver from a table of per-model
profiles ([`src/device/profiles.js`](src/device/profiles.js)); nothing has to be set by hand.

| Status | Models | |
|---|---|---|
| Tested | HDX | Verified on the instrument with Spektra |
| Experimental, test reports wanted | STS, QE Pro, Spark, Ventana | Same protocol as the HDX; settings taken from python-seabreeze, not yet confirmed on an instrument ([#8](https://github.com/berameric/spektra/issues/8)) |
| Recognised, driver planned | USB2000, USB2000+, USB4000, Flame-S, Flame-T, HR2000, HR2000+, HR4000, USB650, QE65000, NIRQuest, Maya2000, Maya2000 Pro, Maya LSL, Torus, Apex, Jaz, ADC1000-USB | Older command set; a driver is in preparation ([#9](https://github.com/berameric/spektra/issues/9)) |
| Recognised, not yet supported | Ocean ST, SR2, SR4, SR6, HR2, HR4, HR6 | Newer protocol without public documentation ([#11](https://github.com/berameric/spektra/issues/11)) |

Spektra sends nothing to an instrument it cannot operate: for those it shows a report built from the USB
descriptors alone and offers to open a pre-filled GitHub issue. Only for an unknown device that may use the
same protocol as the HDX can you choose to add a few read-only requests to the report.

**Help wanted.** We have only the HDX, so every other model depends on people who own one. If you have any of
the instruments above, open Spektra, connect it and file an
[instrument report](https://github.com/berameric/spektra/issues/new?template=instrument_report.yml): it takes a
few minutes and nothing is written to the instrument. A report is what moves a model from *experimental* to
*tested*. See also [CONTRIBUTING.md](CONTRIBUTING.md).

## Use on mobile devices

On Android, the HDX is connected through a USB-C (OTG) adapter and Spektra runs in Chrome in landscape
Expand All @@ -48,19 +71,19 @@ orientation; the HDX is powered from its own supply. Figure 2 shows a measuremen
| Platform | Requirement |
|---|---|
| macOS, ChromeOS | None |
| Windows | WinUSB driver for the HDX, installed once per computer |
| Linux | udev rule granting access to the HDX, added once per computer |
| Windows | WinUSB driver for the spectrometer, installed once per computer |
| Linux | udev rule granting access to the spectrometer, added once per computer |
| Android | Chrome and a USB-C (OTG) adapter |
| iOS, iPadOS | Not supported; no browser on these systems provides WebUSB |

<details>
<summary>Windows: installing the WinUSB driver</summary>

1. Connect the HDX and run [Zadig](https://zadig.akeo.ie).
2. Choose **Options → List All Devices** and select the HDX (USB ID `2457 2003`).
1. Connect the spectrometer and run [Zadig](https://zadig.akeo.ie).
2. Choose **Options → List All Devices** and select the spectrometer (the HDX has USB ID `2457 2003`).
3. Select **WinUSB** and press **Replace Driver**.

OceanView no longer recognises the HDX afterwards. To revert, uninstall the device in Device Manager and
OceanView no longer recognises the instrument afterwards. To revert, uninstall the device in Device Manager and
reconnect it.
</details>

Expand All @@ -73,8 +96,8 @@ echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2457", ATTR{idProduct}=="2003", MODE="0
sudo udevadm control --reload-rules && sudo udevadm trigger
```

Reconnect the HDX afterwards. If Chromium is installed as a Snap package, also run
`sudo snap connect chromium:raw-usb`.
The rule is for the HDX; for another model, use its product ID or leave `ATTR{idProduct}` out. Reconnect the
instrument afterwards. If Chromium is installed as a Snap package, also run `sudo snap connect chromium:raw-usb`.
</details>

Spektra requires the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API) and a secure
Expand All @@ -83,13 +106,13 @@ and Opera 48+; it is not available in Firefox or Safari.

## Instrument communication

Spektra does not depend on the manufacturer's driver, SDK or application software. The HDX is controlled with
the Ocean Binary Protocol (OBP), a framed binary message protocol carried over USB bulk transfers, which
Spektra implements in JavaScript ([`src/device/`](src/device/)). The implementation reads the
serial number and the wavelength calibration stored in the instrument, sets the integration time and acquires
16-bit spectra of 2 068 pixels. Because over some USB connections (for example through a hub) the
instrument occasionally loses or repeats a reply, replies are matched to requests by message type and requests
are repeated after a timeout.
Spektra does not depend on the manufacturer's driver, SDK or application software. The HDX and the other
experimental models are controlled with the Ocean Binary Protocol (OBP), a framed binary message protocol
carried over USB bulk transfers, which Spektra implements in JavaScript ([`src/device/`](src/device/)). The
implementation reads the serial number and the wavelength calibration stored in the instrument, sets the
integration time and acquires spectra (on the HDX, 16-bit spectra of 2 068 pixels). Because over some USB
connections (for example through a hub) the instrument occasionally loses or repeats a reply, replies are
matched to requests by message type and requests are repeated after a timeout.

The message format, the messages used, the request–reply handling and the steps needed to support another
instrument are documented in [docs/PROTOCOL.md](docs/PROTOCOL.md).
Expand Down Expand Up @@ -117,17 +140,6 @@ Spektra consists of plain JavaScript modules served as static files. There is no
other than the vendored [uPlot](https://github.com/leeoniya/uPlot) plotting library; the repository root is the
website. Nothing is sent over the network: measurements remain in the browser until exported.

## Other instruments

Spektra recognises an Ocean Insight instrument by its USB IDs and selects the driver from a table of
per-model profiles ([`src/device/profiles.js`](src/device/profiles.js)); no setting has to be entered by hand.
Only the HDX has been tested. The STS, QE Pro, Spark and Ventana, which use the same protocol, are included
as experimental entries (parameters from python-seabreeze) and need confirmation on the instruments. Models
using other protocols (the Ocean ST/SR/HR series and the older single-byte command set) are recognised but
not yet operated; for these, and for unknown Ocean devices, Spektra produces a report from the USB descriptors
and offers to open a pre-filled GitHub issue. Test reports and contributions are welcome; see
[CONTRIBUTING.md](CONTRIBUTING.md) and Section 7 of [docs/PROTOCOL.md](docs/PROTOCOL.md).

## Development

```bash
Expand Down
Loading