Leveraging the digital visualization capabilities of the Raspberry Pi,combined with its portability and ease of use,the measurement scheme for grating spectrometry in university physics experiments has been improved.By independently writing Python programs and utilizing blue and green monochromatic light sources,the wavelengths of the visible spectrum within the field of view were determined,and the diffraction angles of light of different wavelengths were calculated.Additionally,by connecting a homemade grating spectroscope and digital camera,the spectral distribution under different pigment concentrations was successfully displayed on the Raspberry Pi's screen.During the experiment,based on the measured absorbance spectrum and pigment concentration data,a functional relationship between absorbance and pigment concentration was fitted.It measurement scheme not only enhances the accuracy and convenience of the experiment but also provides students with an intuitive learning platform.It helps them to better understand and grasp the principles of spectroscopy and its application in physics experiments.