Light Whistle - 3d printed spectrometer with DVD scrap diffraction grating

Simple Raspberry Pi camera based spectrometer, I used V2 NOIR camera, then it broke, then I used V3 camera. Rotating stage allow you to adjust reflection angle, which helps when using scrap/unknown parts.

Piece of old DVD act as diffraction grating. I tried also CD for this purpose, but CD generated more higher order spectra but smaller (narrower image), which was limiting max resolution. It became impossible to illuminate the grating correctly, since to widen the image to increase resolution I had to put camera very close to disc piece, and camera started physically obstruct light source, DVD works much better. Although probably best DVD is silver colored one, I guess popular blue type blanks will alter the resulting spectrum.

Aperture slid is made from aluminum can with scalpel, and diffuser from piece of white paper.

I used https://github.com/DerFetzer/spectro-cam-rs as software to process the image. I am not the author of this software, but it looks nicely and has customizable ROI. Currently I stream video over network to ffmpeg, which copies stream to virtual camera.

create loopback on host:

modprobe v4l2loopback

copy stream to loopback device:

ffmpeg -i udp://@:12345 -c:v mjpeg -q:v 3 -f v4l2 LOOPBACK_DEV

on pi:

rpicam-vid -t 0 -l --width 800 --height 100 --roi 0,0.4,1,0.4 -o udp://HOST_IP:12345

https://cad.onshape.com/documents/0620c02eae544ed2d4b69178

edit 1:

added lid with rpi zero 2w holder