Machine vision angular displacement sensors have the characteristics of high precision and high reliability, gradually becoming a new technological development direction for angular displacement sensors. The optical system is one of the key components for machine vision angular displacement sensors to achieve high-precision measurement. This article presents an optical system design for a machine vision based angular displacement sensor. The optical system consists of two lenses, with a total optical length of only 8.9mm. The 80% geometric encircled radius is less than 14.1um, and the maximum distortion value is 1.6um. It has the characteristics of miniaturization and high image quality. The processing and assembly of the optical system have been completed, and the optical system has been tested on an angular displacement sensor prototype. Through analysis of the measured image data, the value of the encoded stripe edge in the image is approximately 16.5um, which is basically consistent with the design value. The imaging performance of the designed optical system was tested through experiments, and the correctness of the design theory and results was verified.