This study use the concept of confocal microscope to set up laser direct writing system. We use laser of the optical pickup head as the light source. Through the objective lens, laser beam will focus vertically on the SU-8 photoresist. To find the appropriate exposure parameters, we adjust the power and the exposure time of laser beam. In this way, it is unnecessary using optical mask, so we don’t require to design and produce the mask. Besides, we can avoid the problems caused by multiple-exposure alignment. This system with confocal detection can measure the position of photoresist instantly in exposure to achieve the goal of manufacturing diffractive elements. This system uses red laser to measure the thickness of photoresist, and then uses blue laser and PZT to exposure (the power density is 3.88μJ/μm2). And it can produce grating whose pitch is 3μm and line width is 1.68μm.