usb2000plus

Module to comunicate with Spectrometer USB2000+

node-usb2000plus

Module to comunicate with Oceanoptics Spectrometer USB2000+

npm install

$ npm install usb2000plus

Just add the node_modules: node-usb

This module is still in alpha. (do not use in production)

var USB2000 = require('usb2000plus').USB2000;
var usb2000plus = new USB2000()

Works with hr2000+ or hr4000 change on model options

With options:

var USB2000 = require('usb2000plus').USB2000;
var usb2000 = new USB2000({
    VID: 0x2457,
    PID: 0x101E,
    model: 'hr2000+'
})

Discovering the PID (product id) and VID (vendor id)

$ lsusb

output:

Bus 001 Device 006: ID 2457:101e  

VID:2457 (hex) PID:101e (hex)

Require node-usb (already in npm install package)

Tested on Ubuntu 12.04 (x86/arm v7)

First you need permission to run the usb. Copy the file 10-oceanoptics.rules to your /etc/udev/rules.d

$ sudo cp 10-oceanoptics.rules /etc/udev/rules.d

Without the permission you will need run your node with sudo (*not recommended)

usb2000.requestSpectra(function(errordata) {
    if(error === null)
        console.log(data)
    else
        console.log(error)
})
usb2000.queryInformation(function(errordata) {
    if(error === null)
        console.log(data)
    else
        console.log(error)
})
usb2000.setIntegrationTime(function(errordata){
    if(error !== null)
        console.log("Integration time changed. There is no data callback")
}, 3000000)

Obs: 3000000 = 3s

intialize()
setIntegrationTime()
setStrobeEnableStatus()
setShutdownMode()
queryInformation()
writeInformation()
 
requestSpectra()
setTriggerMode()
queryNumberPlugins()
queryPluginIdentifiers()
detectPlugins()
 
generalICRead()
generalICWrite()
generalSpiIo()
pscoRead()
pscoWrite()
writeRegisterInformation()
readRegisterInformation()
readPcbTemperature()
readIrradianceCalibrationFactors()
writeIrradianceCalibrationFactors()
$ grunt
  • Add tests
  • Add documentation
  • Add some options to customize the data input/output
  • Verify all spectrometer functions
  • v0.1 - Started the first release

Copyright (c) 2014 Léo Haddad M. C. Carneiro
Licensed under the MIT license.