1 / 40

Portable Low Cost Spectrometer

Portable Low Cost Spectrometer. Design Review March 22, 2007. Brett Hamilton Kodin Taylor Mateusz Wyganowski. Outline. Background High Level Design Overview Texas Instruments TSL1401-LR Sensor Array Atmel Atmega8 Microcontroller Master Graphical User Interface Electrical Schematic

Download Presentation

Portable Low Cost Spectrometer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Portable Low Cost Spectrometer Design Review March 22, 2007 Brett Hamilton Kodin Taylor Mateusz Wyganowski

  2. Outline • Background • High Level Design Overview • Texas Instruments TSL1401-LR Sensor Array • Atmel Atmega8 Microcontroller • Master Graphical User Interface • Electrical Schematic • Demo

  3. Background • The purpose of this project is to create a portable optical spectrometer with inexpensive components for use in environmental monitoring • Current optical spectrometers are often expensive and generally provide more power and functionality than is necessary for our desired use • Inexpensive light sensors have become available that when coupled with a prism will be able to detect levels of light at various wavelength ranges in the visible spectrum.

  4. Cost Estimation • Microcontroller: $3-4 • PCB Manufacture: $100 • Sensor/Prism and Assembly: $20-30 • RS-232 Interface chip: $10 • Power Regulator $10 • Total: < $170

  5. High Level Design Overview

  6. Texas Instruments TSL1401R Sensor Array • 128 x 1 Sensor-Element Organization • 3-5 Vcc • 2 Digital Signal Inputs • SI • CLK • Analog Output • AO

  7. Sensor Array Cont.

  8. Sensor Array Cont.

  9. Sensor Array Cont.

  10. Atmel Atmega8 Microcontroller • Features • 2.7 – 5.5V, ~7-15 mA • 0-16 Mhz CPU Clock • 8K Bytes of Flash • 512 Bytes of EEPROM • 1K Byte of SRAM • One 16-bit Timer/Counter with Separate Prescaler • Sensor Interface • Digital I/O (output) • 10-bit Accuracy ADC Input (input) • Master Interface • Programmable Serial USART with Separate Prescaler • External Clock source • Power-down modes • C Programming Language Environment

  11. Microcontroller Software Internals • Interface with Sensor • Reduced Power Mode • Raw Sensor Value Adjustment • Communication Protocol

  12. Sensor-Microcontroller Interface (Control Output) • Control Signals • Pins 0 and 1 of PortB • 16-bit timer with Periodic ISR • One large c switch statement • Cases • LO_HI, HI_LO, AD_SAMPLE

  13. Example ISR Case Statement case SA_LO_HI: PORTB |= _BV(SSIG_CLK); sensor_state.tick++; if( sensor_state.reading == TRUE ) { sensor_state.next_action = SA_AD_START; next_time = T_S; } else { sensor_state.next_action = SA_HI_LO; next_time = T_PER/2; } break;

  14. Sensor-Microcontroller Interface (Analog Input) • Reading Analog Values • 10-bit Analog-to-Digital Converter • AD Conversion Done Interrupt • Fires automatically when ATC is done after every AD_SAMPLE case in the timer ISR

  15. Sensor-Microcontroller Interface

  16. Reduced Power Mode • The ADC is turned on just before starting the read cycle and back off when finished. • Idle Mode is used when waiting for instructions. • ADC Noise Reduction Mode is used each time starting an ADC sampling. The ADC module generates an interrupt when value is ready.

  17. Value Normalization • Sensor Elements are not equally sensitive to entire supported wavelength range. • Normalization value for each element (128 total) • Possible values 1-65535 (1024 => 1) • Algorithm • output_val : uint16_t // Final normalized value • temp32_val : uint32_t // 32 bit value for calculations • raw_val : uint16_t // raw value from the sensor • norm_val : uint16_t // normalization “multiplier” • for each raw_val, norm_val value pair in memory • temp32_val = raw_val * norm_val // 32 bit result • temp32_val = temp_val >> 10 // Normalize • temp32_val = MIN( temp_val, ADC_MAX_VAL ) // Bound value • output_val = (uint16_t) ((0x00FF) | temp_val) // Lower 16-bits

  18. Master-Microcontroller Interface (Comm. Protocol) • ASCII Protocol Messages Consist of • One Start Delimiter • $:Command, Always Master  Microcontroller • @: Notification of success, Microcontroller  Master • !: Notification of error, Microcontroller  Master • %: Reserved for sensor values • *: Miscellaneous Information shown when debugging and log files. • Two character command identifier • Optional colon and comma separated parameters • Two End delimiters (CR, LF)

  19. Command Handlers • Each command is paired with a handler function. • On incoming message, correct handler function is found based on 2 character command “key”. • Handler function is responsible for parsing parameters, performing the requested operation, and returning a success or failure message.

  20. Master Graphical Interface

  21. Program Operation • Static “comm controller” class maintains serial connection • Read thread continuously listening to serial port for incoming data • All incoming comm traffic is sent to static main class for processing

  22. Sending Commands • All commands sent with $ as prefix • $sc<CR><LF>

  23. Programming Mode • Sample Programming Command String • $sv:VAR_BAUD_RATE,115200<CR><LF>

  24. Get / Set Variables • Variables that are accessible using SET_VAR and GET_VAR are as follows: • VAR_SREAD_INT: The rate at which to send continuous sensor updates to the master in milliseconds. The minimum value allowable is 100 ms. • VAR_RD12_INT: The time between the flush read and actual read (described later). • VAR_BAUD_RATE: serial baud rate. Valid values are all possible baud rates between 1200 and 115200. The value will take effect on reset. • VAR_WV_LOW: The wavelength value detected by the photodiode at the low extreme. • VAR_WV_HIGH: The wavelength value detected by the photodiode at the high extreme.

  25. Command Confirmations • Command confirmations prefixed with @ • Data requests returned with values appended to the confirmation string • Example: • Sent: • “$rf<CR><LF>” • Received: • “@rf:450,800<CR><LF>”

  26. Error Messages • Errors prefixed with ! • Returns the command that caused the error as well as possible parameters or descriptions • Example • Sent: • “$rf<CR><LF>” • Received: • “!rf:WV_LOW and WV_HIGH not set.<CR><LF>”

  27. Receiving Data • Incoming data prefixed with % • String is tokenized and parsed into integers • Parsed data is used to update GUI’s graph and tables • Example: • “%10,25,0,13,26,0,0,1,115…<CR><LF>”

  28. Data Handling • GUI • Data is plotted on a large graph • Actual data values displayed in a table with associated wavelength • Log File • Appended data is saved in a CSV file for archival purposes as well as possibly generating reports

  29. Other Messages • Other Messages prefixed with * • Anything else the microcontroller wishes to convey is ignored and sent to a debug file

  30. Electrical Schematic

  31. Linear Regulator vs. + Simple + Cheap - Potentially Inefficient (heat) Switching Regulator - Complex - Noisier output voltage + Efficient Power Supply Design

  32. Power Supply Design

  33. Power Supply Design

  34. Power Supply Design

  35. TSL1401-LR Sensor Array

  36. TSL1401-LR Sensor Array

  37. MAX232 Level Shifter

  38. Noise Reduction • Power Supply • Placement of decoupling capacitors at each chip’s Vcc (as close as possible) to provide sudden spikes in current. • ADC • Separate ADC reference point filtered with an inductor and decoupling capacitor. • Crystal Oscillator • Placement as close to microcontroller as possible. • Surround with ground plane.

  39. Demo • Master and Microcontroller Communication

  40. Feedback?

More Related