We continue to develop resources related to the COVID-19 pandemic. See COVID-19 initiatives on Appropedia for more information.

Spectruino protocol:MOST

From Appropedia
Jump to navigation Jump to search

Sunhusky.png By Michigan Tech's Open Sustainability Technology Lab.

Wanted: Students to make a distributed future with solar-powered open-source 3-D printing.
Currently looking for PhD or MSC student interested in solar energy policy- apply now!
Contact Dr. Joshua Pearce - Apply here

MOST: Projects & Publications, Methods, Lit. reviews, People, Sponsors, News
Updates: Twitter, Instagram, YouTube

OSL.jpg

Spectruino is an Arduino Spectrometer to measure light intensity vs. wavelength. Internally, this is achieved through a combination of diffraction grating with linear CCD camera and custom firmware. All technical specs here: http://myspectral.com/#technical

We are beta testing for them.

Setup[edit]

Installation Instructions for Arduino:[edit]

Installation Instructions for mySight software Analyzer[edit]

Calibration[edit]

  • Copy and paste the file "CFG-spectruino-calibration.txt" into the main folder of mySight application.
  • If you use Processing source file, paste it into the /mySight/ folder and run the sketch.
  • The file contains calibration parameters and the serial number of your device.
  • You should now see wavelength [nm] in the main graph window of the mySight application.
  • Note: constantly updating the software on github, please check back soon.
  • open and edit mySight/mySight.pde

Software performs the following:[edit]

  1. open serial ports, find Spectruino
  2. read-in stream of bytes from virtual serial port over USB cable
  3. split the incoming byte stream into a byte array of length 501, check if the HEADER bytes are present and contain the correct size of the array "501" and "501"
  4. construct Spectrum class from byte array
  5. plot Spectrum
  6. wait for keypress 1, 2, 3, ..... 0 if numeric key pressed, send command to Spectruino: "Set exposure time (N)" where N is encoded in software
  7. in Spectruino, when SetExposureTime(N) is encountered, an interrupt is triggered, and immediately confirmation characters are sent back, even in the middle of data stream transmission.
  8. pressing the key "space" will display readings of wavelength intensity - see code for more information
  9. calibration file is read-in at the beginning, which converts x-axis "Pixels" into "wavelength [nm]", file must be present in the folder where the executable resides.
  10. mouse click on the graph to save a PNG image

Serial port UART RS232 Communication Protocol description[edit]

  1. Plug-in Spectruino into a free USB port
  2. open serial port (e.g. COM4 on Windows) with your programming language (we recommend Processing)
  3. serial byte array as integer values from 0..255 is sent from Spectruino to PC: [pixel1 value] [pixel2 value] ... [pixel501 value], char(A), char(x), 0x01, 0xF5, char(B), 0x01, 0xF5, char(c), char(y)
  4. new measurement on Spectruino takes place, CCD sensor is being exposed to light
  5. step 3 is repeated
  6. if incoming characters from PC to Spectruino are received, an interrupt is generated

Setting new exposure time of the CCD sensor in Spectruino:[edit]

Function setExposureTime(N) is called if you send the following 2 characters over the serial port: char(#) N where N is any hexadecimal byte from 0x01 to 0xFF

Calibration text[edit]

  1. Spectruino v1.0 beta TEST device serial# 013 20120921 a=slope [nm/px], b=intercept [px] y=a*x+b

0.7605552 374