‘Diffraction Spectroscopy’ isn’t a tag that gets much use here at Tom’s Hardware, but we’ve broken it out in celebration of this mighty build from Les Wright, as featured on Hackster (opens in new tab): a Python implementation of an optical spectrometer powered by a Raspberry Pi 4.
The business end of the device is a commercial diffraction-grating spectroscope, which has been hacked onto a Raspberry Pi camera module with an M12 thread via a zoomable CCTV camera lens. The Python code on the Pi then analyses the captured spectrum, providing a readout as a graph of wavelengths.
Why would you want to do this? Well, we’ve got bad news for the governments of the world, as it seems Wright has been producing his own lasers. “The motivation behind this project was to build a tool that could measure the wavelength of home-made dye lasers and perform some fluorescence spectroscopy. Most importantly at a cost that is in reach of everyone!” he writes on his GitHub page (opens in new tab), clearly attempting to hide world domination plans behind a mask of scientific philanthropy. The exclamation mark never lies.
A piece of aluminum acts as a combination base and heatsink, and a standard ribbon cable connects the camera to the camera connector (CSI port) of the Pi, which has a simple heatsink and fan attachment rather than an enveloping case. Wright suggests you use He-Ne, Argon or DPSS lasers to calibrate it, shining them at a piece of card in front of the spectrometer. If you don’t have any spare lasers laying around, a fluorescent tube will do, as long as you research the emission lines beforehand.
Raspberry Pis and lasers (opens in new tab) seem to be (opens in new tab) made for one another (opens in new tab), and those of you rushing to build your own spectroscopes will be pleased to note that Wright has put everything on GitHub, so becoming a home-made laser-armed supervillain, and knowing exactly which wavelengths your weaponry is projecting, just became a lot cheaper.
Working with lasers is dangerous and the correct protective equipment should be used at all times.