Introduction: DIY UV-VIS Arduino UNO

The following procedure will teach you how to create a DIY UV-VIS spectrometer from supplies at home combined with an Arduino UNO microprocessor.

First you'll want to gather all your supplies!


  • Oatmeal container
  • Opaque tape such as masking tape, painters tape, electrical tape, etc.
  • Flash light
  • Scissors
  • CD to break
  • Arduino UNO microprocessor
  • Computer with Arduino software
  • Airplane shot with clear plastic body (filled with water)
  • Photo resistor
  • Jumper wires
  • Breadboard
  • Cotton balls
  • Food coloring
  • 10 kOhm Resistor

Step 1: Creating the Body of the Instrument

To make the body of the UV-VIS:

  1. Remove the contents of the oatmeal container
  2. Remove lid
  3. Cut down the side of container completely
  4. Cut out the cardboard underside of the container, save this piece for reattachment
  5. Tape inner walls of container
  6. Make a circular cut the size of the airplane shot on the side of the container you haven't already cut
  7. Tape the sides of this hole to seal

Step 2: Add Sample Cell to Body

Now that you have made the basic body of the instrument, it's time to add the sample cell!

  1. Ensure your airplane shot is filled with water
  2. Tape sides of the airplane shot so that a slit is made on both the front and back of the 'cuvette'. Try to tape well enough that the light passing through the cell will have a straight path
  3. Once satisfied with the cuvette, tape the initial cut you made down the side of the container back together

Note, we taped the front of the flashlight in a way that created a tunnel for the light to go through to the sample cell to minimize the flashlights interference with the photo resistor. This was done at this step but no picture was taken of how to do so. You will see the flashlight pictured in use on the "Conduct experiment" step later in this tutorial.

Step 3: Add Analyzer to Body

The next necessary element in the UV-VIS spectrometer is the analyzer. We will be using a piece of CD broken off as a makeshift monochromator grating.

  1. Find a CD you don't mind breaking
  2. Break CD into a large enough piece for use
  3. Make a cut in the top of the container, behind the sample cell
    • This placement of this cut is important! You will be taping back on the cardboard bottom in the next step. You want the cut you make to be in-between the cuvette and the cardboard bottom.
  4. Insert shard of CD so that it sits snug, but not all the way in
  5. To angle the shard, tape the tip sticking out towards the cuvette, so that within the body it is angled away from the cuvette.

Step 4: Add Detector

Once your analyzer is in place and angled appropriately it is time to add the photo resistor.

  1. Insert the saved cardboard bottom back into the container and make a seal of tape over the end; it does not have to be flush with the cardboard, we just don't want light escaping this side
  2. Shine flash light through cuvette towards the CD piece until a spectra is shone onto somewhere on the inner walls of the container. This may take adjusting the angle of the light beam, and yours may look different than the one pictured, depending on the angle of the CD
  3. When you have found the colorful spectra, use a sharpie or marker to mark within the body where you want to place the detector, the best spot would be the apex of the spectra
  4. Poke a hole through the mark you made in the previous step
  5. Add jumper wires to the photo resistor tails and insert the photo resistor head into the hole made in the previous step

Step 5: Hook Up Detector to Arduino Microprocessor

Time to build the circuit! This step will require your Arduino, jumper wires, a 10 kOhm resistor, photo resistor and possibly wire extender.

  1. Build the circuit according to the schematic pictured above. Ignore components crossed out, this schematic has been adopted from an instructable by codebender_cc and can be found at this link
  2. Upload the code in the following step to your microprocessor
  3. Pull up the serial monitor in the right hand corner of the Arduino app window
  4. Shine your flashlight through the cuvette onto the CD so that it hits the photo resistor, read the values displayed in the serial monitor to ensure everything is working correctly. It should read 0 when you are not shining the light towards it
  5. The previous step may require taping the photo resistor and wires to the side of the container for stability

Step 6: Arduino Code

This is the code that should be used. The data you will gather will come from the serial monitor function of the Arduino application.

const int sensorPin = 0;
int lightCal; int lightVal;

int readingNumber = 0;

void setup() { lightCal = analogRead(sensorPin); Serial.begin(9600); Serial.println("Serial is initialized"); Serial.print("Initial light reading: "); Serial.println(lightCal); Serial.println("ReadingNumber,LightValue"); }

void loop() { lightVal = analogRead(sensorPin); Serial.print(readingNumber); Serial.print(","); Serial.println(lightVal); readingNumber++; delay(1000); if (lightVal < lightCal - 50) { } else { digitalWrite(9, LOW); }


Step 7: Conduct Experiment

Once your code is uploaded and functioning properly, you may now conduct the experiment!

  1. Obtain cotton ball, and pull apart to make a long cotton piece
  2. Stick one side of the cotton into the water within the cuvette so that the inserted side sits in the water. Ensure that one side stays outside the cuvette
  3. When you are ready to collect your values, shine the flashlight through the sample and collect the initial value displayed in the serial monitor; this is your blank value. (*note how the flashlight has been taped so that all light is directed forward through the sample cell*)
  4. Saturate cotton with a dark color of food coloring. Make sure it is well soaked, the goal is for the concentration of the dye to gradually increase within the water
  5. Shine the flashlight through the cuvette, producing readings from the photo resistor in the serial monitor
  6. Continue to collect readings as the dye saturates the water, you should see your values decreasing from the initial blank value

Congratulations! You have made a functioning UV-VIS spectrometer at home on your own.

Step 8: References

Code and Arduino schematic adapted from:

User: codebender_cc

Step 9: Video for Further Instruction

Step 10: Credits

Creators: Haleigh Morphis and Ben Murphy