Skip to content

Avantes

Driver for Avantes AvaSpec spectrometers over USB or Ethernet. Talks to the device via the native Avantes SDK (avaspecx64.dll) using P/Invoke, takes calibrated irradiance measurements, and exposes a full lighting / horticulture / colorimetry report as cached properties.

Avantes is a premium tier-3 extension driver. It ships as a signed .muxdriver and installs into workspace/drivers/.

Measurement flow

js
// 1. Cover the entrance optic and capture a dark reference once per integration time.
await spec.measureDark();

// 2. (Optional) Let the driver pick a safe integration time for the current scene.
await spec.autoIntegrationTime({ targetFraction: 0.7 });

// 3. Take the measurement. measure() returns only status —
//    { isSaturated, peakCounts, integrationTime } — and refreshes all derived caches.
await spec.measure();

// 4. Read derived numbers as plain properties — no further device calls.
const cct      = await spec.cct;
const cri      = await spec.cri;           // Ra
const indices  = await spec.colorRendering; // [R1..R14], R9 at index 8
const lux      = await spec.illuminance;
const ppfd     = await spec.ppf;          // 400-700 nm
const blueFlux = await spec.photonFlux400_500;

measure() deliberately returns only minimal status so it stays cheap for the AI to call repeatedly; the full lighting / colour report is read from the cached properties afterwards. The AI can answer "measure CCT" by calling measure() and reading cct — it does not need to fetch the spectrum.

All numeric output (scalars and arrays) is rounded to the significantDigits config setting (default 4).

Derived metrics

All cached on every measure(). Properties return NaN (or 0 for non-negative fluxes) when a metric isn't meaningful for the current spectrum (e.g. cct on a pure laser line).

Lighting

PropertyUnitDescription
cctKCorrelated colour temperature (McCamy approximation). NaN when chromaticity is more than 0.05 Δuv from the Planckian locus.
cieX, cieYCIE 1931 2° chromaticity coordinates.
illuminancelxPhotopic V(λ)-weighted irradiance (683 lm/W × ∫ V(λ) E(λ) dλ).
luminousFluxlmSame integration as illuminance; differs only in the per-area interpretation of the input.
criCIE 13.3-1995 general colour rendering index (Ra, average of R1-R8). NaN when |Duv| > 0.0054.
colorRenderingArray of the 14 CIE 13.3 special indices [R1…R14]. R9 (deep red) is at index 8 (zero-based). Empty when CRI is undefined.
peakWavelengthnmWavelength of maximum spectral irradiance, parabolic-refined.
dominantWavelengthnmSpectral colour the source matches; negative value means complementary (purples).

Horticulture photon-flux bins

PropertyBand (nm)Use
photonFlux300_400300-400UV-A / UV-B
photonFlux400_500400-500Blue
photonFlux500_600500-600Green
photonFlux600_700600-700Red
photonFlux700_800700-800Far-red
photonFlux800_1000800-1000Near-IR
ppf400-700PAR / PPFD (already present)
photonFlux400_800400-800Extended PAR (already present)

All fluxes in µmol/s (or µmol/(s·m²) if the calibration is per area). For arbitrary bands use the getPhotonFlux action.

Properties

PropertyTypeAccessUnitDescription
connectedboolRDevice connection status
serialstringRConnected device serial
nrPixelsintRSensor pixel count
integrationTimedoubleR/WmsIntegration time (a.k.a. exposure)
averagesintR/WHardware averages per measurement
wavelengthsdouble[]RnmWavelength axis (raw or interpolated grid)
spectrumdouble[]RcountsRaw counts from last measurement
darkdouble[]RcountsDark reference data
irradiancedouble[]RµW/nmCalibrated irradiance
isSaturatedboolRSaturation detected in last measurement
peakCountsdoubleRcountsMaximum counts in last measurement
darkCorrectedboolRWhether a dark reference is loaded
calibrationInfostringRDescription of loaded calibration
radiantPowerdoubleRWTotal radiant power 350-850 nm
temperaturedoubleR°CDetector temperature
streamingboolR/WContinuous streaming enabled
firmwareVersion, fpgaVersionstringRDevice firmware / FPGA versions

…plus all derived metrics in the section above.

Actions

ActionArgsDescription
measureTake a single measurement; updates the full derived report
measureDarkCapture a dark reference at the current integration time
clearDarkDiscard the dark reference
autoIntegrationTime{ targetFraction?, maxIterations?, minMs?, maxMs? }Iteratively adjust integrationTime so peak counts hit targetFraction of full scale (default 0.7)
loadCalibration{ source }"eeprom" or path to a calibration text file
getRadiantPower{ min, max }Radiant power (W) over an arbitrary band
getPhotonFlux{ min, max }Photon flux (µmol/s) over an arbitrary band
discoverList available Avantes devices on USB and Ethernet
connect{ serial? }Connect to a specific device, or the first available
disconnectDisconnect
startStream, stopStreamContinuous measurement streaming
getVersionInfoFirmware / FPGA / DLL versions

Config options

OptionTypeDefaultDescription
connectionTypestring"usb""usb" or "eth"
serialstring""Target device serial — empty = first available
integrationTimedouble100Integration time in ms
averagesint1Hardware averages per measurement
useHighResAdcbooltrueEnable 16-bit ADC mode (when supported)
calibrationSourcestring"eeprom""eeprom" or path to a calibration file
interpolatebooltrueResample to a uniform wavelength grid
interpolateMin/Max/Stepdouble350/850/1Interpolation grid (nm)
strayLightCorrectionboolfalseUse AVS_SuppressStrayLight if available
strayLightFactordouble1.0Stray-light multiplier
streamIntervalMsint1000Streaming interval
autoIntegrationboolfalseWhen true, every measure() runs autoIntegrationTime first (skipped while a dark reference is loaded)
significantDigitsint4Significant figures applied to all numeric output (scalars and arrays, including the wavelength axis). Set 0 to disable rounding

Notes on accuracy

  • CCT / CRI / dominant wavelength are only meaningful for broadband white-ish sources. For monochromatic sources (lasers, narrow-band LEDs) these will return NaN or be reported as off-locus.
  • Dark reference is per-integration-time. Retake the dark whenever you change integrationTimeautoIntegrationTime is therefore skipped while a dark is loaded.
  • The McCamy CCT approximation is accurate to ±2 K for 2856-6500 K and degrades gracefully outside that range. For laboratory-grade accuracy, post-process the raw irradiance array.
  • CRI uses the CIE 13.3-1995 procedure (14 TCS samples, Planckian < 5000 K / D-illuminant ≥ 5000 K reference, von-Kries chromatic adaptation, CIE 1964 U*V*W* differences). It computes [Ra, R1…R14] internally; cri exposes Ra and colorRendering exposes the special indices [R1…R14] (R9 at index 8).

Muxit — Hardware Orchestration Platform