Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
DIY Raspberry Pi Spectrometer Guide (github.com/leswright1977)
208 points by robertelder on Jan 21, 2022 | hide | past | favorite | 28 comments


OT question: Is it possible to use a wedge-shaped slit (uneven width) to increase the dynamic range of a slit-grating-camera phone spectrograph?

Backstory: I've repeatedly encountered deep confusion about color, even among first-tier physical-sciences graduate students. Yet color is widely taught K-2. Apparently without great success. So what might a rewrite, a modern learning progression for color, look like? Perhaps one based on spectra, a modern colorspace, and building on current understanding of color perception? Tablets are used in K - "find and take a picture of a circle". So how about using them for color? There's middle-school work with color "arithmetic" (an <R, G, B> binary triple with addition(light) and subtraction(filter)). And phone spectrographs are a thing. Thermal IR inspection cameras suggest having a context image aids understandability, and phones now have multiple cameras, so might one do a more accessible sample-with-context spectroscope app? With the light path folded flat, not sticking out? And a high dynamic range to permit sampling objects under ambient illumination? Might one craft a spectra-based introduction to color? For K?


Why. All models are flawed, some are useful. Kids learn mixing paints, that's useful for arts and crafts. Students learn more advanced models depending on their needs.


> Why. All models are flawed, some are useful. Kids learn mixing paints, that's useful for arts and crafts. Students learn more advanced models depending on their needs.

:) Partly-in-jest paraphrase: Most all models used in science education are needlessly ghastly flawed, leaving students and their teachers steeped in misconceptions. Some are useful - for important exams, or for collaborating with teachers in pretending topics are understood, though vanishingly few provide transferable or operational understanding, let alone integrated or interdisciplinary or rough-quantitative understanding. Students develop less dysfunctional understanding depending on their needs, which can be surprisingly limited. For examples, students empirically don't need to know the color of the Sun to be first-tier astronomy graduate students, nor the order-of-magnitude size of cells to be first-tier medical graduate students, so teaching the wrong color for the Sun, starting in K and continuing into undergrad intro astronomy, and teaching size/scale unsuccessfully from middle-school through undergrad, are in some sense not failing to meet student needs.

Shrug, ok. Also, it's unclear society needs, wants, or would appreciate, or even tolerate, students making sense of the physical world.

But... it can be fun, to at least discuss and explore, how we might go about it, were that an objective to be intensively pursued. No?


There are many intentional omissions because people can't afford to study too many years on a curriculum. If you're interested in exploring this issue, perhaps consider what priorities an education ministry would have. For most, knowledge is a means to an end, not an end unto itself.


No need for a Raspberry Pi! I once made a spectrometer at home out of just a camera, a white LED and a diffraction grating (and some tape and a wood base to hold it together). If you don’t have a diffraction grating, it can be replaced by a CD — only difference is that the CD operates using reflection vs transmission. The idea is that you shine the light from the LED through your sample (which I bought some cuvettes to hold); the light then transmits through the grating / off the CD, which splits it into wavelengths. One can then take a photo of the spectrum and analyse it using a program such as [0]. Of course, an LED is a pretty terrible light source, but with some sort of baseline correction I suspect it could actually become pretty reasonable as a spectrophotometer.

[0] http://scheeline.scs.illinois.edu/~asweb/CPS/


You can use a peeled-apart DVD and a USB web camera for a fraction of the cost. It's a design Public Labs came up with around 2012: https://hackaday.com/2012/08/27/turning-a-webcam-into-a-spec...

Public Labs even developed a modified design that works with most smart phone cameras, among their follow-up work (such as testing high-end cameras: https://publiclab.org/notes/stoft/10-23-2016/high-rez-webcam... )

The spectral response of the sensor is not linear, as it is designed to imitate human vision - and as anyone who read early 2000's digital camera reviews can tell you, even fancy cameras from well known manufacturers can have noticeably different color response.

One benefit of Rasp Pi cameras is that genuine cameras could be evaluated and characterized, but counterfeits and such will be a problem. Same is true of USB web cams, I suppose.


Does anyone know what you call the mount with a screw that's holding the spectrometer for either the mini/larger version? I couldn't seem to see it mentioned in the readme.

I tried something similar using just blu tack to hold the spectrometer to camera, from looking at the graph from it I think I possibly used the pi noir camera, as it can seem to see up to 900+nm or so.


I worked in a laser lab w/ an optical table in college and I believe it's called a beam probe mount. If you're referring to the black powder coated aluminum block w/ the through-hole and the tightening screw.


Unfortunately, light spectrometer, not mass spectrometer.

I'd love a DIY mass spectrometer or liquid chromatograph for biohacking!


You might like - https://www.youtube.com/watch?v=nIKhUizkXxA ( DIY mass spectrometer measures potassium in dietary salt substitute ) by Ben Krasnow


As well as Chromatogiraffery's channel: https://www.youtube.com/channel/UCZ8l6SdZuRuoSdze1dIpzAQ


I think you're going to have a very hard time doing any kind of actual (interesting) analysis on a DIY MS.


List of open source software to analyze data from mass spectrometers.

https://bryanhanson.github.io/FOSS4Spectroscopy


https://www.open-raman.org/

You can try building that one. It's a DIY raman spectrometer.


Also a neat write up of a DIY near-IR spec here: https://caoyuan.scripts.mit.edu/ir_spec.html

I'm still holding out hope someone will make an open source FT-IR design. I actually need one for a project I'm working on, and I'd prefer not to shell out thousands of dollars for a used machine.


What are the key hardware differences between near IR and FT-IR? Could they be overcome with some software assisted analysis?


Just in time to make a DIY plant-sap-analysis tool, perfect timing!

Related: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4371691/


If you’re into lasers, Les’ YouTube channel is a goldmine.


This is awesome! Is there a way to try different hardware to have a spectral range to [440nm - 2200nm]? Or am I too ambitious?


Color visible sensors tend to have a spectral range of 400 to around 1000 nm. (There is often an additional glass filter to block ~ 800+, which is removable).

Beyond 1000 nm, silicon becomes transparent and ceases to work as a detector, so those longer wavelengths need a detector made from another material, notably indium gallium arsenide (InGaAs) which in one form can get all the way out to around 2700 nm. Anything that gets you away from silicon chip fab also gets you away from the fab-ulous economics of silicon. InGaAs sensors are super damn expensive.

Beyond 2700, thermal imaging cameras and the like use even more exotic sensor materials.

An alternative for those longer wavelengths is a monochromator (e.g., rotating diffraction grating detecting one wavelength at a time) and a single element detector which is cheaper than an array. If course your subject has to be sitting still for the duration of your measurement.


What would happen to the quality if the diffraction grating spectroscope were replaced with a prism?


That can work too. You have to work out the range of angles that a given prism produces, not an unsolvable math problem.


Adding one more thought, an efficient prism can be more efficient than an inefficient grating. Gratings tend to be preferred in commercial spectrometers because the grating equation has fewer parameters that can fluctuate, and reflection gratings can cover wavelength ranges where there are no convenient optical materials with sufficient dispersion to be practical.


$70 seems expensive for a diffraction grating, what am I missing?


There's very little use for a general purpose grating, since all commercial uses end up with custom gratings directly from manufacturers. So the ones that are sold in catalogs tend to be more expensive owing due to economies of scale, maintaining an inventory, and probably passing through one or more middlemen. And people willing to pay R&D prices to have something quickly drive up the price as well.


How does it compare to a diffraction grating that costs $2? Quickly Googling this I found: https://www.homesciencetools.com/product/diffraction-grating...

One of the reviews on that page mention implementing a spectrometer:

> The 1,000 lines/mm Diffraction Grating Plastic Film was used to make a high resolution optical spectrometer. First, the film was removed from its paper 2" x 2" card stock. The crystal clear film was next glued to an optical ring that was mounted in front of a very inexpensive 1,920 x 1,080 pixel webcam. The modified webcam was placed in the back oRead more about review stating Using the 1,000 line/mm Diffraction Grating in a Spectrometerf a pinhole camera-box and mounted at an incident-angle to the incoming light beam. In this configuration different light sources could be introduced to the new spectrometer and their light spectrum captured using a USB-computer input. Thus, a wide variety of light sources could be fully analyzed at a resolution of about +/- 2nm. Using this very inexpensive (1,000 lines/mm) grating, coupled with an equally inexpensive webcam, a high resolution optical spectrometer could be built for under $25.00


Most spectrometers use either reflection gratings, or holographic transmission gratings that are tailored for optimal efficiency to the wavelength range of interest, and also have exceptional flatness, surface quality, and so forth. "High resolution" is relative, and there are a lot of other figures of merit for spectrometers.

This is a prominent US supplier, and they offer a lot of useful info at their site:

https://www.gratinglab.com/Home.aspx

With all that said, the plastic grating is a very cool thing, and with it you can demonstrate pretty much all the basics of gratings and spectrometers.


I'm no optical engineer, but I suspect one issue with those types of plastic gratings is ensuring the flatness of the surface; its just a thin sheet of plastic so I'd expect it to buckle/wave around quite significantly. More serious gratings are solid chunks of glass instead.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: