This is an old revision of the document!


Spectrograph

Project Overview

The purpose of this design project is to update the Engineering Physics 3G03 Project designed by students Yu Lou, Wei Cui and Paul McMullen. This project can be used as a future representation of some of the work students in the photonics stream of Engineering Physics are involved in during their undergrad career.

Task

The objective of the spectrometer design project was to construct a spectrograph that can resolve the wavelengths of several LEDs in the visible region of the electromagnetic spectrum. The primary objective is for the project is to resolve the LEDs individually, while the secondary goal was to be able to resolve two or more LEDs simultaneously. The spectrometer was to cost less than $200.00 and have no moving parts. The spectrograph was to be able to plot intensity [Volts] versus wavelength [Nanometers], to aid in the description of the input light.

Updates

The original project can be found here.

There were several things discussed to make the spectrograph more demo ready. During in class testing and during a presentation, the LEDs being resolved were plugged into a bread board which was powered by AA batteries. This was impractical since it contained additional loose components as well as an additional power source which could run out. The first update was to have a computer power the LEDs, and have the LEDs placed inside the spectrometer. Additionally, the circuit was still on a bread board so it needed to be soldered to a PCB. These are some of the major changes that were the most important. The following are the details of the updates.

Before beginning to work on the definite changes needed, the housing box needed to be recreated. There were several parts that did not quite fit properly and could be made better for a more aesthetic appearance. Several pieces were replaced with newly cut pieces of hardwood.

LEDs were added to the front of the system each with a switch to verify which colour of LED is on. These holes were drilled into the hardboard using a drill. The box was reconstructed, leaving some pieces with a black finish and others without. The switches and LEDs were placed in their respective positions before repainting. Everything that was not to be painted was covered with duct tape, and the housing was spray painted with two coats of paint.

After the paint had dried the duct tape was removed. At this point, all wires were removed from the breadboard and were soldered into a two separate PCBs: one for the detectors and another for the LEDs. The schematic diagrams for the detectors can be found in section 2.5.

In the original design, the microcontroller only had 6 analog inputs. This was not sufficient enough for resolving the LED. To solve this problem, we used a break in the program and several switches to store 10 data points instead. Since this method was confusing for the user, a larger microcontroller was acquired with 16 inputs. This would improve the resolution of the spectrograph, and hoped it would likely make the programming easier.

First, the GUI was remade to remove the unnecessary functions from the previous spectrograph. These include all the various methods of interpolation. The cubic spline was left and used for representing the data. Turning LEDs ON/OFF using the interface was considered, but it was simpler to just use the mechanical switches. Problems arose when trying to connect the ARDUINO MEGA to the computer. The error message implying the microcontroller was not connected or available kept appearing. This problem seemed relevant only to the MEGA, as switching back to the UNO resulted in no problems. The adiosrv.pde code was inspected and altered to try to get a connection to the MEGA but this was not possible at the time. The old set up was used again, replacing the MEGA with the UNO and its 6 analog ports. Because of this confusing set up, detailed operating instructions can be found in section 2.4.

The optics inside the spectrometer was realigned for the new configuration and parts. The MATLAB program was fixed to work for the UNO and the results were tested. The spectrometer resolves a single LED at a time, using MATLAB, and produces a result, indicating which colour the LED is. The spectrograph only distinguishes between red, green and blue LEDs.

Operating Instructions

Device Operation

These are the instructions for operating the spectrometer, assuming the ports are properly connected, the ARDUINO sketch has been uploaded to an ARDUINO UNO and the MATLAB file is being run on MATLAB R2009a Student or a later version. These are necessary for the spectrometer to work, unless a C# program is uploaded for use without MATLAB. This is unavailable at the current date however.

  1. Open MATLAB and run attempt05_gui.m. A GUI should appear with the label “Spectrograph.”
  2. Connect the USB cable to the spectrometer and to the PC.
  3. Turn the spectrometer on by switching the switch located above the USB cable. A blue LED should light up to indicate the system is receiving power.
    1. Turn the switches on the left on, to make sure the LEDs are working. The LEDs that go into the spectrometer should match with the indicating LEDs that light up when the switch is turned on.
  4. Make sure the two position switches are to the left (position 1)
  5. Press “Acquire Spectrum” on the GUI to find the spectrum and colour of the LED
    1. The background data is taken first, so be sure that no LED is on, or in the LED slot.
    2. The program will pop up a message indicating background data is being taken. Switch the position switches to the right as indicated. Press “Ok.”
    3. Now the background data has been taken, and the LED data can be taken. Return the switches to position 1, plug in the LED which you want to measure and turn the LED on. An indicating LED should also turn on. Press “Ok.”
    4. Switch the switches to position 2 to obtain the last of the data. Press “Ok.”
    5. The spectrum should appear in the graph on the GUI.
    6. A pop up box should appear notifying you the colour of the LED.

Troubleshooting

  • If the LEDs do not turn on, but power is being supplied to the device the LEDs might be shorting out in the PCB.
  • If the spectrum analyzer gives no results (every point is zero), the detector PCB might be shorted.
  • If only a single point on the spectrum analyzer is zero, make sure that detector is connected to the ARDUINO. Also, check to make sure the wires are not being shorted at the back of the detectors.
  • If the result does not appear as a graph, or the graph appears in one of the pop-up boxes, run the code again. When prompted to press “Ok,” do not press “Ok,” instead press anywhere else on the GUI. This will cause the program to continue running without further problems.

Sketch Upload and Port Connections

  • To upload the sketch Adiosrv.pde sketch to the ARDUINO, first connect the ARDUINO to the PC via USB cable.
  • Verify the COM port being used by the device:
    • Windows»Control Panel»Device Manager»Ports(COM & LPT)»ARDUINO UNO(COM#)
      • Where # represents the port number that the ARDUINO is connected to.
  • Open adiosrv.pde and upload to the ARDUINO
    • Verify the correct port and board
      • Tools»Board»ARDUINO UNO
      • Tools»Serial Port»COM#
        • Where # matches the port number that the ARDUINO is connected to that was connected to.
  • Upload the sketch to the ARDUINO
    • Open MATLAB
      • Open attempt05_gui.m
      • Verify the correct port in lines 117 and 119
  • The sketch will now work with the MATLAB code.

Navigation
Personal Tools