Skip to main content

DIY Spectrometer

Tritium Vial DIY Spectrogram

Emission Spectrum of a Green Tritium Vial

To make the best decisions regarding solar cells, understanding the emission of Tritium Vials is critical. A lab-grade spectrometer can cost $5k-$10k, a bit out of budget for this project. Instead, building a spectrometer isn't too terribly difficult. Consumer-grade tools are available that enable the home enthusiast to construct an estimated optical spectrometer that, for general purposes, can be used. The range of this DIY spectrometer is easily between 40nm to 700nm. 

Raspberry Pi DIY SpectrometerRaspberry Pi DIY Spectrometer
Raspberry Pi DIY SpectrometerRaspberry Pi DIY Spectrometer

Raspberry Pi DIY Spectrometer

Emission Spectrum of a Purple Tritium Vial

To learn more about the luminosity and spectral intensity of tritium vials, read my post here: True Brightness of Tritium Vials 

How to Build this Spectrometer?

Credit, where credit is due, this 2016 project by Tony Butterfield, is the root for this idea; the physical form was replicated to the best of my ability with some improvements.  The code was initially analyzed and determined to be a guideline rather than a commitment

The CMOS sensor and features in typical Raspberry Pi Cameras do not capture a fair representation of the complete visible light spectrum. Because the hardware, in this case, is not reliable, applying additional cleanup logic on top was not preferred as I do not have a known source or sources to compare with. If I had a lab-grade spectrometer, then I would take this additional step to fine-tune this DIY Spectrometer.

Emission Spectrum of a Ice Blue Tritium Vial

Some critical build criteria:

  • Place the camera sensor at the rear of a long box.
  • Have the camera sensor back into the corner at a 30-degree angle.
  • Have the diffraction grading also at 30 degrees right Infront of the lens
  • Have the lens and diffraction grading centered vertically
  • Opposite of the lens, an aperture 1mm x 20mm vertical

Emission Spectrum of a Pink Tritium Vial

Improvements Over the Original?

3D Printed! 

This added a layer of consistency in terms of diffraction grating and camera placement. We can also more precisely control the aperture location and distance from the aperture to the lens.


What About that Code?

There are two scripts:
  • Toss this puppy (GitHub) on your Raspberry Pi. This script ONLY COLLECTS SAMPLES. Make parameter changes to account for exposure. (will discuss later)
  • Use this script (GitHub) on something w/ a bit more horsepower than a Raspberry Pi, like a PC. 
Use the Raspberry Pi as a "Sample Collection Tool" and a PC as your analyzer. 

Because we 3D printed the box and the aperture is 'far' from the sensor, we have a reliable place where we can expect the spectrum to appear. Your miles may vary, use:

    sliced_im = im[1100:1200, 970:1570]

To slice out your spectrum and fine-tune.

You might be thinking, "why not have it auto-locate the spectrum based on the detected aperture?"

Different exposure levels kept leaving me with too much trouble. This project has a focus on nuclear batteries and Tritium Vials. Tritium being such a weak light source, this solution gathers 50 samples from the Raspberry Pi, averages them together, and then performs waveform analysis. The motionless location of the spectrum is a huge benefit in this case.

Emission Spectrum of a Red Tritium Vial


I don't have any known emission pattern sources. Florent and Sodium Vapor lights have consistent emission patterns; however, I don't have either. All my street lights are LED now, and so are all the lights in my home. 

Using the Sun is my next best bet. Yes, everyone observes the Sun differently. Time of day, pollution, humidity, location on earth, etc... all factors on the emission spectrum. However, there is a relatively reliable general pattern that we can find all over online.

Googling around, we can find there are classic dips and drop-offs at critical points in the spectrum.

Emission Spectrum of Sunlight


Ideally, we don't want to over or underexpose the sensor, resulting in a poor spectrogram, basically a flat line. Using this bit of code helps take a test image to determine if the sample will be appropriate when taking a measurement.

libcamera-still -o /home/pi/Desktop/Spectrum/test.jpg --shutter 30000000 --gain 100 --awbgains 1,1 --immediate

Play with the 'shutter' and 'gain' parameters. For a tritium vial, the above was required to pick up on such small amounts of light.

Emission Spectrum of a Orange Tritium Vial


Recently word of this effort has made its way around some forums, and AMAZING feedback from experts has been provided. I will showcase some of the feedback here. These are all significant enhancements that could be made to this spectrometer.
  • Chris Cauwelier -  The 'reds' don't look accurate; try playing w/ different filter material
  • Steven Whiting - Invest in some high refractive index prisms and relatively narrow slits. Stick them on a precise motorized mechanism to turn to the required wavelength. Very easy to isolate and focus your wavelengths then. Most of the 1980s spectrometry gear used a similar
  • Richard Christopher Saragoza - If you use 2 or more lasers of known values, you can fine-tune this device even further.
  • JÄ™drzej Kowalewski - you will have better results if you use a monochromatic sensor

Other things to look at:

  • NO IR filter installed into Camera: Amazon
    • Can open the spectrum to ~250nm to 1000nm

Emission Spectrum of a White Tritium Vial

Support HobbyTimeWith.Me: 

Polygon Mainnet Tokens Accepted: 


Popular posts from this blog

Tritium Buying Guide

How to get your hands on some tritium? This guide will provide resources and what to look for when purchasing tritium. With the shipping disruptions of 2020, prices are all out of wack and should normalize.  Note: This guide will not cover the legal aspect as each country has its own laws and regulations. To learn more about the luminosity and spectral intensity of tritium vials, read my post here:  True Brightness of Tritium Vials   Spoiler: Tritium Safety Isotopes should be treated with respect, not only for the safety of yourself but also for the safety of others. The average amount of tritium inside a tritium vial has been observed as such: 3mm x 22.5mm tritium vial is roughly 0.1 curies (3.7 GBq) 5mm x 150mm tritium vial is approximately 1.8 curies (66.6 GBq) Is That Dangerous? It would be inappropriate to say anything other than 'Yes'; however, the risk is highly negligible. The EPA  touches on how tritium can enter and be processed through your body. Tritium is a low-ene

True Brightness of Tritium Vials

How Bright Are Tritium Vials? Describing the brightness of tritium can be difficult. People observe the luminescence differently and have differing opinions comparatively. So how can I  genuinely   share the luminosity of tritium vials and rank them?  Below I will showcase my findings using different techniques to put things into perspective. First things first, let's recognize the charting available today; maybe you have seen these or some variation of them:   These images are well over 10 years old and have several variants, some poorly photoshopped floating around. Let's make it our objective to reinvent this chart. Essential to take note, the charts above mostly agree on one thing, the ranking of 'output/yield' compared to each other by color. Spoil Warning , my results don't align with the common consensus listed above.  Take Amazing Photos of Tritium: Looking to