Optical sensors are widely used in marine monitoring. The production of optical sensors in China is not high, and the cutting-edge products are basically dependent on imports. Therefore, on the basis of the existing optical sensor production process, the production process of light source and grating, the core components of optical sensors, is optimized. Based on the original LED production technology, the design and development of purple LED light source for water quality monitoring are completed to solve the problem of high power consumption and uneven irradiation of purple light source. PCF is used as material to make grating, and the process is optimized to improve grating accuracy and service life.