Portable spectrometers operate on similar principles as their larger counterparts. They typically consist of a light source, a sample holder, a diffraction grating or prism, and a detector. The device directs light through a sample, and the resulting spectrum is captured and analyzed by the detector to determine the sample's composition.