-
1Build instructions
For a good overview for the project and a good place to start watch the videos.
The physical build is simple. The heavy lifting is all done in Software, which is Open Source!
A video of the original Py-Spectrometer is available here (if you want something smaller, scroll down to the 3rd video!)
An explanation of the new software features is here:
The Miniature build video is here:
Hardware
The hardware consists of:
A commercial Diffraction grating Spectroscope https://www.patonhawksley.com/product-page/benchtop-spectroscope
A Raspberry Pi Camera (with an M12 Thread) https://thepihut.com/products/raspberry-pi-camera-adjustable-focus-5mp
A CCTV Lens with Zoom (M12 Thread) (Search eBay for F1.6 zoom lens)
Everything is assembled on an aluminium base (note the Camera is not cooled, the heatsink was a conveniently sized piece of aluminium.)
For the MINIATURE version the hardware is:
A commercial Diffraction grating Pocket Spectroscope: https://www.patonhawksley.com/product-page/pocket-spectroscope
A Raspberry Pi Camera (with an M12 Thread): https://thepihut.com/products/raspberry-pi-camera-adjustable-focus-5mp
M12x0.5 F2.0 Fixed 12mm Focal length Lens: https://www.ebay.co.uk/itm/114551239930
***Assembly***
For either version:
Mount the lens onto the picamera. Mount the Picamera and Lens in such a way that it "looks down the barrel" of the spectroscope.
Refer to the above photographs for example mounts.
Point the spectromter at a light source and preview with a utility such as raspistill.
Use the command: raspistill -t0 for a live view.
Adjust the lens so the spectrum is in focus and rotate the sectroscope so the spectrum is aligned horizontally. The blue end should be on the left and the red on the right.
***Installation***
Developed and tested on: 2021-01-11-raspios-buster-armhf-full.img for anything else your milage may vary!
Rasberry pi 4 and PiCamera Recommended.
(Note the software uses the Linux Video Driver, not the Picam Python module. As a consequence it will work with some webcams on probably any Linux box (Tested on Debian with a random webcam))
First attach the Picam, and enable it with raspi-config
Install the dependencies:
sudo apt-get install python3-opencv
sudo apt-get install python-dev libatlas-base-dev
pip3 install scipy
pip3 install peakutils
Run the program with: python3 pyspectrometer-v1.py
To calibrate, shine 2 Lasers of known wavelength (He-Ne, Argon or DPSS recommended! (Diode Lasers can have wavelengths that can be +/- several nm!)) at a piece of card in front of the spectrometer.
Click the two peaks on the graph, and in each of the boxes enter the corresponding wavelength. Then hit 'Calibrate'. In this example I have Calibrated with 532nm (DPSS) and 633nm He-Ne. The Scale and lablels will then adjust to match your values.
For good accuracy make sure your wavelengths are quite far apart, ideally one at the red end and one at the blue end
Alternatively, you may use a Fluorescent tube (or any other gas discharge tube) in front of the Spectrometer, you will have to research the wavelengths of the emission lines (Mercury for Fluorescent tubes, Neon, Argon, Xenon for other types) That will be an excercise for you!
Other settings
"Label Peak width" and "Label threshold" set the width of a peak to label, and the level to consider it a peak respectively. The Defaults are fine, but if you find the graph too cluttered, you can play with these values.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.