Show All 5 ItemsHey Guys! A Spectrometer is useful for detecting impurities in water and..." />

Picture of DIY Spectrometer) Explore the Unknown -></div><!--more-->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
Show All 5 Items

Hey Guys! A Spectrometer is useful for detecting impurities in water and in other substances, or even just telling us what wavelength something is! If you have a mystery laser and you want to know the wavelength, you grab a laser with a known wavelength, and calibrate the Spectrometer, simply by taking measurements and then poof, a scan is done and then you know the wavelength. Spectrometers are super useful in optics, and you can tell the different wavelengths of light.

**Please click on the orange vote ribbon in the upper right-hand corner of this page if you enjoy this Instructable.**

I have attached at the end of this tutorial documents related to the construction and development of this spectrometer. Also, a special thanks to Altium for sponsoring the project! Altium provides circuit design software and you can visit their website at http://www.Altium.com/

Also Altium will be releasing their new Hobby Software for FREE, check it out at: circuitmaker.com!

Now you can download the files for this PCB on the Second Last Step of this Instructable!

Step 1: What You Will Need

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
Show All 11 Items

There a various supplies that you will need for this project; this project takes about an hour or two to build. You Will need:

A CD Drive to take apart appx. $20 (Example: http://www.newegg.com/Product/Product.aspx?Item=N8... )

MSP430 or Arduino ($10 MSP430 or $10 Arduino Pro Mini [or equivalent e.g. Leonardo, Mega, UNO])

EasyDriver Stepper Motor Driver $15

A CD/DVD (Example: http://www.newegg.com/Product/Product.aspx?Item=N8... )

Two 90 Degree surfaces (Can be even be two small boxes)

PhotoTransistor/LDR to detect light $1.50->$5.00 (I used a phototransistor and a photodiode)

Lots of Breadboard Wires/Jumpers (Male and Female or Male/Female

A USB Serial Converter or even just your Arduino/MSP Board $15 (I prefer a Serial Converter)

Several Screwdrivers (One needs to be the tiny sort used for eyeglasses repair $1)

Male Headers (Better to have more of these than you need for just this project)

Solder

A Soldering Iron

Hot Glue Gun

Double Sided Tape

A USB mini-B cord

Small BreadBoard

Tweezers or Xacto-Knife

Twist Ties

Reminder: You can probably get all of these items for a much lower price at Amazon and/or Ebay, but these are some of the distributors which will most likely have these products for some time.

Step 2: Now to take apart the CD Drive

DIY Spectrometer) Explore the Unknown ->

First you will need to take apart the CD Drive to use the parts for the project. There are many valuable parts in the disk drive and I'd recommend keeping all of the extra harvested motors, optics and parts (There is even a Laser Diode)

So all you need for now is the CD Drive and a Phillips Screw Driver

Step 3: Unscrew the First set of screws

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

On the Bottom of the CD Drive there should be a set of four screws to allow for one to access the drive.

Step 4: Take the top off

DIY Spectrometer) Explore the Unknown ->

Now that you have removed the screws, you can now simply take off the Panel. This Flat(ish) panel will be used at a later time to mount all of the parts.

Note: You may not actually have to pry off the top, but in my two cases I needed to.

Step 5: Now Start taking out the Circuit boards

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Now start removing the circuit boards inside of the CD Drive. It should be relatively easy; mine did not have any screws, but only clips. Depending on the CD drive that you have will be dependent on what you actually need to do to take out the circuit board. You can also start disconnecting the wires. Try not to break the wires. (I know sometimes it is hard not to accidentally break a wire, but is not really a requirement, but do not break the stepper Motor wire)

Step 6: Now to get the metal frame off...

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Now very simply get a screwdriver to push the two tabs on each side of the disk drive, then you should be able to pry the drive open from the top side. Take the metal frame off; you will not need this for the project (unless you want to use it as a 90 degree mount...) It might be a little hard at first to take off, but if you try to pry if off and it starts coming out, it might just a bit hard to take off.

Step 7: Now make the disk drive go out.

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Take a battery and attach it to the two leads of the DC motor. This will allow for the motor to spin in a direction. If the motor is running and the disk tray is not coming out, then try switching the Polarity (+ and - of the the Battery on the motor) The tray should come out.

Step 8: Take out the Sensor Bay

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Unscrew screws mounting down the Sensor Bay. Then Take out the Sensor bay.

Step 9: Unscrew the Brushless Motor

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Unscrew the Brushless Motor. You will not need this for this project, but you can save it for later. In this case though, the Stepper motor is attached to the brushless motor subassembly and you will need to desolder the connector at a later time to wire the Stepper Motor.

Step 10: Grab your small screwdriver

DIY Spectrometer) Explore the Unknown ->

Now you need to grab your small screwdriver to take out the current sensor and laser array.

Step 11: Take out the Sensor/Laser array

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
Show All 9 Items

Start unscrewing all of the screws that are holding down the sensor array and Laser diode. Then pry the boards off, because they are glued to the assembly. Be careful it might be a good idea to not break any of the connections just in case you want to use some of the parts for another project.

Step 12: Take out the rubbery things and the Beamsplitter Lens

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

First take out all of the large rubber things in the mounting holes, then take out the beamsplitter inside of the assembly head.

Step 13: Glue your sensor

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Depending on what intensity you are expecting, and the angles that you want to hit your sensor, you can either mount it on the front, where there is a greater chance of being hit by light, or inside of the assembly head where there are less chances of being hit by a beam of light.

Step 14: Mount the linear assembly

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Grab your 90 Degree mount and the base that you took off before and then the assembly. Glue all of the parts together in such a fashion that the long-ways of the assembly is up and the short-ways of the assembly is parallel to the short-ways of the base-plate.

Step 15: Grab your CD/DVD and tweezers

DIY Spectrometer) Explore the Unknown ->

Get your CD and tweezers because its time to take apart a CD/DVD!

Step 16: Taking Apart the CD/DVD

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

First grab your tweezers or X-acto knife and a CD/DVD. Simply separate the disk into two by placing the tweezers between the two layers from the center hole of the disk. Then go all the way though and soon you will have two disks.

Step 17: Getting your Diffraction Grating

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Now get the disk that does not have the picture on it, and cut a part of the disk that does not have any silvery material on it. This will be your diffraction Grating. (It might not be purple, it depends on the CD/DVD)

Step 18: Placing the grating

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Grab your second mounting block and put double sided sticky tape on the diffraction grating and the and 90 Degree mount. Then in order to be able to adjust the location of the mount put double sided sticky tape on the bottom too so that the grating can be moved for one position to another.

Step 19: Starting with the electronics

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
Show All 8 Items

Remember that Connector that I told you to hold onto? Well now you need the Stepper Motor connector so that you can interface with the Stepper Motor. So desolder the connector and solder it to Four header leads so that it can be accessed more easily. After soldering, then reattach the connector to the Stepper Motor.

Step 20: Set Up the Stepper Controller

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Grab the Stepper Motor controller and some header that are One 1x4 pin One 1x3 pin and Two 1x2 pin headers. Solder these headers onto the Motor Ports A and B; M+ and GND; GND, DIR and STEP; and 5V pins. VERY IMPORTANT: IF YOU ARE USING THE MSP430 THEN YOU WILL NEED TO ALSO SHORT THE 3/5V JUMPPER SO THAT THE MSP430 IS SAFE.

Step 21: Readying the Chip and the Stepper Controller

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Put the MSP430G2553 and Stepper Driver on a Breadboard. Mount the breadboard to the base plate.

Step 22: Wire the Stepper Motor

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Now wire the Stepper Motor. Read the pictures for a better description, but basically you just need to attach wires from the stepper to the Stepper A ports and Stepper B ports.

Step 23: Wire the GNDs and VCCs

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
Show All 7 Items

Now just wire each GND to the Negative Rail and M+ to the right positive rail and All of the rest of the VCCs to the left Positive Rail.

Step 24: Wire the Stepper Control to MSP430

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Connect STEP to P2_4 and DIR to P2_5. Then the control for the Stepper is established.

Step 25: Attaching the Sensor

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Now attach one of the two wires to the GND or VCC (User Preference) and the other to P1_3.

Step 26: Attach the Serial Conveter

DIY Spectrometer) Explore the Unknown ->

Connect RX from the Serial Converter to the fourth pin on the left of the MSP430G2553 (P1_2) and TX to the Third pin on the left of the MSP430G2553 (P1_1). And attach GND to one of the - rails.

Step 27: Calibrate your Machine!

DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->
DIY Spectrometer) Explore the Unknown ->

Grab your calipers or measuring utensil and measure two distances: Distance between the center dot and the diffracted dot and the distance from the grating to the assembly (X Axis). First measure the distance to the Assembly head. Next shine your laser at the diffraction grating and mark where the bottom dot is and move the assembly head to where to top dot is. Measure this distance; make sure to record these distances, you will need them in the next step.

Step 28: The Code

DIY Spectrometer) Explore the Unknown ->

This code can be ported to Arduino IDE From Energia and works perfectly on both platforms.

You can download energia here: http://energia.nu/download/

CHANGE THE x AND THE D AND THE nm VARIABLES TO MATCH YOUR RESULTS FROM THE LAST STEP! Otherwise your calibration will be my calibration for my machine, not yours. It will then fail to provide accurate data.

The Below Code is for use with an SD card and Live stream.

#include "SPI.h" #include "pfatfs.h" #define cs_pin 10 // chip select pin #define read_buffer 128 // size (in bytes) of read buffer unsigned short int bw, br;//, i; char buffer[read_buffer]; int rc; DIR dir; /* Directory object */ FILINFO fno; /* File information object */ //I/O Below const int StepperMotor = P2_4; const int StepperDirection = P2_5; const int Sensors[] = {P1_3}; // Add more sensors here!\ //Constants for calibration below! const double nm = 405; // Known Calibration source Frequency const double x = 33.28; // Distance of point above the "Screen" const double D = 48.78; // distance to the "Screen" const double degreesperstep = 18; // Degrees per step for the stepper motor const double microstepping = 8; // This allows for you to determine how often you want the Sample to be taken (inverse microstep) const double mmPerRotation = 2.76; // This is the distance between the two teeth of the spindle which moves the sensor up and down const double heightofTray = 38.00; // Under estimate this a bit const double starty = 32.35; const boolean SDCARD = false; /////////////////////////Fiddle with the below at your own risk!/////////////////////////////////////////// const double stepsperrotation = 360/degreesperstep; const double microstepsuntilend = heightofTray/mmPerRotation * stepsperrotation * (microstepping); const double d = (nm*1e-9)/sin(atan(x/D)); //const double d = 720e-9; //const double x = (nm*1e-9*d); int wavelengthvIntensity[sizeof(Sensors)-1]; int datafile = 0; double cnt = 0; char buf[30]; double tempnm = 0; double currenty = 0; const double zero = starty-x; char ksk = '0'; void setup() { pinMode(PUSH2, INPUT_PULLUP); pinMode(StepperMotor, OUTPUT); pinMode(StepperDirection, OUTPUT); digitalWrite(StepperMotor, LOW); digitalWrite(StepperDirection, LOW); Serial.begin(9600); // initialize the serial terminal if (SDCARD == true){ FatFs.begin(cs_pin); // initialize FatFS library calls } for (int i=0;iSerial.println();Serial.print("Failed with rc=");Serial.print(pff_err,DEC); for (;;) ; } void writedata() { rc = FatFs.open("Data.csv"); if (rc) die(rc); Serial.println(); Serial.println("Writing scan Data"); delay(100); bw=0; for (int i=0;iloop() { if (ksk == '1') { ksk = 0; cnt = 0; while (cnt < microstepsuntilend) { for (int i=0;iSerial.print(wavelengthvIntensity[i]); Serial.print(", "); } Serial.println(tempnm); if (SDCARD == true) { writedata(); } digitalWrite(StepperMotor, HIGH); delayMicroseconds(1); digitalWrite(StepperMotor, LOW); delayMicroseconds(1); cnt++; //Serial.println(currenty); currenty = zero+((cnt/microstepsuntilend) * heightofTray); tempnm = d*sin(atan((x+currenty)/D))*(1e9); } digitalWrite(StepperDirection, LOW); for (int i = 0; i < microstepsuntilend; i++) { digitalWrite(StepperMotor, HIGH); delayMicroseconds(250); digitalWrite(StepperMotor, LOW); delayMicroseconds(250); } digitalWrite(StepperDirection, HIGH); Serial.println("$"); } ksk = Serial.read(); }

The Code Below is the Code for the spectrometer: Live Mode Only.

//I/O Below const int StepperMotor = P2_4; const int StepperDirection = P2_5; const int Sensors[] = {P1_3}; // Add more sensors here!\ //Constants for calibration below! const double nm = 405; // Known Calibration source Frequency const double x = 37.65; // Distance of point above the "Screen" const double D = 50.00; // distance to the "Screen" const double degreesperstep = 18; // Degrees per step for the stepper motor const double microstepping = 8; // This allows for you to determine how often you want the Sample to be taken (inverse microstep) const double mmPerRotation = 2.76; // This is the distance between the two teeth of the spindle which moves the sensor up and down const double heightofTray = 38.00; // Under estimate this a bit const double starty = 32.35; /////////////////////////Fiddle with the below at your own risk!/////////////////////////////////////////// const double stepsperrotation = 360/degreesperstep; const double microstepsuntilend = heightofTray/mmPerRotation * stepsperrotation * (microstepping); const double d = (nm*1e-9)/sin(atan(x/D)); //const double d = 720e-9; //const double x = (nm*1e-9*d); int wavelengthvIntensity[sizeof(Sensors)-1]; int datafile = 0; double cnt = 0; char buf[30]; double tempnm = 0; double currenty = 0; const double zero = starty-x; char ksk = '0'; void setup() { pinMode(PUSH2, INPUT_PULLUP); Serial.begin(9600); // Hah, I forgot to add this in Special thanks to tommy_goh1997 for spotting the bug! pinMode(StepperMotor, OUTPUT); pinMode(StepperDirection, OUTPUT); digitalWrite(StepperMotor, LOW); digitalWrite(StepperDirection, LOW); for (int i=0;iloop() { if (ksk == '1') { ksk = 0; cnt = 0; while (cnt < microstepsuntilend) { for (int i=0;iSerial.print(wavelengthvIntensity[i]); Serial.print(", "); } Serial.println(tempnm); digitalWrite(StepperMotor, HIGH); delayMicroseconds(1); digitalWrite(StepperMotor, LOW); delayMicroseconds(1); cnt++; //Serial.println(currenty); currenty = zero+((cnt/microstepsuntilend) * heightofTray); tempnm = d*sin(atan((x+currenty)/D))*(1e9); } digitalWrite(StepperDirection, LOW); for (int i = 0; i < microstepsuntilend; i++) { digitalWrite(StepperMotor, HIGH); delayMicroseconds(250); digitalWrite(StepperMotor, LOW); delayMicroseconds(250); } digitalWrite(StepperDirection, HIGH); Serial.println("$"); } ksk = Serial.read(); }

Step 29: Python

DIY Spectrometer) Explore the Unknown ->

First download python: https://www.python.org/downloads/. The packages that you will need for Matplotlib (to Graph) are: (Matplotlib), numpy, libpng, freetype, six, serial, dateutil, and pyparsing. If you are running debian/ubuntu you can apt-get them with sudo apt-get build-dep python-matplotlib If you are running windows then you can download all of them from http://www.lfd.uci.edu/~gohlke/pythonlibs/ That is what I use because of convince. All of the packages for windows are practically all on the same page, just do a ctrl+F and then you can find any of the packages you need.

Then you should be able to use my code for Graphing the information.

Edit the COM port in "Write Data.py" and run test6.py to run the Spectrometer. Press Rescan to read from the spectrometer.

DIY Spectrometer) Explore the Unknown ->
test6.py1 KB
DIY Spectrometer) Explore the Unknown ->
Write Data.py467 bytes
DIY Spectrometer) Explore the Unknown ->
SpectrometerData1.dat24 KB

Step 30: Enjoy!

DIY Spectrometer) Explore the Unknown ->

Now you should have a working Spectrometer!

Enjoy!

If you need help or if I didn't explain something well, feel free to ask and I shall happily help you!

Thanks

Have a Great Day!

Step 31: PCB Files

DIY Spectrometer) Explore the Unknown ->

Attached are the Altium Project files and in the "Project Outputs for Spectrometer" Folder are the Drill Files and Gerber files for the 1 Layer board. This board consolidates all of the wiring steps into a simple PCB board that you just have to solder basic connectors on. You can get some here: https://oshpark.com/ or any other PCB manufacturer.

DIY Spectrometer) Explore the Unknown ->
Spectrometer.zip6 MB

Step 32: References

Balachandran, Rama and Karen Porter-Davis.

"USING CDs AND DVDs AS DIFFRACTION GRATINGS." 2009.

http://www.nnin.org/sites/default/files/files/Kare...

Minebea-Matsushita Motor Corporation.

PL15S-020

http://robocup.idi.ntnu.no/wiki/images/c/c6/PL15S0...

Easy Driver

EasyDriver v4.4

http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Rob...

https://www.sparkfun.com/datasheets/Robotics/A3967...

Vishay

TEMD6010FX01

http://www.vishay.com/docs/81308/temd6010.pdf

Energia

MSP430G2 LaunchPad

http://energia.nu/download/

http://energia.nu/pin-maps/guide_msp430g2launchpad...

 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel