The LED fits snugly into a LEGO Technic brick with holes and is powered by a battery pack. Then there is space for the sample, followed by a slit. After this, there is a sliding rail for a lens (3D printed mount), a transmission grating, and a viewing card to display the spectrum. The image of the spectrum is then taken with a simple webcam.
To support UG lectures on absorption spectroscopy, we have developed a spectrometer based on LEGO. The components include a light source (white-light LED), slit, lens, diffraction grating (transmission), and a webcam for data acquisition. The overall layout is shown below.