These are laser pointers and we all know that light comes in the form of waves.
So each color has a different wavelength.
And to measure the wavelength we use a so-called spectrometer and today I’ll be doing a homemade
one.
Basically we make the light pass through a small slit and then we use a diffractor and
split the colors of the light, each one with a different angle.
We point the light towards a digital camera.
We read the values of the camera with the Arduino and graph those values according to
the intensity.
Like that we get the digital color spectrum of our light.
Today we will learn some physics and try to make this homemade and crude spectrometer.
I bet that you will learn something new so let me show you what we need, the entire optical
process, the Arduino code for the display and the camera and how to make the prototype.
So guys, let’s get started.
What’s up my friends, welcome back.
For this project we need a few components but we will go over that in a moment.
First we need to use some laser pointers and learn some optical physics.
These are 3 lasers with colors of red, green and blue.
If you take a look closer, on their tag we can see some numbers, 650nm for red, 532nm
for green and 405nm for the blue one.
That’s because the color is related to the wavelength.
This here is the electromagnetic spectrum.
From all these types of waves, the only ones we can see with our naked eyes are these ones
here.
A very narrow bandwidth from 400 to 700 nm and this is called “visible light”.
Light travels at a constant speed.
But when it passes through a medium, it gets slowed down a bit.
But you see, each color wavelength gets more or less slowed down.
To understand, here we have a beam of white light traveling through air.
White light has all the colors merged together.
In front of it we add a material with a different refraction index than the air.
Since each color is affected differently, the red color slows down just a bit so the
angle changes just a bit as well.
The green color slows down even more so the angle is bigger.
And the blue one slows down even more, so we get the highest angle difference.
So as you can see, just by passing the white light through a different refraction index
material, it can split the light into all the colors.
That’s what this component here will do.
This is called a diffraction grating and it has 1000 lines per mm.
Basically, when light hits this transparent film, it will split the light into all its
colors.
As you can see, using white light, we can see the full spectrum from red to blue.
When light hits this film, it will point the red color more to the left, the green light
somewhere in the middle and the blue color more to the right and the rest in between.
We could also use this component here which is some kind of handheld optic spectrometer
but since the lenses are too small, I will try using it for a future update.
Anyway, I place the diffraction grating like this and add a white paper in front of it.
I get a white flashlight and using a small fresnell lens, I point the light towards the
grating.
As you can see we get the white light in the middle, and the splitted colors to the left
and to the right.
Actually we get one and then a second one and these are called first order spectrum
and second order spectrum.
Now we know how to split the light into all the color spectrum and that was the first
part.
Now we have to measure the intensity of the colors.
For that I have this digital camera with the TSL 14 01 chip.
I take the lens off and as you can see, we have that linear sensor.
We can read the sensor values with the Arduino.
The camera has 128 pixels and we can get the intensity value of each pixel on the A0 pin
and we can measure that with the Arduino analog inputs.
All we have to do is to make the color spectrum hit the entire width of the camera sensor
from here to here.
For that we use lenses, and I’ve prepared a testing setup.
To only let a small part of the light pass straight forward, we first add a precise slit
using two very fine razor blades.
Then we add the diffraction grating.
In between I add my first lens that will make the light go straight.
We can move these parts and adjust the focal distance.
At this point if I shine light to it, as you can see, we get the spectrum on the other
side but is too small and it has an angle.
For that, on the other side I add another lens to magnify the colors and this is followed
by the camera sensor.
To be able to change the angle, I’ve 3D printed this part so it could rotate on the
middle axis like this.
This lens can also slide forward and backwards so we can adjust the focal point.
This is the most difficult part, adjusting the lens position.
So get a flashlight and point it at the small slit.
Rotate the camera 3D part till you can appreciate some colors.
At that point, start moving the lenses around till you get a well focused spectrum that
covers the entire camera sensor.
Now we could take a measurement and this was part two of this project.
For part 3, the schematic for this project is something like this.
This project was made by stoppy 71 on instructables, and a huge thank you for that.
Links for his work are below in the description.
Connect the camera to 5V, ground, clock and data and the A0 pin will be connected to the
analog Input A0 of the Arduino MEGA.
We are using a MEGA because is compatible with this TFT display.
Once the camera is connected, just snap this display on top of the Arduino MEGA.
Download the code from below.
If you open this code you will see that we first import the library for the display.
Download it from below as well.
Then we define the pins for the camera.
In the void loop we first print the graph lines for the X axis.
That will print something like this on the screen.
Then we use the “GET CAMERA” function.
This function will create a “FOR” loop from 0 to 127 because we read 128 pixels from
the camera.
After each clock pulse, we read the analog input on A0 and we store the brightness value
on this vector on the corresponding position from 0 to 127.
Now we have all brightness values stored.
In the void loop we create another “FOR” from 0 to 127 and we create a vertical line
on the screen.
The height of this line is given by the brightness value from the camera.
That’s how we plot the values.
But if you upload this code, the graph will have the same color and only show the brightness
level.
So, to make it cooler, stoppy 71 also added colors so as we pass from 400 to 700 nm we
go from violet, to blue, green, yellow and up to the red color.
That’s why we have these parts in the code segmenting the graph in 7 parts and fading
the colors from blue to red.
Ok, now we have the lens part, the diffraction process and we also measure the light with
the camera.
But how can we know the relation between the pixel position of the camera and the wavelength
on the graph.
Well, we have to calibrate the position using 3 lasers.
Red, green and blue with these wavelengths.
There are two ways to do it.
First, by moving and rotating the real camera.
And the other way is to just fix in place the camera, point the laser, write down the
pixel position from the camera and adjust the code graph so it will match the wavelength.
So here’s what I will do.
Point the red, green and blue lasers separately and you will see they hit a different position
on the camera sensor.
Then check the screen.
For red, rotate the camera till we get the peak line at around 650 nm as it says on the
laser pointer.
Change the red laser to the blue one and the line will now be on the other end of the camera.
If is not exactly at 405nm, you have to move the camera backwards or forwards in order
to make the spectrum more narrow or wider as you can see.
Play around with moving the camera and rotating the entire slide till you get the colors at
the correct wavelength on the screen.
Now that the camera is in the right place, I give it a final test with all 3 colors.
I point the red color and we get a line on the left side of the camera and on the screen,
we get a peak at around 650nm.
Then I place the green light and we get the line almost in the middle of the camera and
a peak around 530 nm.
Finally, I do the same with the blue color and the line is on the left side now on the
camera and on the screen, we get a peak at around 400nm.
So it seems that the spectrometer works.
The diffraction grating does its job and points each color on to the right position on the
camera sensor, more or less.
And here we have another test with a white color flashlight.
Have in mind you can change the exposure time with the potentiometer.
As you can see, we get the spectrum of a standard white LED.
This is the spectrum of a white LED I found on the internet.
We have a peak at around 420nm for blue and then we have the green and red together creating
a round shape.
Basically, all is left to do is to place this inside a case but since this is just a prototype
for now and I’m still testing around with different lenses, I’ll design the 3D case
for a future update.
Also, having a case will improve the results because no external light would get inside.
A future and more permanent update might be using this handheld optic spectrometer.
Inside we have a prism that also splits the visible light.
It also has its own lenses.
I might be able to fix this directly to the camera and have a smaller version of this
prototype.
But I need a lot more precision for that since the tube and the lenses are very small so
it gives you a very small error gap.
But I hope you now know how to make a crude homemade spectrometer.
You should know more about how light travels and how each color has a different wavelength.
Also how using a diffraction grating we can split the visible light into all its colors
and then measure their intensity with a camera sensor.
Check the part list, the code and everything you need below in the description.
Another thank you to stoppy 71 user for his work on this project.
I hope that you have learned something new and if so, consider giving me a like or comment
below.
Thanks again
and see you alter guys.